Mercurial > sdl-ios-xcode
annotate src/video/windows/SDL_gapirender.c @ 5090:455bc74f7034
Fixed bug #1100
Test the video features with #if instead of #ifdef
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 24 Jan 2011 17:38:18 -0800 |
parents | c2539ff054c8 |
children | 327f181542f1 |
rev | line source |
---|---|
4569 | 1 /*************************************************************************** |
2 * Copyright (C) 2010 by Andrey Afletdinov <afletdinov@gmail.com> * | |
3 * * | |
4 * WinCE RAW/GAPI video driver * | |
5 * * | |
6 * Part of the SDL - (Simple DirectMedia Layer) * | |
7 * http://www.libsdl.org * | |
8 * * | |
9 * This program is free software; you can redistribute it and/or modify * | |
10 * it under the terms of the GNU General Public License as published by * | |
11 * the Free Software Foundation; either version 2 of the License, or * | |
12 * (at your option) any later version. * | |
13 * * | |
14 * This program is distributed in the hope that it will be useful, * | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
17 * GNU General Public License for more details. * | |
18 * * | |
19 * You should have received a copy of the GNU General Public License * | |
20 * along with this program; if not, write to the * | |
21 * Free Software Foundation, Inc., * | |
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | |
23 ***************************************************************************/ | |
3168 | 24 |
25 #include "SDL_config.h" | |
26 | |
27 #if SDL_VIDEO_RENDER_GAPI | |
28 | |
5062 | 29 #include "SDL_windowsvideo.h" |
30 #include "SDL_windowswindow.h" | |
3168 | 31 #include "../SDL_yuv_sw_c.h" |
32 | |
4569 | 33 // RawFrameBufferInfo |
34 typedef struct | |
35 { | |
36 WORD wFormat; | |
37 WORD wBPP; | |
38 VOID *pFramePointer; | |
39 int cxStride; | |
40 int cyStride; | |
41 int cxPixels; | |
42 int cyPixels; | |
43 } RawFrameBufferInfo; | |
3168 | 44 |
4569 | 45 // GXDeviceInfo |
46 typedef struct | |
47 { | |
48 long Version; | |
49 void* pvFrameBuffer; | |
50 unsigned long cbStride; | |
51 unsigned long cxWidth; | |
52 unsigned long cyHeight; | |
53 unsigned long cBPP; | |
54 unsigned long ffFormat; | |
55 char unknown[0x84 - 7 * 4]; | |
56 } GXDeviceInfo; | |
3168 | 57 |
4569 | 58 // wince: GXDisplayProperties |
59 struct GXDisplayProperties | |
60 { | |
61 DWORD cxWidth; | |
62 DWORD cyHeight; | |
63 long cbxPitch; | |
64 long cbyPitch; | |
65 long cBPP; | |
66 DWORD ffFormat; | |
3168 | 67 }; |
68 | |
4569 | 69 // gx.dll |
70 typedef int (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags); | |
71 typedef int (*PFNGXCloseDisplay)(); | |
72 typedef void* (*PFNGXBeginDraw)(); | |
73 typedef int (*PFNGXEndDraw)(); | |
74 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)(); | |
75 typedef int (*PFNGXSuspend)(); | |
76 typedef int (*PFNGXResume)(); | |
3168 | 77 |
4569 | 78 typedef struct |
79 { | |
80 // gx.dll | |
81 HMODULE hGapiLib; | |
82 PFNGXOpenDisplay GXOpenDisplay; | |
83 PFNGXCloseDisplay GXCloseDisplay; | |
84 PFNGXBeginDraw GXBeginDraw; | |
85 PFNGXEndDraw GXEndDraw; | |
86 PFNGXGetDisplayProperties GXGetDisplayProperties; | |
87 PFNGXSuspend GXSuspend; | |
88 PFNGXResume GXResume; | |
89 } GapiInfo; | |
90 | |
91 //#ifndef DM_DISPLAYORIENTATION | |
92 //#define DM_DISPLAYORIENTATION 0x00800000L | |
93 //#endif | |
94 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
95 #define FORMAT_565 1 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
96 #define FORMAT_555 2 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
97 #define FORMAT_OTHER 3 |
4569 | 98 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
99 #define GETRAWFRAMEBUFFER 0x00020001 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
100 #define GETGXINFO 0x00020000 |
4569 | 101 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
102 #define kfPalette 0x10 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
103 #define kfDirect 0x20 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
104 #define kfDirect555 0x40 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
105 #define kfDirect565 0x80 |
3168 | 106 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
107 #define GX_FULLSCREEN 0x01 |
4569 | 108 |
109 enum ScreenOrientation { ORIENTATION_UNKNOWN = -1, ORIENTATION_UP = DMDO_0, ORIENTATION_DOWN = DMDO_180, ORIENTATION_LEFT = DMDO_270, ORIENTATION_RIGHT = DMDO_90 }; | |
110 enum ScreenGeometry { GEOMETRY_UNKNOWN, GEOMETRY_PORTRAIT, GEOMETRY_LANDSCAPE, GEOMETRY_SQUARE }; | |
111 enum FrameBufferFlags { FB_SKIP_OFFSET = 0x0001, FB_RAW_MODE = 0x0002, FB_SUSPENDED = 0x0004 }; | |
112 | |
113 // private framebuffer info | |
114 typedef struct | |
115 { | |
116 int width; | |
117 int height; | |
118 int xpitch; | |
119 int ypitch; | |
120 int offset; | |
121 } FrameBufferInfo; | |
3168 | 122 |
4569 | 123 // private display data |
124 typedef struct | |
125 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
126 unsigned char* pixels; // video memory |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
127 int format; // video format |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
128 FrameBufferInfo fb; // framebuffer geometry |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
129 GapiInfo* gapi; // GAPI module |
4569 | 130 int userOrientation; |
131 int systemOrientation; | |
132 int hardwareGeometry; | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
133 int flags; // fb flags |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
134 float scale; // scale pointer position |
4569 | 135 int debug; |
3168 | 136 |
4569 | 137 } WINCE_RenderData; |
138 | |
139 typedef struct | |
140 { | |
141 SDL_SW_YUVTexture *yuv; | |
142 Uint32 format; | |
143 void *pixels; | |
144 int pitch; | |
145 | |
146 } WINCE_TextureData; | |
3168 | 147 |
148 | |
4569 | 149 // system func |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
150 SDL_Renderer* WINCE_CreateRenderer(SDL_Window* window, Uint32 flags); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
151 void WINCE_DestroyRenderer(SDL_Renderer* renderer); |
4569 | 152 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
153 int WINCE_CreateTexture(SDL_Renderer* renderer, SDL_Texture* texture); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
154 void WINCE_DestroyTexture(SDL_Renderer* renderer, SDL_Texture* texture); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
155 int WINCE_QueryTexturePixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
156 int WINCE_UpdateTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
157 int WINCE_LockTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int dirty, void** pixels, int* pitch); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
158 void WINCE_UnlockTexture(SDL_Renderer* renderer, SDL_Texture* texture); |
4569 | 159 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
160 int WINCE_Available(void); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
161 void WINCE_SetupOrientation(WINCE_RenderData* data, int width, int height); |
4569 | 162 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
163 int WINCE_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srect, const SDL_Rect* drect); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
164 void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible); |
4569 | 165 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
166 void WINCE_RenderPresent(SDL_Renderer* renderer); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
167 int WINCE_RenderDrawPoints(SDL_Renderer* renderer, const SDL_Point* points, int count); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
168 int WINCE_RenderDrawLines(SDL_Renderer* renderer, const SDL_Point* points, int count); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
169 int WINCE_RenderDrawRects(SDL_Renderer* renderer, const SDL_Rect ** rects, int count); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
170 int WINCE_RenderFillRects(SDL_Renderer* renderer, const SDL_Rect** rects, int count); |
4569 | 171 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
172 void WINCE_PointerCoordinateTransform(SDL_Window* window, POINT* pt); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
173 void WINCE_DumpVideoInfo(WINCE_RenderData* data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
174 void WINCE_PortraitTransform(WINCE_RenderData* data, int width, int height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
175 void WINCE_LandscapeTransform(WINCE_RenderData* data, int width, int height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
176 void WINCE_SquareTransform(WINCE_RenderData* data, int width, int height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
177 int WINCE_FixedGeometry(FrameBufferInfo* fb, int bpp, int debug); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
178 int WINCE_GetDMOrientation(void); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
179 int WINCE_SetDMOrientation(int orientation); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
180 void WINCE_UpdateYUVTextureData(SDL_Texture* texture); |
4569 | 181 |
182 // gapi engine specific | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
183 int GAPI_Init(WINCE_RenderData* data, HWND hwnd); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
184 void GAPI_Quit(WINCE_RenderData* data); |
4569 | 185 |
186 // raw engine specific | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
187 int RAW_Init(WINCE_RenderData* data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
188 void RAW_Quit(WINCE_RenderData* data); |
4569 | 189 |
190 // tools | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
191 void FrameBufferRotate(FrameBufferInfo* src, int orientation); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
192 int GetFrameBufferOrientation(const FrameBufferInfo* src); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
193 void PointerRotate(POINT* pt, const FrameBufferInfo* fb, int orientation); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
194 void FrameBufferInitialize(FrameBufferInfo* fb); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
195 void FrameBufferDumpInfo(const FrameBufferInfo* fb, const char*); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
196 const char* GetOrientationName(int orientation); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
197 void UpdateLine16to16(const FrameBufferInfo* fb, const Uint16* src, Uint16* dst, Uint16 width); |
4569 | 198 |
199 // stdlib | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
200 static __inline__ int __abs(int x){ return x < 0 ? -x : x; }; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
201 static __inline__ void __swap(int* a, int* b){ int t = *a; *a = *b; *b = t; }; |
3168 | 202 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
203 #define GAPI_RENDER_NAME "gapi" |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
204 #define RAW_RENDER_NAME "raw" |
4569 | 205 // |
206 SDL_RenderDriver GAPI_RenderDriver = { | |
207 WINCE_CreateRenderer, | |
208 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
209 GAPI_RENDER_NAME, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
210 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
211 (SDL_TEXTUREMODULATE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
212 (SDL_BLENDMODE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
213 (SDL_SCALEMODE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
214 7, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
215 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
216 SDL_PIXELFORMAT_RGB555, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
217 SDL_PIXELFORMAT_RGB565, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
218 SDL_PIXELFORMAT_YV12, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
219 SDL_PIXELFORMAT_IYUV, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
220 SDL_PIXELFORMAT_YUY2, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
221 SDL_PIXELFORMAT_UYVY, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
222 SDL_PIXELFORMAT_YVYU |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
223 }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
224 0, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
225 0 |
3168 | 226 } |
4569 | 227 }; |
228 | |
229 SDL_RenderDriver RAW_RenderDriver = { | |
230 WINCE_CreateRenderer, | |
231 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
232 RAW_RENDER_NAME, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
233 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
234 (SDL_TEXTUREMODULATE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
235 (SDL_BLENDMODE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
236 (SDL_SCALEMODE_NONE), |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
237 7, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
238 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
239 SDL_PIXELFORMAT_RGB555, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
240 SDL_PIXELFORMAT_RGB565, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
241 SDL_PIXELFORMAT_YV12, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
242 SDL_PIXELFORMAT_IYUV, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
243 SDL_PIXELFORMAT_YUY2, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
244 SDL_PIXELFORMAT_UYVY, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
245 SDL_PIXELFORMAT_YVYU |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
246 }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
247 0, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
248 0 |
4569 | 249 } |
250 }; | |
251 | |
252 int WINCE_Available(void) | |
253 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
254 HMODULE render_gapi; |
4569 | 255 const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER"); |
256 | |
257 // raw check | |
258 RawFrameBufferInfo rfbi = { 0 }; | |
259 HDC hdc = GetDC(NULL); | |
260 int render_raw = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi); | |
261 ReleaseDC(NULL, hdc); | |
262 | |
263 if(render_raw != 0 && rfbi.cxPixels != 0 && rfbi.cyPixels != 0 && | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
264 rfbi.pFramePointer != 0 && rfbi.cxStride != 0 && rfbi.cyStride != 0) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
265 render_raw = 1; |
4569 | 266 |
267 if(preferably && 0 == SDL_strcasecmp(preferably, RAW_RENDER_NAME)) return 0 != render_raw; | |
268 | |
269 // gapi check | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
270 render_gapi = LoadLibrary(TEXT("\\Windows\\gx.dll")); |
4569 | 271 if(0 == render_gapi) |
272 render_gapi = LoadLibrary(TEXT("gx.dll")); | |
273 FreeLibrary(render_gapi); | |
274 | |
275 if(preferably && 0 == SDL_strcasecmp(preferably, GAPI_RENDER_NAME)) return 0 != render_gapi; | |
276 | |
277 return 0 != render_raw || 0 != render_gapi; | |
3168 | 278 } |
279 | |
4569 | 280 void WINCE_AddRenderDriver(_THIS) |
3168 | 281 { |
4569 | 282 HDC hdc; |
283 HMODULE render_gapi; | |
284 int render_raw, ii; | |
285 const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER"); | |
3520
83518f8fcd61
Fixed calls to SDL_AddRenderDriver()
Sam Lantinga <slouken@libsdl.org>
parents:
3168
diff
changeset
|
286 |
4569 | 287 // raw check |
288 RawFrameBufferInfo rfbi = { 0 }; | |
289 hdc = GetDC(NULL); | |
290 render_raw = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi); | |
291 ReleaseDC(NULL, hdc); | |
3168 | 292 |
4569 | 293 if(render_raw != 0 && rfbi.cxPixels != 0 && rfbi.cyPixels != 0 && |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
294 rfbi.pFramePointer != 0 && rfbi.cxStride != 0 && rfbi.cyStride != 0) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
295 render_raw = 1; |
3168 | 296 |
4569 | 297 // gapi check |
298 render_gapi = LoadLibrary(TEXT("\\Windows\\gx.dll")); | |
299 if(0 == render_gapi) | |
300 render_gapi = LoadLibrary(TEXT("gx.dll")); | |
301 | |
302 if(render_gapi) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
303 FreeLibrary(render_gapi); |
3168 | 304 |
4569 | 305 for(ii = 0; ii < _this->num_displays; ++ii) |
306 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
307 if(preferably) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
308 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
309 if(0 == SDL_strcasecmp(preferably, RAW_RENDER_NAME) && render_raw) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
310 SDL_AddRenderDriver(&_this->displays[ii], &RAW_RenderDriver); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
311 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
312 if(0 == SDL_strcasecmp(preferably, GAPI_RENDER_NAME) && render_gapi) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
313 SDL_AddRenderDriver(&_this->displays[ii], &GAPI_RenderDriver); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
314 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
315 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
316 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
317 if(render_raw) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
318 SDL_AddRenderDriver(&_this->displays[ii], &RAW_RenderDriver); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
319 if(render_gapi) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
320 SDL_AddRenderDriver(&_this->displays[ii], &GAPI_RenderDriver); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
321 } |
3520
83518f8fcd61
Fixed calls to SDL_AddRenderDriver()
Sam Lantinga <slouken@libsdl.org>
parents:
3168
diff
changeset
|
322 } |
3168 | 323 } |
324 | |
4569 | 325 SDL_Renderer* WINCE_CreateRenderer(SDL_Window* window, Uint32 flags) |
3168 | 326 { |
4569 | 327 SDL_VideoDisplay* display = window->display; |
328 SDL_DisplayMode* displayMode = &display->current_mode; | |
329 SDL_WindowData* windowdata = (SDL_WindowData *) window->driverdata; | |
330 SDL_Renderer* renderer; | |
331 WINCE_RenderData* data; | |
332 int bpp; | |
333 Uint32 Rmask, Gmask, Bmask, Amask; | |
3168 | 334 |
4569 | 335 if(!(window->flags & SDL_WINDOW_FULLSCREEN)) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
336 window->flags |= SDL_WINDOW_FULLSCREEN; |
3168 | 337 |
4569 | 338 if(!SDL_PixelFormatEnumToMasks(displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) |
339 { | |
340 SDL_SetError("Unknown display format"); | |
3168 | 341 return NULL; |
342 } | |
343 | |
4569 | 344 switch(window->fullscreen_mode.format) |
345 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
346 case SDL_PIXELFORMAT_RGB555: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
347 case SDL_PIXELFORMAT_RGB565: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
348 break; |
4569 | 349 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
350 default: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
351 SDL_SetError("Support only 16 or 15 bpp"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
352 return NULL; |
3168 | 353 } |
354 | |
4569 | 355 renderer = (SDL_Renderer*) SDL_calloc(1, sizeof(SDL_Renderer)); |
356 if(!renderer) | |
357 { | |
3168 | 358 SDL_OutOfMemory(); |
359 return NULL; | |
360 } | |
361 | |
4569 | 362 data = (WINCE_RenderData*) SDL_calloc(1, sizeof(WINCE_RenderData)); |
363 if(!data) | |
364 { | |
365 WINCE_DestroyRenderer(renderer); | |
3168 | 366 SDL_OutOfMemory(); |
367 return NULL; | |
368 } | |
369 | |
4569 | 370 // initialize internal engine |
371 if(!RAW_Init(data) && !GAPI_Init(data, windowdata->hwnd)) | |
3168 | 372 { |
4569 | 373 WINCE_DestroyRenderer(renderer); |
3168 | 374 return NULL; |
375 } | |
376 | |
377 | |
4569 | 378 // set debug |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
379 data->debug = SDL_getenv("DEBUG_VIDEO_GAPI") || SDL_getenv("GAPI_RENDERER_DEBUG") ? 1 : 0; |
4569 | 380 #if defined(DEBUG_VIDEO_GAPI) || defined(GAPI_RENDERER_DEBUG) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
381 data->debug = 1; |
4569 | 382 #endif |
3168 | 383 |
4569 | 384 windowdata->videodata->render = data->gapi ? RENDER_GAPI : RENDER_RAW; |
385 windowdata->videodata->CoordTransform = WINCE_PointerCoordinateTransform; | |
3168 | 386 |
4569 | 387 window->display->device->MaximizeWindow = NULL; |
388 window->display->device->MinimizeWindow = NULL; | |
3168 | 389 |
4569 | 390 WINCE_SetupOrientation(data, window->w, window->h); |
3168 | 391 |
4569 | 392 renderer->CreateTexture = WINCE_CreateTexture; |
393 renderer->DestroyTexture = WINCE_DestroyTexture; | |
394 renderer->QueryTexturePixels = WINCE_QueryTexturePixels; | |
395 renderer->UpdateTexture = WINCE_UpdateTexture; | |
396 renderer->LockTexture = WINCE_LockTexture; | |
397 renderer->UnlockTexture = WINCE_UnlockTexture; | |
3168 | 398 |
4569 | 399 renderer->RenderCopy = WINCE_RenderCopy; |
400 renderer->DestroyRenderer = WINCE_DestroyRenderer; | |
3168 | 401 |
4569 | 402 renderer->RenderPresent = WINCE_RenderPresent; |
403 renderer->RenderDrawPoints = WINCE_RenderDrawPoints; | |
404 renderer->RenderDrawLines = WINCE_RenderDrawLines; | |
405 renderer->RenderDrawRects = WINCE_RenderDrawRects; | |
406 renderer->RenderFillRects = WINCE_RenderFillRects; | |
3168 | 407 |
4569 | 408 renderer->info = data->gapi ? GAPI_RenderDriver.info : RAW_RenderDriver.info; |
3168 | 409 |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3612
diff
changeset
|
410 renderer->window = window; |
3168 | 411 renderer->driverdata = data; |
412 | |
413 return renderer; | |
414 } | |
415 | |
4569 | 416 void WINCE_DestroyRenderer(SDL_Renderer* renderer) |
417 { | |
418 WINCE_RenderData *renderdata = (WINCE_RenderData*) renderer->driverdata; | |
419 | |
420 if(renderdata) | |
421 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
422 if(renderdata->gapi) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
423 GAPI_Quit(renderdata); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
424 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
425 RAW_Quit(renderdata); |
4569 | 426 |
427 SDL_free(renderdata); | |
428 } | |
429 | |
430 SDL_free(renderer); | |
431 } | |
432 | |
433 int WINCE_CreateTexture(SDL_Renderer* renderer, SDL_Texture* texture) | |
434 { | |
435 WINCE_TextureData* texturedata = (WINCE_TextureData*) SDL_calloc(1, sizeof(WINCE_TextureData)); | |
436 if(NULL == texturedata) | |
437 { | |
438 SDL_OutOfMemory(); | |
439 return -1; | |
440 } | |
441 | |
442 texturedata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); | |
443 texturedata->pixels = SDL_malloc(texture->h * texturedata->pitch); | |
444 if(NULL == texturedata->pixels) | |
445 { | |
446 SDL_OutOfMemory(); | |
447 return -1; | |
448 } | |
449 | |
450 if(SDL_ISPIXELFORMAT_FOURCC(texture->format)) | |
451 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
452 SDL_Window* window = renderer->window; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
453 SDL_VideoDisplay* display = window->display; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
454 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
455 texturedata->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); |
4569 | 456 if(NULL == texturedata->yuv) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
457 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
458 SDL_OutOfMemory(); |
4569 | 459 return -1; |
460 } | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
461 texturedata->format = display->current_mode.format; |
4569 | 462 } |
463 else | |
464 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
465 texturedata->yuv = NULL; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
466 texturedata->format = texture->format; |
4569 | 467 } |
468 | |
469 texture->driverdata = texturedata; | |
470 | |
471 return 0; | |
472 } | |
473 | |
474 void WINCE_DestroyTexture(SDL_Renderer* renderer, SDL_Texture* texture) | |
475 { | |
476 WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata; | |
477 | |
478 if(texturedata) | |
479 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
480 if(texturedata->yuv) SDL_SW_DestroyYUVTexture(texturedata->yuv); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
481 if(texturedata->pixels) SDL_free(texturedata->pixels); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
482 SDL_free(texturedata); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
483 texture->driverdata = NULL; |
4569 | 484 } |
485 } | |
486 | |
487 int WINCE_QueryTexturePixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch) | |
488 { | |
489 WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata; | |
490 | |
491 if(texturedata->yuv) | |
492 return SDL_SW_QueryYUVTexturePixels(texturedata->yuv, pixels, pitch); | |
493 | |
494 *pixels = texturedata->pixels; | |
495 *pitch = texturedata->pitch; | |
496 | |
497 return 0; | |
498 } | |
499 | |
500 int WINCE_UpdateTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch) | |
3168 | 501 { |
4569 | 502 WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata; |
503 | |
504 if(texturedata->yuv) | |
505 { | |
506 if(SDL_SW_UpdateYUVTexture(texturedata->yuv, rect, pixels, pitch) < 0) | |
507 return -1; | |
508 WINCE_UpdateYUVTextureData(texture); | |
509 return 0; | |
510 } | |
511 | |
512 if(0 < rect->w && 0 < rect->h) | |
513 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
514 const unsigned char *src = ((const unsigned char*) pixels); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
515 unsigned char *dst = ((unsigned char*) texturedata->pixels) + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
516 rect->y * texturedata->pitch + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
517 rect->x * SDL_BYTESPERPIXEL(texture->format); |
4569 | 518 int length = rect->w * SDL_BYTESPERPIXEL(texture->format); |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
519 int height = rect->h; |
4569 | 520 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
521 while(height--) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
522 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
523 SDL_memcpy(dst, src, length); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
524 dst += texturedata->pitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
525 src += pitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
526 } |
4569 | 527 } |
528 | |
529 return 0; | |
530 } | |
531 | |
532 int WINCE_LockTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int dirty, void** pixels, int* pitch) | |
533 { | |
534 WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata; | |
535 | |
536 if(texturedata->yuv) | |
537 return SDL_SW_LockYUVTexture(texturedata->yuv, rect, dirty, pixels, pitch); | |
538 | |
539 *pixels = (void *) ((unsigned char*) texturedata->pixels + | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
540 rect->y * texturedata->pitch + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
541 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
4569 | 542 *pitch = texturedata->pitch; |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
543 return 0; |
4569 | 544 } |
545 | |
546 void WINCE_UnlockTexture(SDL_Renderer* renderer, SDL_Texture* texture) | |
547 { | |
548 WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata; | |
549 | |
550 if(texturedata->yuv) | |
551 { | |
552 SDL_SW_UnlockYUVTexture(texturedata->yuv); | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
553 WINCE_UpdateYUVTextureData(texture); |
4569 | 554 } |
555 } | |
556 | |
557 int WINCE_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srect, const SDL_Rect* drect) | |
558 { | |
559 WINCE_RenderData* dstdata = (WINCE_RenderData*) renderer->driverdata; | |
560 WINCE_TextureData* srcdata = (WINCE_TextureData*) texture->driverdata; | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
561 const unsigned char *src; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
562 unsigned char *dst; |
4569 | 563 |
564 if((dstdata->flags & FB_SUSPENDED) || | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
565 0 >= srect->w || 0 >= srect->h) return 0; |
4569 | 566 |
567 // lock gapi | |
568 if(dstdata->gapi) dstdata->gapi->GXBeginDraw(); | |
569 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
570 src = ((const unsigned char*) srcdata->pixels); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
571 dst = dstdata->pixels + (dstdata->flags & FB_SKIP_OFFSET ? 0 : dstdata->fb.offset) + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
572 drect->y * dstdata->fb.ypitch + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
573 drect->x * dstdata->fb.xpitch; |
4569 | 574 if(srcdata->yuv) |
575 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
576 return SDL_SW_CopyYUVToRGB(srcdata->yuv, |
4569 | 577 srect, srcdata->format, |
578 drect->w, drect->h, dst, | |
579 dstdata->fb.ypitch); | |
580 } | |
581 else | |
582 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
583 int height = drect->h; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
584 int length = drect->w * SDL_BYTESPERPIXEL(texture->format); // in bytes |
4569 | 585 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
586 while(height--) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
587 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
588 switch(SDL_BYTESPERPIXEL(texture->format)) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
589 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
590 case 2: UpdateLine16to16(&dstdata->fb, (Uint16*) src, (Uint16*) dst, length >> 1); break; |
4569 | 591 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
592 default: break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
593 } |
4569 | 594 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
595 dst += dstdata->fb.ypitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
596 src += srcdata->pitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
597 } |
4569 | 598 } |
599 | |
600 // unlock gapi | |
601 if(dstdata->gapi) dstdata->gapi->GXEndDraw(); | |
602 | |
603 return 0; | |
604 } | |
605 | |
606 void WINCE_RenderPresent(SDL_Renderer* renderer) | |
607 { | |
608 } | |
609 | |
610 int WINCE_RenderDrawPoints(SDL_Renderer* renderer, const SDL_Point* points, int count) | |
611 { | |
3612
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
612 SDL_Unsupported(); |
3168 | 613 return -1; |
614 } | |
615 | |
4569 | 616 int WINCE_RenderDrawLines(SDL_Renderer* renderer, const SDL_Point* points, int count) |
3168 | 617 { |
3612
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
618 SDL_Unsupported(); |
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
619 return -1; |
3168 | 620 } |
621 | |
4569 | 622 int WINCE_RenderDrawRects(SDL_Renderer* renderer, const SDL_Rect ** rects, int count) |
3168 | 623 { |
3612
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
624 SDL_Unsupported(); |
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
625 return -1; |
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
626 } |
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
627 |
4569 | 628 int WINCE_RenderFillRects(SDL_Renderer* renderer, const SDL_Rect** rects, int count) |
3612
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
629 { |
ce7d4942d18b
I can't compile this, but it should be updated for the new rendering API now.
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
630 SDL_Unsupported(); |
3168 | 631 return -1; |
632 } | |
633 | |
4569 | 634 |
635 | |
636 void WINCE_SetupOrientation(WINCE_RenderData* data, int width, int height) | |
3168 | 637 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
638 const float maxW1 = (float)(GetSystemMetrics(SM_CXSCREEN) > GetSystemMetrics(SM_CYSCREEN) ? GetSystemMetrics(SM_CXSCREEN) : GetSystemMetrics(SM_CYSCREEN)); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
639 const float maxW2 = (float)(data->fb.width > data->fb.height ? data->fb.width : data->fb.height); |
4569 | 640 |
641 // scale define | |
642 data->scale = maxW2 / maxW1; | |
643 | |
644 // init fb values | |
645 FrameBufferInitialize(&data->fb); | |
646 | |
647 // orientation values | |
648 data->userOrientation = ORIENTATION_UP; | |
649 data->systemOrientation = WINCE_GetDMOrientation(); | |
650 data->hardwareGeometry = data->fb.width == data->fb.height ? GEOMETRY_SQUARE : | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
651 (data->fb.width < data->fb.height ? GEOMETRY_PORTRAIT : GEOMETRY_LANDSCAPE); |
4569 | 652 |
653 if(data->debug) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
654 WINCE_DumpVideoInfo(data); |
4569 | 655 |
656 if(data->systemOrientation == ORIENTATION_UNKNOWN) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
657 data->systemOrientation = ORIENTATION_UP; |
4569 | 658 |
659 data->userOrientation = ORIENTATION_UP; | |
3168 | 660 |
4569 | 661 switch(data->hardwareGeometry) |
662 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
663 case GEOMETRY_PORTRAIT: WINCE_PortraitTransform(data, width, height); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
664 case GEOMETRY_LANDSCAPE: WINCE_LandscapeTransform(data, width, height); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
665 case GEOMETRY_SQUARE: WINCE_SquareTransform(data, width, height); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
666 default: break; |
4569 | 667 } |
668 | |
669 // debug | |
670 if(data->debug) | |
671 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
672 printf("\n"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
673 printf("user video width: %d\n", width); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
674 printf("user video height: %d\n", height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
675 FrameBufferDumpInfo(&data->fb, "user"); |
4569 | 676 } |
677 } | |
678 | |
679 void WINCE_DumpVideoInfo(WINCE_RenderData* data) | |
680 { | |
681 // get oem info | |
682 WCHAR oemInfo[48]; | |
683 SDL_memset(oemInfo, 0, sizeof(oemInfo)); | |
684 SystemParametersInfo(SPI_GETOEMINFO, sizeof(oemInfo) - sizeof(WCHAR), oemInfo, 0); | |
685 | |
686 printf("hardware oem: "); | |
687 wprintf(oemInfo); | |
688 printf("\n"); | |
3168 | 689 |
4569 | 690 printf("video driver mode: %s\n", (data->flags & FB_RAW_MODE ? RAW_RENDER_NAME : GAPI_RENDER_NAME)); |
691 printf("GetSystemMetrics(SM_CXSCREEN): %d\n", GetSystemMetrics(SM_CXSCREEN)); | |
692 printf("GetSystemMetrics(SM_CYSCREEN): %d\n", GetSystemMetrics(SM_CYSCREEN)); | |
693 printf("scale coord: %f\n", data->scale); | |
694 | |
695 FrameBufferDumpInfo(&data->fb, "hardware"); | |
696 | |
697 printf("display format: %p\n", data->format); | |
698 printf("display bits per pixel: %d\n", SDL_BITSPERPIXEL(data->format)); | |
699 printf("display bytes per pixel: %d\n", SDL_BYTESPERPIXEL(data->format)); | |
700 printf("display memory: %p\n", data->pixels); | |
701 printf("system orientation: %d, %s\n", data->systemOrientation, GetOrientationName(data->systemOrientation)); | |
702 printf("hardware geometry: %d\n", data->hardwareGeometry); | |
703 } | |
704 | |
705 void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible) | |
706 { | |
707 SDL_WindowData* windowdata = (SDL_WindowData*) window->driverdata; | |
708 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | |
709 SDL_Renderer* renderer = (SDL_Renderer*) window->renderer; | |
710 | |
711 if(visible) | |
712 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
713 if(window->flags & SDL_WINDOW_FULLSCREEN) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
714 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
715 if(videodata->SHFullScreen) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
716 videodata->SHFullScreen(windowdata->hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
717 ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_HIDE); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
718 } |
4569 | 719 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
720 ShowWindow(windowdata->hwnd, SW_SHOW); |
4569 | 721 SetForegroundWindow(windowdata->hwnd); |
722 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
723 if(renderer && |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
724 (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW)) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
725 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
726 WINCE_RenderData* renderdata = (WINCE_RenderData*) renderer->driverdata; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
727 renderdata->flags &= ~FB_SUSPENDED; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
728 if(renderdata->gapi) renderdata->gapi->GXResume(); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
729 } |
4569 | 730 } |
731 else | |
732 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
733 if(renderer && |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
734 (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW)) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
735 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
736 WINCE_RenderData* renderdata = (WINCE_RenderData*) renderer->driverdata; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
737 if(renderdata->gapi) renderdata->gapi->GXSuspend(); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
738 renderdata->flags |= FB_SUSPENDED; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
739 } |
4569 | 740 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
741 ShowWindow(windowdata->hwnd, SW_HIDE); |
4569 | 742 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
743 if(window->flags & SDL_WINDOW_FULLSCREEN) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
744 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
745 if(videodata->SHFullScreen) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
746 videodata->SHFullScreen(windowdata->hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
747 ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_SHOW); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
748 } |
3168 | 749 } |
750 } | |
751 | |
4569 | 752 |
753 void WINCE_PointerCoordinateTransform(SDL_Window* window, POINT* pt) | |
754 { | |
755 WINCE_RenderData* data = (WINCE_RenderData*) window->renderer->driverdata; | |
756 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
757 pt->x = (LONG)(pt->x * data->scale); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
758 pt->y = (LONG)(pt->y * data->scale); |
4569 | 759 |
760 PointerRotate(pt, &data->fb, data->userOrientation); | |
761 } | |
762 | |
763 void WINCE_PortraitTransform(WINCE_RenderData* data, int width, int height) | |
764 { | |
765 if(data->systemOrientation != ORIENTATION_UP) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
766 FrameBufferRotate(&data->fb, data->systemOrientation); |
4569 | 767 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
768 if(data->fb.width != width || data->fb.height != height) { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
769 switch(data->systemOrientation) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
770 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
771 case ORIENTATION_UP: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
772 case ORIENTATION_LEFT: data->userOrientation = ORIENTATION_RIGHT; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
773 case ORIENTATION_RIGHT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
774 case ORIENTATION_DOWN: data->userOrientation = ORIENTATION_LEFT; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
775 default: break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
776 } |
4569 | 777 } |
778 | |
779 if(data->userOrientation != ORIENTATION_UP) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
780 FrameBufferRotate(&data->fb, data->userOrientation); |
4569 | 781 } |
782 | |
783 void WINCE_LandscapeTransform(WINCE_RenderData* data, int width, int height) | |
3168 | 784 { |
4569 | 785 switch(data->systemOrientation) |
786 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
787 case ORIENTATION_UP: FrameBufferRotate(&data->fb, ORIENTATION_LEFT); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
788 case ORIENTATION_LEFT:FrameBufferRotate(&data->fb, ORIENTATION_DOWN); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
789 case ORIENTATION_DOWN:FrameBufferRotate(&data->fb, ORIENTATION_RIGHT); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
790 default: break; |
4569 | 791 } |
792 | |
793 if(data->fb.width != width || data->fb.height != height) | |
794 switch(data->systemOrientation) | |
795 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
796 case ORIENTATION_UP: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
797 case ORIENTATION_LEFT: data->userOrientation = ORIENTATION_RIGHT; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
798 case ORIENTATION_RIGHT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
799 case ORIENTATION_DOWN: data->userOrientation = ORIENTATION_LEFT; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
800 default: break; |
4569 | 801 } |
802 | |
803 if(data->userOrientation != ORIENTATION_UP) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
804 FrameBufferRotate(&data->fb, data->userOrientation); |
4569 | 805 } |
806 | |
807 void WINCE_SquareTransform(WINCE_RenderData* data, int width, int height) | |
808 { | |
809 WINCE_PortraitTransform(data, width, height); | |
810 } | |
3168 | 811 |
4569 | 812 int WINCE_FixedGeometry(FrameBufferInfo* fb, int bpp, int debug) |
813 { | |
814 // check square | |
815 if(GetSystemMetrics(SM_CXSCREEN) == GetSystemMetrics(SM_CYSCREEN) && | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
816 fb->width != fb->height) |
4569 | 817 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
818 if(fb->width < fb->height) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
819 fb->height = fb->width; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
820 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
821 if(fb->height < fb->width) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
822 fb->width = fb->height; |
4569 | 823 } |
824 | |
825 // check width | |
826 if(__abs(fb->xpitch) == bpp && | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
827 fb->width != __abs(fb->ypitch) / bpp) |
4569 | 828 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
829 if(fb->height == __abs(fb->ypitch) / bpp) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
830 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
831 __swap(&fb->width, &fb->height); |
4569 | 832 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
833 if(debug) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
834 printf("WINCE_FixedGeometry: width: %d, height: %d\n", fb->width, fb->height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
835 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
836 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
837 return -1; |
4569 | 838 } |
839 else | |
840 // check height | |
841 if(__abs(fb->ypitch) == bpp && | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
842 fb->height != __abs(fb->xpitch) / bpp) |
4569 | 843 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
844 if(fb->width == __abs(fb->xpitch) / bpp) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
845 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
846 __swap(&fb->width, &fb->height); |
4569 | 847 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
848 if(debug) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
849 printf("WINCE_FixedGeometry: width: %d, height: %d\n", fb->width, fb->height); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
850 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
851 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
852 return -1; |
3168 | 853 } |
854 | |
4569 | 855 return 0; |
856 } | |
857 | |
858 void WINCE_UpdateYUVTextureData(SDL_Texture* texture) | |
859 { | |
860 WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata; | |
861 SDL_Rect rect; | |
862 | |
863 rect.x = 0; | |
864 rect.y = 0; | |
865 rect.w = texture->w; | |
866 rect.h = texture->h; | |
867 SDL_SW_CopyYUVToRGB(texturedata->yuv, &rect, texturedata->format, texture->w, texture->h, texturedata->pixels, texturedata->pitch); | |
868 } | |
869 | |
870 int GAPI_Init(WINCE_RenderData* data, HWND hwnd) | |
871 { | |
872 if(NULL == data->gapi) | |
873 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
874 struct GXDisplayProperties gxProperties; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
875 GXDeviceInfo gxInfo = { 0 }; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
876 HDC hdc; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
877 int enable, result; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
878 const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
879 if(preferably && 0 != SDL_strcasecmp(preferably, GAPI_RENDER_NAME)) return 0; |
4569 | 880 |
881 data->gapi = (GapiInfo *) SDL_calloc(1, sizeof(GapiInfo)); | |
882 if(NULL == data->gapi) | |
883 { | |
884 SDL_OutOfMemory(); | |
885 return 0; | |
886 } | |
887 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
888 data->gapi->hGapiLib = LoadLibrary(TEXT("\\Windows\\gx.dll")); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
889 if(0 == data->gapi->hGapiLib) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
890 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
891 data->gapi->hGapiLib = LoadLibrary(TEXT("gx.dll")); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
892 if(0 == data->gapi->hGapiLib) return 0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
893 } |
4569 | 894 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
895 // load gapi library |
4569 | 896 #define LINK(type,name,import) name=(PFN##type)GetProcAddress(data->gapi->hGapiLib,TEXT(import)) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
897 LINK(GXOpenDisplay, data->gapi->GXOpenDisplay, "?GXOpenDisplay@@YAHPAUHWND__@@K@Z"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
898 LINK(GXCloseDisplay, data->gapi->GXCloseDisplay, "?GXCloseDisplay@@YAHXZ"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
899 LINK(GXBeginDraw, data->gapi->GXBeginDraw, "?GXBeginDraw@@YAPAXXZ"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
900 LINK(GXEndDraw, data->gapi->GXEndDraw, "?GXEndDraw@@YAHXZ"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
901 LINK(GXGetDisplayProperties,data->gapi->GXGetDisplayProperties,"?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
902 LINK(GXSuspend, data->gapi->GXSuspend, "?GXSuspend@@YAHXZ"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
903 LINK(GXResume, data->gapi->GXResume, "?GXResume@@YAHXZ"); |
4569 | 904 #undef LINK |
905 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
906 enable = data->gapi->GXGetDisplayProperties && data->gapi->GXCloseDisplay && data->gapi->GXOpenDisplay && |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
907 data->gapi->GXBeginDraw && data->gapi->GXEndDraw && data->gapi->GXSuspend && data->gapi->GXResume; |
4569 | 908 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
909 if(!enable) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
910 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
911 SDL_SetError("GAPI_Init: error gx.dll: internal error"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
912 GAPI_Quit(data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
913 return 0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
914 } |
4569 | 915 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
916 if(0 == data->gapi->GXOpenDisplay(hwnd, GX_FULLSCREEN)) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
917 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
918 SDL_SetError("GAPI_Init: couldn't initialize GAPI"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
919 GAPI_Quit(data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
920 return 0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
921 } |
4569 | 922 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
923 gxProperties = data->gapi->GXGetDisplayProperties(); |
3168 | 924 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
925 // fill FrameBufferInfo |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
926 data->fb.xpitch = gxProperties.cbxPitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
927 data->fb.ypitch = gxProperties.cbyPitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
928 data->fb.width = gxProperties.cxWidth; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
929 data->fb.height = gxProperties.cyHeight; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
930 data->fb.offset = 0; |
4569 | 931 |
932 if((gxProperties.ffFormat & kfDirect565) || 16 == gxProperties.cBPP) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
933 data->format = SDL_PIXELFORMAT_RGB565; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
934 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
935 if((gxProperties.ffFormat & kfDirect555) || 15 == gxProperties.cBPP) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
936 data->format = SDL_PIXELFORMAT_RGB555; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
937 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
938 data->format = 0; |
4569 | 939 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
940 // get pixels |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
941 hdc = GetDC(NULL); |
4569 | 942 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
943 gxInfo.Version = 100; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
944 result = ExtEscape(hdc, GETGXINFO, 0, NULL, sizeof(gxInfo), (char *) &gxInfo); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
945 ReleaseDC(NULL, hdc); |
4569 | 946 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
947 if(result > 0) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
948 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
949 // more debug |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
950 if(data->debug) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
951 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
952 int i; |
4569 | 953 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
954 printf("GXDeviceInfo.pvFrameBuffer: %p\n", gxInfo.pvFrameBuffer); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
955 printf("GXDeviceInfo.cxWidth: %d\n", gxInfo.cxWidth); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
956 printf("GXDeviceInfo.cyHeight: %d\n", gxInfo.cyHeight); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
957 printf("GXDeviceInfo.cbStride: %d\n", gxInfo.cbStride); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
958 printf("GXDeviceInfo.cBPP: %d\n", gxInfo.cBPP); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
959 printf("GXDeviceInfo.ffFormat: 0x%x\n", gxInfo.ffFormat); |
4569 | 960 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
961 printf("GXDeviceInfo.unk:\n"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
962 for(i = 0; i < sizeof(gxInfo.unknown); ++i) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
963 printf("0x%02hhX,", gxInfo.unknown[i]); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
964 printf("\n"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
965 } |
4569 | 966 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
967 if(gxInfo.ffFormat && gxInfo.ffFormat != gxProperties.ffFormat) { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
968 if((gxInfo.ffFormat & kfDirect565) || 16 == gxInfo.cBPP) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
969 data->format = SDL_PIXELFORMAT_RGB565; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
970 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
971 if((gxInfo.ffFormat & kfDirect555) || 15 == gxInfo.cBPP) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
972 data->format = SDL_PIXELFORMAT_RGB555; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
973 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
974 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
975 data->pixels = gxInfo.pvFrameBuffer; |
3168 | 976 } |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
977 else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
978 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
979 data->flags |= FB_SKIP_OFFSET; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
980 data->pixels = data->gapi->GXBeginDraw(); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
981 data->gapi->GXEndDraw(); |
4569 | 982 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
983 if(data->debug) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
984 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
985 printf("GAPI_Init\n"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
986 printf("use GXBeginDraw: %p\n", data->pixels); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
987 printf("use skip offset\n"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
988 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
989 } |
4569 | 990 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
991 if(0 == data->format || |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
992 0 > WINCE_FixedGeometry(&data->fb, SDL_BYTESPERPIXEL(data->format), data->debug)) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
993 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
994 SDL_SetError("GAPI_Init: unknown hardware"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
995 GAPI_Quit(data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
996 return 0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
997 } |
3168 | 998 } |
999 | |
4569 | 1000 return data->gapi && data->pixels ? 1 : 0; |
1001 } | |
1002 | |
1003 void GAPI_Quit(WINCE_RenderData* data) | |
1004 { | |
1005 if(data->gapi) | |
1006 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1007 if(data->gapi->GXCloseDisplay) data->gapi->GXCloseDisplay(); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1008 if(data->gapi->hGapiLib) FreeLibrary(data->gapi->hGapiLib); |
4569 | 1009 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1010 SDL_free(data->gapi); |
4569 | 1011 data->gapi = NULL; |
1012 } | |
1013 } | |
1014 | |
1015 int RAW_Init(WINCE_RenderData* data) | |
1016 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1017 RawFrameBufferInfo rfbi = { 0 }; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1018 HDC hdc; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1019 int result; |
4569 | 1020 const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER"); |
1021 if(preferably && 0 != SDL_strcasecmp(preferably, RAW_RENDER_NAME)) return 0; | |
1022 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1023 hdc = GetDC(NULL); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1024 result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi); |
4569 | 1025 ReleaseDC(NULL, hdc); |
1026 | |
1027 //disable | |
1028 if(result == 0 || rfbi.pFramePointer == 0 || | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1029 rfbi.cxPixels == 0 || rfbi.cyPixels == 0 || |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1030 rfbi.cxStride == 0 || rfbi.cyStride == 0) return 0; |
4569 | 1031 |
1032 data->flags = FB_RAW_MODE; | |
1033 | |
1034 // fill FrameBufferInfo | |
1035 SDL_memset(&data->fb, 0, sizeof(FrameBufferInfo)); | |
1036 | |
1037 data->fb.xpitch = rfbi.cxStride; | |
1038 data->fb.ypitch = rfbi.cyStride; | |
1039 data->fb.width = rfbi.cxPixels; | |
1040 data->fb.height = rfbi.cyPixels; | |
1041 data->fb.offset = 0; | |
3168 | 1042 |
4569 | 1043 if((FORMAT_565 & rfbi.wFormat) || 16 == rfbi.wBPP) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1044 data->format = SDL_PIXELFORMAT_RGB565; |
4569 | 1045 else |
1046 if((FORMAT_555 & rfbi.wFormat) || 15 == rfbi.wBPP) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1047 data->format = SDL_PIXELFORMAT_RGB555; |
4569 | 1048 else |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1049 data->format = 0; |
4569 | 1050 |
1051 if(0 == data->format || | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1052 0 > WINCE_FixedGeometry(&data->fb, SDL_BYTESPERPIXEL(data->format), data->debug)) |
4569 | 1053 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1054 SDL_SetError("RAW_Init: unknown hardware"); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1055 RAW_Quit(data); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1056 return 0; |
4569 | 1057 } |
1058 | |
1059 data->pixels = rfbi.pFramePointer; | |
1060 | |
1061 return data->pixels ? 1 : 0; | |
1062 } | |
1063 | |
1064 void RAW_Quit(WINCE_RenderData* data) | |
1065 { | |
1066 } | |
3168 | 1067 |
4569 | 1068 void FrameBufferInitialize(FrameBufferInfo* fb) |
1069 { | |
1070 int orientation = GetFrameBufferOrientation(fb); | |
1071 | |
1072 // set correct start offset | |
1073 switch(orientation) | |
1074 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1075 case ORIENTATION_UP: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1076 fb->offset = 0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1077 break; |
3168 | 1078 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1079 case ORIENTATION_LEFT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1080 fb->offset = __abs(fb->ypitch * (fb->height - 1)); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1081 break; |
3168 | 1082 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1083 case ORIENTATION_RIGHT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1084 fb->offset = __abs(fb->xpitch * (fb->width - 1)); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1085 break; |
4569 | 1086 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1087 case ORIENTATION_DOWN: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1088 fb->offset = __abs(fb->xpitch * (fb->width - 1) + |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1089 fb->ypitch * (fb->height - 1)); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1090 break; |
4569 | 1091 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1092 default: break; |
3168 | 1093 } |
1094 | |
4569 | 1095 //if(orientation != ORIENTATION_UP) |
1096 switch(orientation) | |
1097 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1098 case ORIENTATION_LEFT: FrameBufferRotate(fb, ORIENTATION_RIGHT); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1099 case ORIENTATION_RIGHT:FrameBufferRotate(fb, ORIENTATION_LEFT); break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1100 case ORIENTATION_DOWN: FrameBufferRotate(fb, ORIENTATION_DOWN); break; |
4569 | 1101 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1102 default: break; |
3168 | 1103 } |
4569 | 1104 } |
1105 | |
1106 int GetFrameBufferOrientation(const FrameBufferInfo* src) | |
1107 { | |
1108 if(src->xpitch > 0 && src->ypitch > 0) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1109 return ORIENTATION_UP; |
4569 | 1110 else |
1111 if(src->xpitch > 0 && src->ypitch < 0) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1112 return ORIENTATION_LEFT; |
4569 | 1113 else |
1114 if(src->xpitch < 0 && src->ypitch > 0) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1115 return ORIENTATION_RIGHT; |
4569 | 1116 else |
1117 if(src->xpitch < 0 && src->ypitch < 0) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1118 return ORIENTATION_DOWN; |
4569 | 1119 |
1120 return ORIENTATION_UNKNOWN; | |
3168 | 1121 } |
1122 | |
4569 | 1123 void FrameBufferRotate(FrameBufferInfo* dst, int orientation) |
3168 | 1124 { |
4569 | 1125 FrameBufferInfo src; |
1126 // copy dst -> src | |
1127 SDL_memcpy(&src, dst, sizeof(FrameBufferInfo)); | |
1128 | |
1129 switch(orientation) | |
1130 { | |
1131 case ORIENTATION_LEFT: | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1132 dst->width = src.height; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1133 dst->height = src.width; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1134 dst->xpitch = src.ypitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1135 dst->ypitch = -src.xpitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1136 dst->offset = src.offset + src.xpitch * (src.width - 1); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1137 break; |
4569 | 1138 |
1139 case ORIENTATION_RIGHT: | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1140 dst->width = src.height; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1141 dst->height = src.width; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1142 dst->xpitch = -src.ypitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1143 dst->ypitch = src.xpitch; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1144 dst->offset = src.offset + src.ypitch * (src.height - 1); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1145 break; |
4569 | 1146 |
1147 case ORIENTATION_DOWN: | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1148 FrameBufferRotate(dst, ORIENTATION_LEFT); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1149 FrameBufferRotate(dst, ORIENTATION_LEFT); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1150 break; |
4569 | 1151 |
1152 default: | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1153 break; |
4569 | 1154 } |
1155 } | |
1156 | |
1157 void PointerRotate(POINT* pt, const FrameBufferInfo* fb, int orientation) | |
1158 { | |
1159 switch(orientation) | |
1160 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1161 case ORIENTATION_UP: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1162 break; |
4569 | 1163 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1164 case ORIENTATION_LEFT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1165 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1166 int temp = pt->y; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1167 pt->y = fb->height - pt->x; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1168 pt->x = temp; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1169 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1170 break; |
4569 | 1171 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1172 case ORIENTATION_RIGHT: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1173 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1174 int temp = pt->x; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1175 pt->x = fb->width - pt->y; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1176 pt->y = temp; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1177 } |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1178 break; |
4569 | 1179 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1180 case ORIENTATION_DOWN: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1181 pt->x = fb->width - pt->x; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1182 pt->y = fb->height - pt->y; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1183 break; |
4569 | 1184 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1185 default: break; |
4569 | 1186 } |
3168 | 1187 } |
1188 | |
4569 | 1189 const char* GetOrientationName(int orientation) |
1190 { | |
1191 switch(orientation) | |
1192 { | |
1193 case ORIENTATION_UP: return "UP"; | |
1194 case ORIENTATION_DOWN: return "DOWN"; | |
1195 case ORIENTATION_LEFT: return "LEFT"; | |
1196 case ORIENTATION_RIGHT: return "RIGHT"; | |
1197 default: break; | |
1198 } | |
1199 | |
1200 return "UNKNOWN"; | |
1201 } | |
1202 | |
1203 int WINCE_GetDMOrientation(void) | |
3168 | 1204 { |
4569 | 1205 DEVMODE sDevMode = {0}; |
1206 sDevMode.dmSize = sizeof(DEVMODE); | |
1207 sDevMode.dmFields = DM_DISPLAYORIENTATION; | |
1208 | |
1209 // DMDO_0, DMDO_90, DMDO_180, DMDO_270 | |
1210 if(DISP_CHANGE_BADMODE != ChangeDisplaySettingsEx(NULL, &sDevMode, 0, CDS_TEST, NULL)) | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1211 switch(sDevMode.dmDisplayOrientation) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1212 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1213 case DMDO_0: return DMDO_0; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1214 case DMDO_90: return DMDO_90; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1215 case DMDO_180: return DMDO_180; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1216 case DMDO_270: return DMDO_270; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1217 default: break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1218 } |
3168 | 1219 |
4569 | 1220 SDL_SetError("WINCE_GetDMOrientation: ChangeDisplaySettingsEx return BADMODE"); |
1221 return -1; | |
1222 } | |
1223 | |
1224 int WINCE_SetDMOrientation(int orientation) | |
1225 { | |
1226 DEVMODE sDevMode = {0}; | |
1227 sDevMode.dmSize = sizeof(DEVMODE); | |
1228 sDevMode.dmFields = DM_DISPLAYORIENTATION; | |
1229 | |
1230 switch(orientation) | |
1231 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1232 case DMDO_0: sDevMode.dmDisplayOrientation = DMDO_0; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1233 case DMDO_90: sDevMode.dmDisplayOrientation = DMDO_90; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1234 case DMDO_180: sDevMode.dmDisplayOrientation = DMDO_180; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1235 case DMDO_270: sDevMode.dmDisplayOrientation = DMDO_270; break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1236 default: return 0; |
3168 | 1237 } |
1238 | |
4569 | 1239 if(DISP_CHANGE_BADMODE != ChangeDisplaySettingsEx(NULL, &sDevMode, 0, CDS_RESET, NULL)) |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1240 return 1; |
4569 | 1241 |
1242 SDL_SetError("WINCE_SetDMOrientation: ChangeDisplaySettingsEx return BADMODE"); | |
1243 return -1; | |
1244 } | |
1245 | |
1246 void FrameBufferDumpInfo(const FrameBufferInfo* fb, const char* name) | |
1247 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1248 int orientation; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1249 |
4569 | 1250 printf("%s fb.width: %d\n", name, fb->width); |
1251 printf("%s fb.height: %d\n", name, fb->height); | |
1252 printf("%s fb.xpitch: %d\n", name, fb->xpitch); | |
1253 printf("%s fb.ypitch: %d\n", name, fb->ypitch); | |
1254 printf("%s fb.offset: %d\n", name, fb->offset); | |
1255 | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1256 orientation = GetFrameBufferOrientation(fb); |
4569 | 1257 printf("%s fb.orientation: %d, %s\n", name, orientation, GetOrientationName(orientation)); |
3168 | 1258 } |
1259 | |
4569 | 1260 void UpdateLine16to16(const FrameBufferInfo* fb, const Uint16* src, Uint16* dst, Uint16 width) |
1261 { | |
1262 if(2 == fb->xpitch) | |
1263 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1264 switch(width) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1265 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1266 case 1: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1267 *dst = *src; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1268 break; |
4569 | 1269 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1270 case 2: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1271 *((Uint32*) dst) = *((Uint32*) src); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1272 break; |
3168 | 1273 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1274 default: |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1275 SDL_memcpy(dst, src, width * 2); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1276 break; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1277 } |
4569 | 1278 } |
1279 else | |
1280 if(-2 == fb->xpitch) | |
1281 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1282 while(width--) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1283 *dst-- = *src++; |
4569 | 1284 } |
1285 else | |
1286 { | |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1287 while(width--) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1288 { |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1289 *dst = *src++; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1290 dst += fb->xpitch / 2; |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
1291 } |
4569 | 1292 } |
1293 } | |
1294 | |
1295 #endif // SDL_VIDEO_RENDER_GAPI |