< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 388                     rgbP[i] = 0x00000000;
 389                     rgbP[i+246] = 0x00000000;
 390                 }
 391                 memcpy(&rgbP[10], &logicalEntries[10], 236 * sizeof(RGBQUAD));
 392                 // We need to specify which entries in the colormap are
 393                 // valid so that the transparent black entries we have
 394                 // created do not affect the Transparency setting of the
 395                 // IndexColorModel.  The vbits array is used to construct
 396                 // a BigInteger such that the most significant bit of vbits[0]
 397                 // indicates the validity of the last color (#256) and the
 398                 // least significant bit of vbits[256/8] indicates the
 399                 // validity of the first color (#0).  We need to fill vbits
 400                 // with all 1's and then turn off the first and last 10 bits.
 401                 memset(vbits, 0xff, sizeof(vbits));
 402                 vbits[0] = 0;
 403                 vbits[1] = (jbyte) (0xff >> 2);
 404                 vbits[sizeof(vbits)-2] = (jbyte) (0xff << 2);
 405                 vbits[sizeof(vbits)-1] = 0;
 406                 allvalid = JNI_FALSE;
 407             } else {
 408                 if (AwtPalette::UseCustomPalette() && !dynamic) {
 409                     // If we plan to use our custom palette (i.e., we are
 410                     // not running inside another app and we are not creating
 411                     // a dynamic colorModel object), then setup ICM with
 412                     // custom palette entries
 413                     unsigned int *logicalEntries = palette->GetLogicalEntries();
 414                     memcpy(rgbP, logicalEntries, 256 * sizeof(int));
 415                 } else {
 416                     // Else, use current system palette entries.
 417                     // REMIND: This may not give the result we want if
 418                     // we are running inside another app and that
 419                     // parent app is running in the background when we
 420                     // reach here.  We could at least cache an "ideal" set of
 421                     // system palette entries from the first time we are
 422                     // running in the foreground and then future ICM's will
 423                     // use that set instead.
 424                     unsigned int *systemEntries = palette->GetSystemEntries();
 425                     memcpy(rgbP, systemEntries, 256 * sizeof(int));
 426                 }
 427             }
 428         } catch (...) {


   1 /*
   2  * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 388                     rgbP[i] = 0x00000000;
 389                     rgbP[i+246] = 0x00000000;
 390                 }
 391                 memcpy(&rgbP[10], &logicalEntries[10], 236 * sizeof(RGBQUAD));
 392                 // We need to specify which entries in the colormap are
 393                 // valid so that the transparent black entries we have
 394                 // created do not affect the Transparency setting of the
 395                 // IndexColorModel.  The vbits array is used to construct
 396                 // a BigInteger such that the most significant bit of vbits[0]
 397                 // indicates the validity of the last color (#256) and the
 398                 // least significant bit of vbits[256/8] indicates the
 399                 // validity of the first color (#0).  We need to fill vbits
 400                 // with all 1's and then turn off the first and last 10 bits.
 401                 memset(vbits, 0xff, sizeof(vbits));
 402                 vbits[0] = 0;
 403                 vbits[1] = (jbyte) (0xff >> 2);
 404                 vbits[sizeof(vbits)-2] = (jbyte) (0xff << 2);
 405                 vbits[sizeof(vbits)-1] = 0;
 406                 allvalid = JNI_FALSE;
 407             } else {
 408                 if (!dynamic) {
 409                     // If we plan to use our custom palette (i.e., we are
 410                     // not running inside another app and we are not creating
 411                     // a dynamic colorModel object), then setup ICM with
 412                     // custom palette entries
 413                     unsigned int *logicalEntries = palette->GetLogicalEntries();
 414                     memcpy(rgbP, logicalEntries, 256 * sizeof(int));
 415                 } else {
 416                     // Else, use current system palette entries.
 417                     // REMIND: This may not give the result we want if
 418                     // we are running inside another app and that
 419                     // parent app is running in the background when we
 420                     // reach here.  We could at least cache an "ideal" set of
 421                     // system palette entries from the first time we are
 422                     // running in the foreground and then future ICM's will
 423                     // use that set instead.
 424                     unsigned int *systemEntries = palette->GetSystemEntries();
 425                     memcpy(rgbP, systemEntries, 256 * sizeof(int));
 426                 }
 427             }
 428         } catch (...) {


< prev index next >