author | alexsch |
Wed, 25 Jun 2014 19:10:32 +0400 | |
changeset 25552 | 96abb01815f6 |
parent 23010 | 6dadb192ad81 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
12047
diff
changeset
|
2 |
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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 |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifndef SPLASHSCREEN_IMPL_H |
|
27 |
#define SPLASHSCREEN_IMPL_H |
|
28 |
||
29 |
#include "splashscreen_config.h" |
|
30 |
#include "splashscreen_gfx.h" |
|
31 |
||
32 |
SPLASHEXPORT int SplashLoadMemory(void *pdata, int size); /* requires preloading the file */ |
|
33 |
SPLASHEXPORT int SplashLoadFile(const char *filename); // FIXME: range checking for SplashLoadMemory |
|
34 |
||
35 |
SPLASHEXPORT void SplashInit(void); |
|
36 |
SPLASHEXPORT void SplashClose(void); |
|
37 |
||
25552
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
38 |
SPLASHEXPORT void SplashSetScaleFactor(float); |
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
39 |
SPLASHEXPORT char* SplashGetScaledImageName(const char*, const char*, float*); |
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
40 |
|
2 | 41 |
SPLASHEXPORT void |
42 |
SplashSetFileJarName(const char* fileName, const char* jarName); |
|
43 |
||
44 |
typedef struct SplashImage |
|
45 |
{ |
|
46 |
rgbquad_t *bitmapBits; |
|
47 |
int delay; /* before next image display, in msec */ |
|
48 |
#if defined(WITH_WIN32) |
|
49 |
HRGN hRgn; |
|
50 |
#elif defined(WITH_X11) |
|
51 |
XRectangle *rects; |
|
52 |
int numRects; |
|
53 |
#endif |
|
54 |
} SplashImage; |
|
55 |
||
56 |
#define SPLASH_COLOR_MAP_SIZE 0x100 |
|
57 |
||
58 |
typedef struct Splash |
|
59 |
{ |
|
60 |
ImageFormat screenFormat; /* must be preset before image decoding */ |
|
61 |
DitherSettings dithers[3]; |
|
62 |
ImageFormat imageFormat; |
|
63 |
rgbquad_t colorMap[SPLASH_COLOR_MAP_SIZE]; |
|
64 |
int byteAlignment; /* must be preset before image decoding */ |
|
65 |
int maskRequired; /* must be preset before image decoding */ |
|
66 |
int width; /* in pixels */ |
|
67 |
int height; /* in pixels */ |
|
68 |
int frameCount; |
|
69 |
SplashImage *frames; /* dynamically allocated array of frame descriptors */ |
|
70 |
unsigned time; /* in msec, origin is not important */ |
|
71 |
rgbquad_t *overlayData; /* overlay image data, always rgbquads */ |
|
72 |
ImageRect overlayRect; |
|
73 |
ImageFormat overlayFormat; |
|
74 |
void *screenData; |
|
75 |
int screenStride; /* stored scanline length in bytes */ |
|
76 |
int currentFrame; // currentFrame==-1 means image is not loaded |
|
77 |
int loopCount; |
|
78 |
int x, y; |
|
79 |
rgbquad_t colorIndex[SPLASH_COLOR_MAP_SIZE]; |
|
80 |
int isVisible; |
|
81 |
char* fileName; /* stored in 16-bit unicode (jchars) */ |
|
82 |
int fileNameLen; |
|
83 |
char* jarName; /* stored in 16-bit unicode (jchars) */ |
|
84 |
int jarNameLen; |
|
25552
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
85 |
float scaleFactor; |
2 | 86 |
#if defined(WITH_WIN32) |
87 |
BOOL isLayered; |
|
88 |
HWND hWnd; |
|
89 |
HPALETTE hPalette; |
|
90 |
CRITICAL_SECTION lock; |
|
91 |
#elif defined(WITH_X11) |
|
92 |
int controlpipe[2]; |
|
93 |
Display *display; |
|
94 |
Window window; |
|
95 |
Screen *screen; |
|
96 |
Visual *visual; |
|
97 |
Colormap cmap; |
|
98 |
pthread_mutex_t lock; |
|
99 |
Cursor cursor; |
|
100 |
XWMHints* wmHints; |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
101 |
#elif defined(WITH_MACOSX) |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
102 |
pthread_mutex_t lock; |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
103 |
int controlpipe[2]; |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
104 |
NSWindow * window; |
2 | 105 |
#endif |
106 |
} Splash; |
|
107 |
||
108 |
/* various shared and/or platform dependent splash screen functions */ |
|
109 |
||
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
110 |
/*************** Platform-specific ******************/ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
111 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
112 |
/* To be implemented in the platform-specific native code. */ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
113 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
114 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
115 |
void SplashInitPlatform(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
116 |
void SplashCreateThread(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
117 |
void SplashCleanupPlatform(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
118 |
void SplashDonePlatform(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
119 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
120 |
unsigned SplashTime(); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
121 |
char* SplashConvertStringAlloc(const char* in, int *size); |
25552
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
122 |
char* SplashGetScaledImageName(const char* jarName, |
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
123 |
const char* fileName, float *scaleFactor); |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
124 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
125 |
void SplashLock(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
126 |
void SplashUnlock(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
127 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
128 |
void SplashInitFrameShape(Splash * splash, int imageIndex); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
129 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
130 |
void SplashUpdate(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
131 |
void SplashReconfigure(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
132 |
void SplashClosePlatform(Splash * splash); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
133 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
134 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
135 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
5506
diff
changeset
|
136 |
/********************* Shared **********************/ |
2 | 137 |
Splash *SplashGetInstance(); |
138 |
||
139 |
int SplashIsStillLooping(Splash * splash); |
|
140 |
void SplashNextFrame(Splash * splash); |
|
141 |
void SplashStart(Splash * splash); |
|
142 |
void SplashDone(Splash * splash); |
|
143 |
||
144 |
void SplashUpdateScreenData(Splash * splash); |
|
145 |
||
146 |
void SplashCleanup(Splash * splash); |
|
25552
96abb01815f6
8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents:
23010
diff
changeset
|
147 |
void SplashSetScaleFactor(float scaleFactor); |
2 | 148 |
|
149 |
||
150 |
typedef struct SplashStream { |
|
151 |
int (*read)(void* pStream, void* pData, int nBytes); |
|
152 |
int (*peek)(void* pStream); |
|
153 |
void (*close)(void* pStream); |
|
154 |
union { |
|
155 |
struct { |
|
156 |
FILE* f; |
|
157 |
} stdio; |
|
158 |
struct { |
|
159 |
unsigned char* pData; |
|
160 |
unsigned char* pDataEnd; |
|
161 |
} mem; |
|
162 |
} arg; |
|
163 |
} SplashStream; |
|
164 |
||
165 |
int SplashStreamInitFile(SplashStream * stream, const char* filename); |
|
166 |
int SplashStreamInitMemory(SplashStream * stream, void * pData, int size); |
|
167 |
||
168 |
/* image decoding */ |
|
169 |
int SplashDecodeGifStream(Splash * splash, SplashStream * stream); |
|
170 |
int SplashDecodeJpegStream(Splash * splash, SplashStream * stream); |
|
171 |
int SplashDecodePngStream(Splash * splash, SplashStream * stream); |
|
172 |
||
173 |
/* utility functions */ |
|
174 |
||
175 |
int BitmapToYXBandedRectangles(ImageRect * pSrcRect, RECT_T * out); |
|
176 |
||
2608
fe2af56a83d3
6804996: JWS PNG Decoding Integer Overflow [V-flrhat2ln8]
bae
parents:
2
diff
changeset
|
177 |
#define SAFE_TO_ALLOC(c, sz) \ |
fe2af56a83d3
6804996: JWS PNG Decoding Integer Overflow [V-flrhat2ln8]
bae
parents:
2
diff
changeset
|
178 |
(((c) > 0) && ((sz) > 0) && \ |
fe2af56a83d3
6804996: JWS PNG Decoding Integer Overflow [V-flrhat2ln8]
bae
parents:
2
diff
changeset
|
179 |
((0xffffffffu / ((unsigned int)(c))) > (unsigned int)(sz))) |
fe2af56a83d3
6804996: JWS PNG Decoding Integer Overflow [V-flrhat2ln8]
bae
parents:
2
diff
changeset
|
180 |
|
2 | 181 |
#define dbgprintf printf |
182 |
||
183 |
#endif |