Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_render.c @ 2901:133601e3b255
Added RenderPiont() API
Merged the drawing tests into a single test program
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 21 Dec 2008 17:39:41 +0000 |
parents | 9dde605c7540 |
children | 2133d2d300fd |
rev | line source |
---|---|
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 SDL1.3 implementation by couriersud@arcor.de |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_config.h" |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_DirectFB_video.h" |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_DirectFB_render.h" |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "../SDL_rect_c.h" |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include "../SDL_yuv_sw_c.h" |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
32 /* the following is not yet tested ... */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
33 #define USE_DISPLAY_PALETTE (0) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
34 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 /* GDI renderer implementation */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 static SDL_Renderer *DirectFB_CreateRenderer(SDL_Window * window, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 Uint32 flags); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 static int DirectFB_DisplayModeChanged(SDL_Renderer * renderer); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
40 static int DirectFB_ActivateRenderer(SDL_Renderer * renderer); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 static int DirectFB_CreateTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 static int DirectFB_QueryTexturePixels(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 SDL_Texture * texture, void **pixels, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 int *pitch); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 static int DirectFB_SetTexturePalette(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 const SDL_Color * colors, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 int firstcolor, int ncolors); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 SDL_Color * colors, int firstcolor, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 int ncolors); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 static int DirectFB_UpdateTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 const SDL_Rect * rect, const void *pixels, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 int pitch); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 static int DirectFB_LockTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 SDL_Texture * texture, const SDL_Rect * rect, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 int markDirty, void **pixels, int *pitch); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 SDL_Texture * texture, int numrects, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 const SDL_Rect * rects); |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
74 static int DirectFB_SetDrawColor(SDL_Renderer * renderer); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
75 static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer); |
2901 | 76 static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y); |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
77 static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
78 int x2, int y2); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
79 static int DirectFB_RenderFill(SDL_Renderer * renderer, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
80 const SDL_Rect * rect); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 static int DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 const SDL_Rect * srcrect, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 const SDL_Rect * dstrect); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 static void DirectFB_RenderPresent(SDL_Renderer * renderer); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 static void DirectFB_DestroyTexture(SDL_Renderer * renderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 SDL_Texture * texture); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 static void DirectFB_DestroyRenderer(SDL_Renderer * renderer); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 SDL_RenderDriver DirectFB_RenderDriver = { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 DirectFB_CreateRenderer, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 "directfb", |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | |
2791
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
95 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | |
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
96 SDL_RENDERER_ACCELERATED), |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR | |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 SDL_TEXTUREMODULATE_ALPHA), |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
99 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
100 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
101 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
102 SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST), |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 14, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
105 SDL_PIXELFORMAT_INDEX4LSB, |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 SDL_PIXELFORMAT_INDEX8, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 SDL_PIXELFORMAT_RGB332, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 SDL_PIXELFORMAT_RGB555, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 SDL_PIXELFORMAT_RGB565, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 SDL_PIXELFORMAT_RGB888, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 SDL_PIXELFORMAT_ARGB8888, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 SDL_PIXELFORMAT_ARGB4444, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 SDL_PIXELFORMAT_ARGB1555, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 SDL_PIXELFORMAT_RGB24, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 SDL_PIXELFORMAT_YV12, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 SDL_PIXELFORMAT_IYUV, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 SDL_PIXELFORMAT_YUY2, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 SDL_PIXELFORMAT_UYVY}, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 0, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 0} |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 }; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 typedef struct |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 IDirectFBSurface *surface; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 DFBSurfaceFlipFlags flipflags; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 int isyuvdirect; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
128 int size_changed; |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
129 int lastBlendMode; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
130 DFBSurfaceBlittingFlags blitFlags; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
131 DFBSurfaceDrawingFlags drawFlags; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 } DirectFB_RenderData; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 typedef struct |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 IDirectFBSurface *surface; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 Uint32 format; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 void *pixels; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 int pitch; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 IDirectFBPalette *palette; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
141 SDL_VideoDisplay *display; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
142 SDL_DirtyRectList dirty; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
143 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
144 DFBSurfaceRenderOptions render_options; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
145 #endif |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 } DirectFB_TextureData; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
148 static __inline__ void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
149 SDLtoDFBRect(const SDL_Rect * sr, DFBRectangle * dr) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
150 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
151 dr->x = sr->x; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
152 dr->y = sr->y; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
153 dr->h = sr->h; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
154 dr->w = sr->w; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
155 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
156 |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
157 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
158 static int |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
159 TextureHasAlpha(DirectFB_TextureData * data) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
160 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
161 /* Drawing primitive ? */ |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
162 if (!data) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
163 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
164 switch (data->format) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
165 case SDL_PIXELFORMAT_INDEX4LSB: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
166 case SDL_PIXELFORMAT_ARGB4444: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
167 case SDL_PIXELFORMAT_ARGB1555: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
168 case SDL_PIXELFORMAT_ARGB8888: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
169 case SDL_PIXELFORMAT_RGBA8888: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
170 case SDL_PIXELFORMAT_ABGR8888: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
171 case SDL_PIXELFORMAT_BGRA8888: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
172 case SDL_PIXELFORMAT_ARGB2101010: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
173 return 1; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
174 default: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
175 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
176 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
177 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
178 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
179 static void |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
180 SetBlendMode(DirectFB_RenderData * data, int blendMode, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
181 DirectFB_TextureData * source) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
182 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
183 //FIXME: check for format change |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
184 if (1 || data->lastBlendMode != blendMode) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
185 switch (blendMode) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
186 case SDL_BLENDMODE_NONE: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
187 /**< No blending */ |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
188 data->blitFlags = DSBLIT_NOFX; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
189 data->drawFlags = DSDRAW_NOFX; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
190 data->surface->SetSrcBlendFunction(data->surface, DSBF_ONE); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
191 data->surface->SetDstBlendFunction(data->surface, DSBF_ZERO); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
192 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
193 case SDL_BLENDMODE_MASK: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
194 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
195 data->drawFlags = DSDRAW_BLEND; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
196 data->surface->SetSrcBlendFunction(data->surface, DSBF_SRCALPHA); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
197 data->surface->SetDstBlendFunction(data->surface, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
198 DSBF_INVSRCALPHA); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
199 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
200 case SDL_BLENDMODE_BLEND: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
201 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
202 data->drawFlags = DSDRAW_BLEND; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
203 data->surface->SetSrcBlendFunction(data->surface, DSBF_SRCALPHA); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
204 data->surface->SetDstBlendFunction(data->surface, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
205 DSBF_INVSRCALPHA); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
206 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
207 case SDL_BLENDMODE_ADD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
208 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
209 data->drawFlags = DSDRAW_BLEND; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
210 //FIXME: SRCALPHA kills performance on radeon ... |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
211 //Eventually use a premultiplied texture |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
212 if (0 && TextureHasAlpha(source)) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
213 data->surface->SetSrcBlendFunction(data->surface, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
214 DSBF_SRCALPHA); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
215 else |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
216 data->surface->SetSrcBlendFunction(data->surface, DSBF_ONE); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
217 data->surface->SetDstBlendFunction(data->surface, DSBF_ONE); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
218 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
219 case SDL_BLENDMODE_MOD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
220 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
221 data->drawFlags = DSDRAW_BLEND; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
222 data->surface->SetSrcBlendFunction(data->surface, DSBF_DESTCOLOR); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
223 data->surface->SetDstBlendFunction(data->surface, DSBF_ZERO); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
224 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
225 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
226 data->lastBlendMode = blendMode; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
227 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
228 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
229 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 DirectFB_AddRenderDriver(_THIS) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 int i; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 for (i = 0; i < _this->num_displays; i++) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 SDL_AddRenderDriver(i, &DirectFB_RenderDriver); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
238 static int |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
239 DisplayPaletteChanged(void *userdata, SDL_Palette * palette) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
240 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
241 #if USE_DISPLAY_PALETTE |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
242 DirectFB_RenderData *data = (DirectFB_RenderData *) userdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
243 IDirectFBPalette *surfpal; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
244 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
245 int ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
246 int i; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
247 int ncolors; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
248 DFBColor entries[256]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
249 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
250 SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &surfpal)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
251 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
252 /* FIXME: number of colors */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
253 ncolors = (palette->ncolors < 256 ? palette->ncolors : 256); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
254 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
255 for (i = 0; i < ncolors; ++i) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
256 entries[i].r = palette->colors[i].r; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
257 entries[i].g = palette->colors[i].g; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
258 entries[i].b = palette->colors[i].b; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
259 entries[i].a = palette->colors[i].unused; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
260 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
261 SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
262 return 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
263 error: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
264 #endif |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
265 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
266 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
267 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
268 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 SDL_Renderer * |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 SDL_DFB_WINDOWDATA(window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 SDL_Renderer *renderer = NULL; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 DirectFB_RenderData *data = NULL; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 DFBSurfaceCapabilities scaps; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 char *p; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 SDL_DFB_CALLOC(data, 1, sizeof(*data)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 renderer->DisplayModeChanged = DirectFB_DisplayModeChanged; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
284 renderer->ActivateRenderer = DirectFB_ActivateRenderer; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 renderer->CreateTexture = DirectFB_CreateTexture; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 renderer->SetTexturePalette = DirectFB_SetTexturePalette; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 renderer->GetTexturePalette = DirectFB_GetTexturePalette; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 renderer->SetTextureColorMod = DirectFB_SetTextureColorMod; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 renderer->SetTextureBlendMode = DirectFB_SetTextureBlendMode; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 renderer->UpdateTexture = DirectFB_UpdateTexture; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 renderer->LockTexture = DirectFB_LockTexture; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 renderer->UnlockTexture = DirectFB_UnlockTexture; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 renderer->DirtyTexture = DirectFB_DirtyTexture; |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
297 renderer->SetDrawColor = DirectFB_SetDrawColor; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
298 renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode; |
2901 | 299 renderer->RenderPoint = DirectFB_RenderPoint; |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
300 renderer->RenderLine = DirectFB_RenderLine; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 renderer->RenderFill = DirectFB_RenderFill; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 renderer->RenderCopy = DirectFB_RenderCopy; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 renderer->RenderPresent = DirectFB_RenderPresent; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 renderer->DestroyTexture = DirectFB_DestroyTexture; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 renderer->DestroyRenderer = DirectFB_DestroyRenderer; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 renderer->info = DirectFB_RenderDriver.info; |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
307 renderer->window = window->id; /* SDL window id */ |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 renderer->driverdata = data; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 renderer->info.flags = |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 data->surface = windata->surface; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
314 data->surface->AddRef(data->surface); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
315 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
316 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 if (flags & SDL_RENDERER_PRESENTVSYNC) { |
2791
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
319 data->flipflags |= DSFLIP_WAITFORSYNC; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
2791
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
321 } else |
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
322 data->flipflags |= DSFLIP_ONSYNC; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
324 SDL_DFB_CHECKERR(data->surface->GetCapabilities(data->surface, &scaps)); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 if (scaps & DSCAPS_DOUBLE) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 else if (scaps & DSCAPS_TRIPLE) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 else |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
332 data->isyuvdirect = 0; /* default is off! */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
333 p = getenv(DFBENV_USE_YUV_DIRECT); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 if (p) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 data->isyuvdirect = atoi(p); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
337 /* Set up a palette watch on the display palette */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
338 if (display->palette) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
339 SDL_AddPaletteWatch(display->palette, DisplayPaletteChanged, data); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
340 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
341 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 return renderer; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 SDL_DFB_FREE(renderer); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 SDL_DFB_FREE(data); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 return NULL; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 static DFBSurfacePixelFormat |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 SDLToDFBPixelFormat(Uint32 format) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 switch (format) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 case SDL_PIXELFORMAT_INDEX4LSB: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 return DSPF_ALUT44; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 case SDL_PIXELFORMAT_INDEX8: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 return DSPF_LUT8; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 case SDL_PIXELFORMAT_RGB332: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 return DSPF_RGB332; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 case SDL_PIXELFORMAT_RGB555: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 return DSPF_ARGB1555; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 case SDL_PIXELFORMAT_ARGB4444: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 return DSPF_ARGB4444; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 case SDL_PIXELFORMAT_ARGB1555: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 return DSPF_ARGB1555; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 case SDL_PIXELFORMAT_RGB565: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 return DSPF_RGB16; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 case SDL_PIXELFORMAT_RGB24: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 return DSPF_RGB24; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 case SDL_PIXELFORMAT_RGB888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 return DSPF_RGB32; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 case SDL_PIXELFORMAT_ARGB8888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 return DSPF_ARGB; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 case SDL_PIXELFORMAT_YV12: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 return DSPF_YV12; /* Planar mode: Y + V + U (3 planes) */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 case SDL_PIXELFORMAT_IYUV: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 return DSPF_I420; /* Planar mode: Y + U + V (3 planes) */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 case SDL_PIXELFORMAT_YUY2: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 return DSPF_YUY2; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 case SDL_PIXELFORMAT_UYVY: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 return DSPF_UYVY; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 case SDL_PIXELFORMAT_YVYU: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 return DSPF_UNKNOWN; /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 case SDL_PIXELFORMAT_INDEX1LSB: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 case SDL_PIXELFORMAT_INDEX1MSB: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 case SDL_PIXELFORMAT_INDEX4MSB: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 case SDL_PIXELFORMAT_RGB444: |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
391 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
392 return DSPF_RGB444; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
393 #else |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 return DSPF_UNKNOWN; |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
395 #endif |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 case SDL_PIXELFORMAT_BGR24: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 case SDL_PIXELFORMAT_BGR888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 case SDL_PIXELFORMAT_RGBA8888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 case SDL_PIXELFORMAT_ABGR8888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 case SDL_PIXELFORMAT_BGRA8888: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 case SDL_PIXELFORMAT_ARGB2101010: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 default: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 return DSPF_UNKNOWN; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 static int |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
414 DirectFB_ActivateRenderer(SDL_Renderer * renderer) |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 SDL_DFB_RENDERERDATA(renderer); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 SDL_DFB_WINDOWDATA(window); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
419 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
420 if (renddata->size_changed) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
421 int cw, ch; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
422 int ret; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
424 SDL_DFB_CHECKERR(windata->surface-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
425 GetSize(windata->surface, &cw, &ch)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
426 if (cw != window->w || ch != window->h) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
427 SDL_DFB_CHECKERR(windata->window-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
428 ResizeSurface(windata->window, window->w, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
429 window->h)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
430 } |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 static int |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
437 DirectFB_DisplayModeChanged(SDL_Renderer * renderer) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
438 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
439 SDL_DFB_RENDERERDATA(renderer); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
440 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
441 renddata->size_changed = SDL_TRUE; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
442 return 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
443 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
444 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
445 static int |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
446 DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture) |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
447 { |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
448 SDL_DFB_RENDERERDATA(renderer); |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
449 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
450 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
451 SDL_DFB_DEVICEDATA(display->device); |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
452 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
453 DirectFB_TextureData *data = texture->driverdata; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
454 DFBDisplayLayerConfig layconf; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
455 int ret; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
456 |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
457 if (renddata->isyuvdirect && (dispdata->vidID >= 0) |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
458 && (!dispdata->vidIDinuse) |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
459 && SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
460 layconf.flags = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
461 DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
462 DLCONF_SURFACE_CAPS; |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
463 layconf.width = texture->w; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
464 layconf.height = texture->h; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
465 layconf.pixelformat = SDLToDFBPixelFormat(data->format); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
466 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE; |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
467 |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
468 SDL_DFB_CHECKERR(devdata->dfb-> |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
469 GetDisplayLayer(devdata->dfb, dispdata->vidID, |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
470 &dispdata->vidlayer)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
471 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
472 SetCooperativeLevel(dispdata->vidlayer, |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
473 DLSCL_EXCLUSIVE)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
474 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
475 if (devdata->use_yuv_underlays) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
476 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
477 if (ret != DFB_OK) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
478 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
479 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
480 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
481 SetConfiguration(dispdata->vidlayer, &layconf)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
482 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
483 GetSurface(dispdata->vidlayer, &data->surface)); |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
484 dispdata->vidIDinuse = 1; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
485 data->display = display; |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
486 return 0; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
487 } |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
488 return 1; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
489 error: |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
490 if (dispdata->vidlayer) { |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
491 SDL_DFB_RELEASE(data->surface); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
492 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
493 SetCooperativeLevel(dispdata->vidlayer, |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
494 DLSCL_ADMINISTRATIVE)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
495 SDL_DFB_RELEASE(dispdata->vidlayer); |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
496 } |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
497 return 1; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
498 } |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
499 |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
500 static int |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 SDL_DFB_DEVICEDATA(display->device); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 DirectFB_TextureData *data; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
507 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 DFBSurfaceDescription dsc; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 SDL_DFB_CALLOC(data, 1, sizeof(*data)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 texture->driverdata = data; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 data->format = texture->format; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 data->pitch = (texture->w * SDL_BYTESPERPIXEL(data->format)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
516 if (DirectFB_AcquireVidLayer(renderer, texture) != 0) { |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 /* fill surface description */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
518 dsc.flags = |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 dsc.width = texture->w; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 dsc.height = texture->h; |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
522 /* <1.2 Never use DSCAPS_VIDEOONLY here. It kills performance |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 * No DSCAPS_SYSTEMONLY either - let dfb decide |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
524 * 1.2: DSCAPS_SYSTEMONLY boosts performance by factor ~8 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
525 * Depends on other settings as well. Let dfb decide. |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 */ |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
527 dsc.caps = DSCAPS_PREMULTIPLIED; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
528 #if 0 |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
529 if (texture->access == SDL_TEXTUREACCESS_STREAMING) |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
530 dsc.caps |= DSCAPS_SYSTEMONLY; |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
531 else |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
532 dsc.caps |= DSCAPS_VIDEOONLY; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
533 #endif |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 /* find the right pixelformat */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 dsc.pixelformat = SDLToDFBPixelFormat(data->format); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 if (dsc.pixelformat == DSPF_UNKNOWN) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 SDL_SetError("Unknown pixel format %d\n", data->format); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 goto error; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 data->pixels = NULL; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 /* Create the surface */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 SDL_DFB_CHECKERR(devdata->dfb-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 CreateSurface(devdata->dfb, &dsc, &data->surface)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 SDL_DFB_CHECKERR(data->surface-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 GetPalette(data->surface, &data->palette)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
555 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
556 data->render_options = DSRO_NONE; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
557 #endif |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
558 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
559 if (texture->access == SDL_TEXTUREACCESS_STREAMING) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
560 data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
561 SDL_DFB_CALLOC(data->pixels, 1, texture->h * data->pitch); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
562 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
563 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 SDL_DFB_RELEASE(data->palette); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 SDL_DFB_RELEASE(data->surface); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
569 SDL_DFB_FREE(texture->driverdata); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
570 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
571 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 DirectFB_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 void **pixels, int *pitch) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
576 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
577 DirectFB_TextureData *texturedata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
578 (DirectFB_TextureData *) texture->driverdata; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
580 if (texturedata->display) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
581 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
582 } else { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
583 *pixels = texturedata->pixels; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
584 *pitch = texturedata->pitch; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
585 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
586 return 0; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
589 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 DirectFB_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 const SDL_Color * colors, int firstcolor, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 int ncolors) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 DFBColor entries[256]; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 int i; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
601 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 for (i = 0; i < ncolors; ++i) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 entries[i].r = colors[i].r; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
604 entries[i].g = colors[i].g; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
605 entries[i].b = colors[i].b; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 entries[i].a = 0xFF; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 SDL_DFB_CHECKERR(data->palette-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 SetEntries(data->palette, entries, ncolors, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
610 firstcolor)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 } else { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
613 SDL_SetError("YUV textures don't have a palette"); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
614 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
615 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
616 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
617 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
618 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
619 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
620 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
621 DirectFB_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
622 SDL_Color * colors, int firstcolor, int ncolors) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
623 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
624 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
625 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
626 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
627 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
628 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 DFBColor entries[256]; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
630 int i; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 SDL_DFB_CHECKERR(data->palette-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 GetEntries(data->palette, entries, ncolors, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 firstcolor)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
636 for (i = 0; i < ncolors; ++i) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
637 colors[i].r = entries[i].r; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 colors[i].g = entries[i].g; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
639 colors[i].b = entries[i].b; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
640 colors->unused = SDL_ALPHA_OPAQUE; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 } else { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
644 SDL_SetError("YUV textures don't have a palette"); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
646 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
651 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
653 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
655 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
656 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 DirectFB_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
659 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
661 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
662 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 switch (texture->blendMode) { |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
667 case SDL_BLENDMODE_NONE: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
668 case SDL_BLENDMODE_MASK: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
669 case SDL_BLENDMODE_BLEND: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
670 case SDL_BLENDMODE_ADD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
671 case SDL_BLENDMODE_MOD: |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
672 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 default: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
674 SDL_Unsupported(); |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
675 texture->blendMode = SDL_BLENDMODE_NONE; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
676 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
677 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
678 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
681 DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
683 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
684 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
685 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
686 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 switch (texture->scaleMode) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 case SDL_TEXTURESCALEMODE_NONE: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 case SDL_TEXTURESCALEMODE_FAST: |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
690 data->render_options = DSRO_NONE; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
691 break; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
692 case SDL_TEXTURESCALEMODE_SLOW: |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
693 data->render_options = DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
694 break; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
695 case SDL_TEXTURESCALEMODE_BEST: |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
696 data->render_options = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
697 DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE | DSRO_ANTIALIAS; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
698 break; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 default: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 SDL_Unsupported(); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
701 data->render_options = DSRO_NONE; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
702 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
704 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
705 #endif |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
706 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
707 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
709 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
710 DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
711 const SDL_Rect * rect, const void *pixels, int pitch) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
713 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
2241
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
714 DFBResult ret; |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
715 Uint8 *dpixels; |
2244 | 716 int dpitch; |
2241
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
717 Uint8 *src, *dst; |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
718 int row; |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
719 size_t length; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
720 |
2241
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
721 SDL_DFB_CHECKERR(data->surface->Lock(data->surface, |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
722 DSLF_WRITE | DSLF_READ, |
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
723 ((void **) &dpixels), &dpitch)); |
2241
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
724 src = (Uint8 *) pixels; |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
725 dst = |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
726 (Uint8 *) dpixels + rect->y * dpitch + |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
727 rect->x * SDL_BYTESPERPIXEL(texture->format); |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
728 length = rect->w * SDL_BYTESPERPIXEL(texture->format); |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
729 for (row = 0; row < rect->h; ++row) { |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
730 SDL_memcpy(dst, src, length); |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
731 src += pitch; |
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
732 dst += dpitch; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
733 } |
2244 | 734 SDL_DFB_CHECKERR(data->surface->Unlock(data->surface)); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
735 return 0; |
2244 | 736 error: |
737 return 1; | |
2241
4932f192c565
Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2226
diff
changeset
|
738 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
739 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
740 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
741 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
742 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
743 const SDL_Rect * rect, int markDirty, void **pixels, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
744 int *pitch) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
745 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
746 DirectFB_TextureData *texturedata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
747 (DirectFB_TextureData *) texture->driverdata; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
748 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
749 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
750 if (markDirty) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
751 SDL_AddDirtyRect(&texturedata->dirty, rect); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
752 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
753 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
754 if (texturedata->display) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
755 void *fdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
756 int fpitch; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
758 SDL_DFB_CHECKERR(texturedata->surface->Lock(texturedata->surface, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
759 DSLF_WRITE | DSLF_READ, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
760 &fdata, &fpitch)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
761 *pitch = fpitch; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
762 *pixels = fdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
763 } else { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
764 *pixels = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
765 (void *) ((Uint8 *) texturedata->pixels + |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
766 rect->y * texturedata->pitch + |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
767 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
768 *pitch = texturedata->pitch; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
769 } |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
770 return 0; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
771 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
772 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
773 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
774 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
775 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
776 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
777 DirectFB_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
778 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
779 DirectFB_TextureData *texturedata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
780 (DirectFB_TextureData *) texture->driverdata; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
781 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
782 if (texturedata->display) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
783 texturedata->surface->Unlock(texturedata->surface); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
784 texturedata->pixels = NULL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
785 } |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
786 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
787 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
788 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 DirectFB_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
790 int numrects, const SDL_Rect * rects) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
791 { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
792 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
793 int i; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
794 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
795 for (i = 0; i < numrects; ++i) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
796 SDL_AddDirtyRect(&data->dirty, &rects[i]); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
797 } |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 static int |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
801 DirectFB_SetDrawColor(SDL_Renderer * renderer) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
802 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
803 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
804 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
805 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
806 static int |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
807 DirectFB_SetDrawBlendMode(SDL_Renderer * renderer) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
808 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
809 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
810 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
811 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
812 static int |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
813 PrepareDraw(SDL_Renderer * renderer) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
814 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
815 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
816 DFBResult ret; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
817 Uint8 r, g, b, a; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
818 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
819 r = renderer->r; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
820 g = renderer->g; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
821 b = renderer->b; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
822 a = renderer->a; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
823 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
824 SetBlendMode(data, renderer->blendMode, NULL); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
825 SDL_DFB_CHECKERR(data->surface-> |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
826 SetDrawingFlags(data->surface, data->drawFlags)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
827 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
828 switch (renderer->blendMode) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
829 case SDL_BLENDMODE_NONE: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
830 case SDL_BLENDMODE_MASK: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
831 case SDL_BLENDMODE_BLEND: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
832 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
833 case SDL_BLENDMODE_ADD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
834 case SDL_BLENDMODE_MOD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
835 r = ((int) r * (int) a) / 255; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
836 g = ((int) g * (int) a) / 255; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
837 b = ((int) b * (int) a) / 255; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
838 a = 255; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
839 break; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
840 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
841 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
842 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, r, g, b, a)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
843 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
844 error: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
845 return -1; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
846 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
847 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
848 static int |
2901 | 849 DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y) |
850 { | |
851 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | |
852 DFBResult ret; | |
853 | |
854 PrepareDraw(renderer); | |
855 SDL_DFB_CHECKERR(data->surface->DrawPoint(data->surface, x, y)); | |
856 return 0; | |
857 error: | |
858 return -1; | |
859 } | |
860 | |
861 static int | |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
862 DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
863 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
864 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
865 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
866 |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
867 PrepareDraw(renderer); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
868 SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x1, y1, x2, y2)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
869 return 0; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
870 error: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
871 return -1; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
872 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
873 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
874 static int |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
875 DirectFB_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
876 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
877 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
878 DFBResult ret; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
879 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
880 PrepareDraw(renderer); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
881 SDL_DFB_CHECKERR(data->surface-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
882 FillRectangle(data->surface, rect->x, rect->y, rect->w, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
883 rect->h)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
884 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
885 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
886 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
887 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
888 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
889 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
890 static int |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
891 DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
892 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
893 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
894 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
895 DirectFB_TextureData *texturedata = |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
896 (DirectFB_TextureData *) texture->driverdata; |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
897 Uint8 alpha = 0xFF; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
898 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
899 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
900 if (texturedata->display) { |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
901 int px, py; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
902 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
903 SDL_DFB_WINDOWDATA(window); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
904 SDL_VideoDisplay *display = texturedata->display; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
905 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
906 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
907 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
908 SetSourceRectangle(dispdata->vidlayer, srcrect->x, |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
909 srcrect->y, srcrect->w, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
910 srcrect->h)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
911 windata->window->GetPosition(windata->window, &px, &py); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
912 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
913 SetScreenRectangle(dispdata->vidlayer, |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
914 px + dstrect->x, py + dstrect->y, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
915 dstrect->w, dstrect->h)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
916 } else { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
917 DFBRectangle sr, dr; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
918 DFBSurfaceBlittingFlags flags = 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
919 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
920 if (texturedata->dirty.list) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
921 SDL_DirtyRect *dirty; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
922 void *pixels; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
923 int bpp = SDL_BYTESPERPIXEL(texture->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
924 int pitch = texturedata->pitch; |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
925 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
926 for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
927 SDL_Rect *rect = &dirty->rect; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
928 pixels = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
929 (void *) ((Uint8 *) texturedata->pixels + |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
930 rect->y * pitch + rect->x * bpp); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
931 DirectFB_UpdateTexture(renderer, texture, rect, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
932 texturedata->pixels, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
933 texturedata->pitch); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
934 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
935 SDL_ClearDirtyRects(&texturedata->dirty); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
936 } |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
937 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
938 SDLtoDFBRect(srcrect, &sr); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
939 SDLtoDFBRect(dstrect, &dr); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
940 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
941 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
942 0xFF, 0xFF, 0xFF)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
943 if (texture-> |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
944 modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
945 { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
946 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
947 alpha = texture->a; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
948 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
949 0xFF, 0xFF, alpha)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
950 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
951 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
952 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
953 SDL_DFB_CHECKERR(data->surface-> |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
954 SetColor(data->surface, texture->r, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
955 texture->g, texture->b, alpha)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
956 flags |= DSBLIT_COLORIZE; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
957 } |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
958 if (alpha < 0xFF) |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
959 flags |= DSBLIT_SRC_PREMULTCOLOR; |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
960 } else |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
961 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
962 0xFF, 0xFF, 0xFF)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
963 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
964 SetBlendMode(data, texture->blendMode, texturedata); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
965 |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
966 SDL_DFB_CHECKERR(data->surface-> |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
967 SetBlittingFlags(data->surface, |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
968 data->blitFlags | flags)); |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
969 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
970 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
971 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
972 texturedata-> |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
973 render_options)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
974 #endif |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
975 |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
976 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
977 SDL_DFB_CHECKERR(data->surface-> |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
978 Blit(data->surface, texturedata->surface, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
979 &sr, dr.x, dr.y)); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
980 } else { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
981 SDL_DFB_CHECKERR(data->surface-> |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
982 StretchBlit(data->surface, texturedata->surface, |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
983 &sr, &dr)); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
984 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
985 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
986 return 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
987 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
988 return -1; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
989 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
990 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
991 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
992 DirectFB_RenderPresent(SDL_Renderer * renderer) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
993 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
994 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
995 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
996 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
997 DFBRectangle sr; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
998 DFBResult ret; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
999 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1000 sr.x = 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1001 sr.y = 0; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1002 sr.w = window->w; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1003 sr.h = window->h; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1004 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1005 /* Send the data to the display */ |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1006 SDL_DFB_CHECKERR(data->surface-> |
2791
8133d1d278da
Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
1007 Flip(data->surface, NULL, data->flipflags)); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1008 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1009 return; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1010 error: |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1011 return; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1012 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1013 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1014 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1015 DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1016 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1017 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1018 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1019 if (!data) { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1020 return; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1021 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1022 SDL_DFB_RELEASE(data->palette); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1023 SDL_DFB_RELEASE(data->surface); |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
1024 if (data->display) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1025 DFB_DisplayData *dispdata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1026 (DFB_DisplayData *) data->display->driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1027 dispdata->vidIDinuse = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1028 dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1029 DLSCL_ADMINISTRATIVE); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1030 SDL_DFB_RELEASE(dispdata->vidlayer); |
2721
e82a0e3e9b0e
Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2244
diff
changeset
|
1031 } |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1032 SDL_FreeDirtyRects(&data->dirty); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1033 SDL_DFB_FREE(data->pixels); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1034 SDL_free(data); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1035 texture->driverdata = NULL; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1036 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1037 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1038 static void |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1039 DirectFB_DestroyRenderer(SDL_Renderer * renderer) |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1040 { |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1041 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1042 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1043 if (data) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2722
diff
changeset
|
1044 SDL_DFB_RELEASE(data->surface); |
2226
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1045 SDL_free(data); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1046 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1047 SDL_free(renderer); |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1048 } |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1049 |
0e70b4b8cf84
Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1050 /* vi: set ts=4 sw=4 expandtab: */ |