src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m
changeset 55708 2b0acaf92ecc
parent 55189 fdaf7287ea3a
child 58679 9c3209ff7550
equal deleted inserted replaced
55707:b8a12f53226e 55708:2b0acaf92ecc
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   212     }
   212     }
   213     pthread_mutex_init(&splash->lock, NULL);
   213     pthread_mutex_init(&splash->lock, NULL);
   214 
   214 
   215     splash->maskRequired = 0;
   215     splash->maskRequired = 0;
   216 
   216 
   217     
   217 
   218     //TODO: the following is too much of a hack but should work in 90% cases.
   218     //TODO: the following is too much of a hack but should work in 90% cases.
   219     //      besides we don't use device-dependent drawing, so probably
   219     //      besides we don't use device-dependent drawing, so probably
   220     //      that's very fine indeed
   220     //      that's very fine indeed
   221     splash->byteAlignment = 1;
   221     splash->byteAlignment = 1;
   222     initFormat(&splash->screenFormat, 0xff << 8,
   222     initFormat(&splash->screenFormat, 0xff << 8,
   280 
   280 
   281 void
   281 void
   282 SplashRedrawWindow(Splash * splash) {
   282 SplashRedrawWindow(Splash * splash) {
   283     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   283     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   284 
   284 
   285     SplashUpdateScreenData(splash);
       
   286 
       
   287     [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
   285     [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
       
   286         // drop the reference to the old view and image
       
   287         [splash->window setContentView: nil];
       
   288         SplashUpdateScreenData(splash);
       
   289 
   288         // NSDeviceRGBColorSpace vs. NSCalibratedRGBColorSpace ?
   290         // NSDeviceRGBColorSpace vs. NSCalibratedRGBColorSpace ?
   289         NSBitmapImageRep * rep = [[NSBitmapImageRep alloc]
   291         NSBitmapImageRep * rep = [[NSBitmapImageRep alloc]
   290             initWithBitmapDataPlanes: (unsigned char**)&splash->screenData
   292             initWithBitmapDataPlanes: (unsigned char**)&splash->screenData
   291                           pixelsWide: splash->width
   293                           pixelsWide: splash->width
   292                           pixelsHigh: splash->height
   294                           pixelsHigh: splash->height
   309             NSSize size = [image size];
   311             NSSize size = [image size];
   310             size.width /= scaleFactor;
   312             size.width /= scaleFactor;
   311             size.height /= scaleFactor;
   313             size.height /= scaleFactor;
   312             [image setSize: size];
   314             [image setSize: size];
   313         }
   315         }
   314         
   316 
   315         NSImageView * view = [[NSImageView alloc] init];
   317         NSImageView * view = [[NSImageView alloc] init];
   316 
   318 
   317         [view setImage: image];
   319         [view setImage: image];
   318         [view setEditable: NO];
   320         [view setEditable: NO];
   319         //NOTE: we don't set a 'wait cursor' for the view because:
   321         //NOTE: we don't set a 'wait cursor' for the view because: