Skip to content

Commit

Permalink
8329340: Remove unused libawt code
Browse files Browse the repository at this point in the history
8315693: Remove WM_AWT_SET_SCROLL_INFO message

Reviewed-by: prr, aivanov
  • Loading branch information
djelinski committed Apr 8, 2024
1 parent 3a3b77d commit 51b0abc
Show file tree
Hide file tree
Showing 23 changed files with 23 additions and 735 deletions.
15 changes: 1 addition & 14 deletions src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -82,19 +82,6 @@ if (rasline) \
if (block) \
(*env)->ReleasePrimitiveArrayCritical(env, blockh, block, 0)

/* Place holders for the old native interface. */

long
sun_awt_image_GifImageDecoder_parseImage()
{
return 0;
}

void
sun_awt_image_GifImageDecoder_initIDs()
{
}

static jmethodID readID;
static jmethodID sendID;
static jfieldID prefixID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -42,7 +42,6 @@ IMGEXTERN jmethodID g_BImgSetRGBMID;
/* Raster ids */
IMGEXTERN jfieldID g_RasterWidthID;
IMGEXTERN jfieldID g_RasterHeightID;
IMGEXTERN jfieldID g_RasterBaseRasterID;
IMGEXTERN jfieldID g_RasterMinXID;
IMGEXTERN jfieldID g_RasterMinYID;
IMGEXTERN jfieldID g_RasterBaseOriginXID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -877,20 +877,6 @@ Java_sun_java2d_windows_GDIRenderer_doShape

} /* extern "C" */

INLINE BOOL RectInMonitorRect(RECT *rCheck, RECT *rContainer)
{
// Assumption: left <= right, top <= bottom
if (rCheck->left >= rContainer->left &&
rCheck->right <= rContainer->right &&
rCheck->top >= rContainer->top &&
rCheck->bottom <= rContainer->bottom)
{
return TRUE;
} else {
return FALSE;
}
}

/*
* Class: sun_java2d_windows_GDIRenderer
* Method: devCopyArea
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -253,44 +253,6 @@ __inline HDC GetThreadDC(JNIEnv *env, GDIWinSDOps *wsdo) {
* code.
*/

static BOOL GDIWinSD_CheckMonitorArea(GDIWinSDOps *wsdo,
SurfaceDataBounds *bounds,
HDC hDC)
{
HWND hW = wsdo->window;
BOOL retCode = TRUE;

J2dTraceLn(J2D_TRACE_INFO, "GDIWinSD_CheckMonitorArea");
int numScreens;
{
Devices::InstanceAccess devices;
numScreens = devices->GetNumDevices();
}
if( numScreens > 1 ) {

LPMONITORINFO miInfo;
RECT rSect ={0,0,0,0};
RECT rView ={bounds->x1, bounds->y1, bounds->x2, bounds->y2};
retCode = FALSE;

miInfo = wsdo->device->GetMonitorInfo();

POINT ptOrig = {0, 0};
::ClientToScreen(hW, &ptOrig);
::OffsetRect(&rView,
(ptOrig.x), (ptOrig.y));

::IntersectRect(&rSect,&rView,&(miInfo->rcMonitor));

if( FALSE == ::IsRectEmpty(&rSect) ) {
if( TRUE == ::EqualRect(&rSect,&rView) ) {
retCode = TRUE;
}
}
}
return retCode;
}

extern "C" {

void
Expand Down Expand Up @@ -552,111 +514,6 @@ GDIWindowSurfaceData_GetWindow(JNIEnv *env, GDIWinSDOps *wsdo)

} /* extern "C" */

