< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2020, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -28,12 +28,10 @@
 #include "awt_Component.h"
 #include "img_util_md.h"
 #include "awt_CustomPaletteDef.h"
 #include "Trace.h"
 
-BOOL AwtPalette::m_useCustomPalette = TRUE;
-
 #define ERROR_GRAY (-1)
 #define NON_GRAY 0
 #define LINEAR_STATIC_GRAY 1
 #define NON_LINEAR_STATIC_GRAY 2
 

@@ -44,12 +42,11 @@
  */
 HPALETTE AwtPalette::Select(HDC hDC)
 {
     HPALETTE prevPalette = NULL;
     if (logicalPalette) {
-        BOOL background = !(m_useCustomPalette);
-        prevPalette = ::SelectPalette(hDC, logicalPalette, background);
+        prevPalette = ::SelectPalette(hDC, logicalPalette, FALSE);
     }
     return prevPalette;
 }
 
 /**

@@ -58,12 +55,11 @@
  * that HDC.
  */
 void AwtPalette::Realize(HDC hDC)
 {
     if (logicalPalette) {
-        if (!m_useCustomPalette ||
-            AwtComponent::QueryNewPaletteCalled() ||
+        if (AwtComponent::QueryNewPaletteCalled() ||
             AwtToolkit::GetInstance().HasDisplayChanged()) {
             // Fix for bug 4178909, workaround for Windows bug.  Shouldn't
             // do a RealizePalette until the first QueryNewPalette message
             // has been processed.
             // But if we are switching the primary monitor from non-8bpp

@@ -78,32 +74,10 @@
         }
     }
 }
 
 /**
- * Disable the use of our custom palette.  This method is called
- * during initialization if we detect that we are running inside
- * the plugin; we do not want to clobber our parent application's
- * palette with our own in that situation.
- */
-void AwtPalette::DisableCustomPalette()
-{
-    m_useCustomPalette = FALSE;
-}
-
-/**
- * Returns whether we are currently using a custom palette.  Used
- * by AwtWin32GraphicsDevice when creating the colorModel of the
- * device.
- */
-BOOL AwtPalette::UseCustomPalette()
-{
-    return m_useCustomPalette;
-}
-
-
-/**
  * Constructor.  Initialize the system and logical palettes.
  * used by this object.
  */
 AwtPalette::AwtPalette(AwtWin32GraphicsDevice *device)
 {

@@ -151,11 +125,11 @@
     delete[] pLogPal;
     if ( hPal == 0 ) {
         return 0;
     }
 
-    hPalOld = ::SelectPalette(hDC, hPal, 1);
+    hPalOld = ::SelectPalette(hDC, hPal, TRUE);
     if (hPalOld == 0) {
         ::DeleteObject(hPal);
         return 0;
     }
     ::RealizePalette(hDC);

@@ -166,11 +140,11 @@
         pPalEntries[iEntry].peRed = GetRValue(rgb);
         pPalEntries[iEntry].peGreen = GetGValue(rgb);
         pPalEntries[iEntry].peBlue = GetBValue(rgb);
     }
 
-    ::SelectPalette(hDC, hPalOld, 0 );
+    ::SelectPalette(hDC, hPalOld, FALSE);
     ::DeleteObject(hPal);
     ::RealizePalette(hDC);
 
     return 256;
 }
< prev index next >