static jboolean GDIWinSD_SimpleClip(JNIEnv *env, GDIWinSDOps *wsdo,
SurfaceDataBounds *bounds,
HDC hDC)
{
RECT rClip;

J2dTraceLn(J2D_TRACE_INFO, "GDIWinSD_SimpleClip");
if (hDC == NULL) {
return JNI_FALSE;
}

int nComplexity = ::GetClipBox(hDC, &rClip);

switch (nComplexity) {
case COMPLEXREGION:
{
J2dTraceLn(J2D_TRACE_VERBOSE,
" complex clipping region");
// if complex user/system clip, more detailed testing required
// check to see if the view itself has a complex clip.
// ::GetClipBox is only API which returns overlapped window status
// so we set the rView as our clip, and then see if resulting
// clip is complex.
// Only other way to figure this out would be to walk the
// overlapping windows (no API to get the actual visible clip
// list). Then we'd still have to merge that info with the
// clip region for the dc (if it exists).
// REMIND: we can cache the CreateRectRgnIndirect result,
// and only override with ::SetRectRgn

// First, create a region handle (need existing HRGN for
// the following call).
HRGN rgnSave = ::CreateRectRgn(0, 0, 0, 0);
int clipStatus = ::GetClipRgn(hDC, rgnSave);
if (-1 == clipStatus) {
J2dTraceLn(J2D_TRACE_WARNING,
"GDIWinSD_SimpleClip: failed due to clip status");
::DeleteObject(rgnSave);
return JNI_FALSE;
}
HRGN rgnBounds = ::CreateRectRgn(
bounds->x1 - wsdo->insets.left,
bounds->y1 - wsdo->insets.top,
bounds->x2 - wsdo->insets.left,
bounds->y2 - wsdo->insets.top);
::SelectClipRgn(hDC, rgnBounds);
nComplexity = ::GetClipBox(hDC, &rClip);
::SelectClipRgn(hDC, clipStatus? rgnSave: NULL);
::DeleteObject(rgnSave);
::DeleteObject(rgnBounds);

// Now, test the new clip box. If it's still not a
// SIMPLE region, then our bounds must intersect part of
// the clipping article
if (SIMPLEREGION != nComplexity) {
J2dTraceLn(J2D_TRACE_WARNING,
"GDIWinSD_SimpleClip: failed due to complexity");
return JNI_FALSE;
}
}
// NOTE: No break here - we want to fall through into the
// SIMPLE case, adjust our bounds by the new rClip rect
// and make sure that our locking bounds are not empty.
case SIMPLEREGION:
J2dTraceLn(J2D_TRACE_VERBOSE, " simple clipping region");
// Constrain the bounds to the given clip box
if (bounds->x1 < rClip.left) {
bounds->x1 = rClip.left;
}
if (bounds->y1 < rClip.top) {
bounds->y1 = rClip.top;
}
if (bounds->x2 > rClip.right) {
bounds->x2 = rClip.right;
}
if (bounds->y2 > rClip.bottom) {
bounds->y2 = rClip.bottom;
}
// If the bounds are 0 or negative, then the bounds have
// been obscured by the clip box, so return FALSE
if ((bounds->x2 <= bounds->x1) ||
(bounds->y2 <= bounds->y1)) {
// REMIND: We should probably do something different here
// instead of simply returning FALSE. Since the bounds are
// empty we won't end up drawing anything, so why spend the
// effort of returning false and having GDI do a LOCK_BY_DIB?
// Perhaps we need a new lock code that will indicate that we
// shouldn't bother drawing?
J2dTraceLn(J2D_TRACE_WARNING,
"GDIWinSD_SimpleClip: failed due to empty bounds");
return JNI_FALSE;
}
break;
case NULLREGION:
case ERROR:
default:
J2dTraceLn1(J2D_TRACE_ERROR,
"GDIWinSD_SimpleClip: failed due to incorrect complexity=%d",
nComplexity);
return JNI_FALSE;
}

return JNI_TRUE;
}

static jint GDIWinSD_Lock(JNIEnv *env,
SurfaceDataOps *ops,
SurfaceDataRasInfo *pRasInfo,
Expand Down
23 changes: 1 addition & 22 deletions src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -44,27 +44,6 @@ static const char *HPRINTER_STR = "hPrintJob";
#define PAPERNAME_LENGTH 64
#define TRAYNAME_LENGTH 24


static BOOL IsSupportedLevel(HANDLE hPrinter, DWORD dwLevel) {
BOOL isSupported = FALSE;
DWORD cbBuf = 0;
LPBYTE pPrinter = NULL;

DASSERT(hPrinter != NULL);

VERIFY(::GetPrinter(hPrinter, dwLevel, NULL, 0, &cbBuf) == 0);
if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
pPrinter = new BYTE[cbBuf];
if (::GetPrinter(hPrinter, dwLevel, pPrinter, cbBuf, &cbBuf)) {
isSupported = TRUE;
}
delete[] pPrinter;
}

return isSupported;
}


extern "C" {

JNIEXPORT jstring JNICALL
Expand Down
37 changes: 1 addition & 36 deletions src/java.desktop/windows/native/libawt/windows/awt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -252,41 +252,6 @@ extern JavaVM *jvm;
#endif


struct EnvHolder
{
JavaVM *m_pVM;
JNIEnv *m_env;
bool m_isOwner;
EnvHolder(
JavaVM *pVM,
LPCSTR name = "COM holder",
jint ver = JNI_VERSION_1_2)
: m_pVM(pVM),
m_env((JNIEnv *)JNU_GetEnv(pVM, ver)),
m_isOwner(false)
{
if (NULL == m_env) {
JavaVMAttachArgs attachArgs;
attachArgs.version = ver;
attachArgs.name = const_cast<char *>(name);
attachArgs.group = NULL;
jint status = m_pVM->AttachCurrentThread(
(void**)&m_env,
&attachArgs);
m_isOwner = (NULL!=m_env);
}
}
~EnvHolder() {
if (m_isOwner) {
m_pVM->DetachCurrentThread();
}
}
operator bool() const { return NULL!=m_env; }
bool operator !() const { return NULL==m_env; }
operator JNIEnv*() const { return m_env; }
JNIEnv* operator ->() const { return m_env; }
};

template <class T>
class JLocalRef {
JNIEnv* m_env;
Expand Down
Loading

1 comment on commit 51b0abc

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.