annotate src/video/directfb/SDL_DirectFB_render.c @ 3510:58cbfa81317a

Don't need to hide the menu bar if we're not on the main display
author Sam Lantinga <slouken@libsdl.org>
date Wed, 02 Dec 2009 07:28:58 +0000
parents 4b594623401b
children 83518f8fcd61
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
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2791
diff changeset
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,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
44 SDL_Texture * texture,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
45 void **pixels, int *pitch);
2226
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,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
52 SDL_Color * colors,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
53 int firstcolor, int ncolors);
2226
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,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
64 const SDL_Rect * rect,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
65 const void *pixels, int pitch);
2226
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,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
67 SDL_Texture * texture,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
68 const SDL_Rect * rect, int markDirty,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
69 void **pixels, int *pitch);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 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
71 SDL_Texture * texture);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 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
73 SDL_Texture * texture, int numrects,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 const SDL_Rect * rects);
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
75 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
76 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
77 int x2, int y2);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
78 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
79 const SDL_Rect * rect);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
80 static int DirectFB_RenderCopy(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
81 SDL_Texture * texture,
2226
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
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
89 #define SDL_DFB_WINDOWSURFACE(win) IDirectFBSurface *destsurf = ((DFB_WindowData *) ((win)->driverdata))->surface;
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
90
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 SDL_RenderDriver DirectFB_RenderDriver = {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 DirectFB_CreateRenderer,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 "directfb",
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 (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
96 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
97 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
98 SDL_RENDERER_ACCELERATED),
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 (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
100 SDL_TEXTUREMODULATE_ALPHA),
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
101 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND |
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
102 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
103 (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
104 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
105 14,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
107 SDL_PIXELFORMAT_INDEX4LSB,
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 SDL_PIXELFORMAT_INDEX8,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 SDL_PIXELFORMAT_RGB332,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 SDL_PIXELFORMAT_RGB555,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 SDL_PIXELFORMAT_RGB565,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 SDL_PIXELFORMAT_RGB888,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 SDL_PIXELFORMAT_ARGB8888,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 SDL_PIXELFORMAT_ARGB4444,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 SDL_PIXELFORMAT_ARGB1555,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 SDL_PIXELFORMAT_RGB24,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 SDL_PIXELFORMAT_YV12,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 SDL_PIXELFORMAT_IYUV,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 SDL_PIXELFORMAT_YUY2,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 SDL_PIXELFORMAT_UYVY},
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 0,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 0}
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 };
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 typedef struct
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
127 SDL_Window *window;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 DFBSurfaceFlipFlags flipflags;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 int isyuvdirect;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
130 int size_changed;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
131 int lastBlendMode;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
132 DFBSurfaceBlittingFlags blitFlags;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
133 DFBSurfaceDrawingFlags drawFlags;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 } DirectFB_RenderData;
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 typedef struct
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 IDirectFBSurface *surface;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 Uint32 format;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 void *pixels;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 int pitch;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 IDirectFBPalette *palette;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
143 SDL_VideoDisplay *display;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
144 SDL_DirtyRectList dirty;
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
145 #if (DFB_VERSION_ATLEAST(1,2,0))
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
146 DFBSurfaceRenderOptions render_options;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
147 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 } DirectFB_TextureData;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
150 static __inline__ void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
151 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
152 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
153 dr->x = sr->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
154 dr->y = sr->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
155 dr->h = sr->h;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
156 dr->w = sr->w;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
157 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
158
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
159
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
160 static int
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
161 TextureHasAlpha(DirectFB_TextureData * data)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
162 {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
163 /* Drawing primitive ? */
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
164 if (!data)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
165 return 0;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
166 switch (data->format) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
167 case SDL_PIXELFORMAT_INDEX4LSB:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
168 case SDL_PIXELFORMAT_ARGB4444:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
169 case SDL_PIXELFORMAT_ARGB1555:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
170 case SDL_PIXELFORMAT_ARGB8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
171 case SDL_PIXELFORMAT_RGBA8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
172 case SDL_PIXELFORMAT_ABGR8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
173 case SDL_PIXELFORMAT_BGRA8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
174 case SDL_PIXELFORMAT_ARGB2101010:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
175 return 1;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
176 default:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
177 return 0;
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 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
180
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
181 static void
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
182 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
183 DirectFB_TextureData * source)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
184 {
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
185 SDL_DFB_WINDOWSURFACE(data->window);
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
186
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
187 //FIXME: check for format change
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
188 if (1 || data->lastBlendMode != blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
189 switch (blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
190 case SDL_BLENDMODE_NONE:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
191 /**< No blending */
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
192 data->blitFlags = DSBLIT_NOFX;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
193 data->drawFlags = DSDRAW_NOFX;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
194 destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE);
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
195 destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
196 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
197 case SDL_BLENDMODE_MASK:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
198 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
199 data->drawFlags = DSDRAW_BLEND;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
200 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
201 destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
202 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
203 case SDL_BLENDMODE_BLEND:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
204 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
205 data->drawFlags = DSDRAW_BLEND;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
206 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
207 destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
208 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
209 case SDL_BLENDMODE_ADD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
210 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
211 data->drawFlags = DSDRAW_BLEND;
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
212 // FIXME: SRCALPHA kills performance on radeon ...
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
213 // It will be cheaper to copy the surface to
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
214 // a temporay surface and premultiply
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
215 if (source && TextureHasAlpha(source))
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
216 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
217 else
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
218 destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE);
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
219 destsurf->SetDstBlendFunction(destsurf, DSBF_ONE);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
220 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
221 case SDL_BLENDMODE_MOD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
222 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
223 data->drawFlags = DSDRAW_BLEND;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
224 destsurf->SetSrcBlendFunction(destsurf, DSBF_DESTCOLOR);
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
225 destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
226 break;
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 data->lastBlendMode = blendMode;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
229 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
230 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
231
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 DirectFB_AddRenderDriver(_THIS)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 int i;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 for (i = 0; i < _this->num_displays; i++)
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3335
diff changeset
237 SDL_AddRenderDriver(&_this->displays[i], &DirectFB_RenderDriver);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
240 static int
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
241 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
242 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
243 #if USE_DISPLAY_PALETTE
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
244 DirectFB_RenderData *data = (DirectFB_RenderData *) userdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
245 SDL_DFB_WINDOWSURFACE(data->window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
246 IDirectFBPalette *surfpal;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
247
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
248 int ret;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
249 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
250 int ncolors;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
251 DFBColor entries[256];
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
252
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
253 SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal));
2737
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 /* FIXME: number of colors */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
256 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
257
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
258 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
259 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
260 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
261 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
262 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
263 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
264 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
265 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
266 error:
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3335
diff changeset
267 #else
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3335
diff changeset
268 SDL_Unsupported();
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
269 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
270 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
271 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
272
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
273
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 SDL_Renderer *
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 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
276 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 SDL_DFB_WINDOWDATA(window);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 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
279 SDL_Renderer *renderer = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 DirectFB_RenderData *data = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 DFBSurfaceCapabilities scaps;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 char *p;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 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
286 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
287
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 renderer->DisplayModeChanged = DirectFB_DisplayModeChanged;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
289 renderer->ActivateRenderer = DirectFB_ActivateRenderer;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 renderer->CreateTexture = DirectFB_CreateTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 renderer->SetTexturePalette = DirectFB_SetTexturePalette;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 renderer->GetTexturePalette = DirectFB_GetTexturePalette;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 renderer->SetTextureColorMod = DirectFB_SetTextureColorMod;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 renderer->SetTextureBlendMode = DirectFB_SetTextureBlendMode;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 renderer->UpdateTexture = DirectFB_UpdateTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 renderer->LockTexture = DirectFB_LockTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 renderer->UnlockTexture = DirectFB_UnlockTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 renderer->DirtyTexture = DirectFB_DirtyTexture;
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
302 renderer->RenderPoint = DirectFB_RenderPoint;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
303 renderer->RenderLine = DirectFB_RenderLine;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 renderer->RenderFill = DirectFB_RenderFill;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 renderer->RenderCopy = DirectFB_RenderCopy;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 renderer->RenderPresent = DirectFB_RenderPresent;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 renderer->DestroyTexture = DirectFB_DestroyTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 renderer->DestroyRenderer = DirectFB_DestroyRenderer;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 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
310 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
311 renderer->driverdata = data;
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 renderer->info.flags =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 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
315
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
316 data->window = window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
317
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
318 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
319
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 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
321 data->flipflags |= DSFLIP_WAITFORSYNC;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 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
323 } else
8133d1d278da Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
324 data->flipflags |= DSFLIP_ONSYNC;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
326 SDL_DFB_CHECKERR(windata->surface->
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
327 GetCapabilities(windata->surface, &scaps));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 if (scaps & DSCAPS_DOUBLE)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 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
330 else if (scaps & DSCAPS_TRIPLE)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 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
332 else
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 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
334
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
335 data->isyuvdirect = 0; /* default is off! */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
336 p = SDL_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
337 if (p)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 data->isyuvdirect = atoi(p);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
340 /* 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
341 if (display->palette) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
342 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
343 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
344
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 return renderer;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 SDL_DFB_FREE(renderer);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 SDL_DFB_FREE(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 return NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 }
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 static DFBSurfacePixelFormat
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 SDLToDFBPixelFormat(Uint32 format)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 switch (format) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 case SDL_PIXELFORMAT_INDEX4LSB:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 return DSPF_ALUT44;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 case SDL_PIXELFORMAT_INDEX8:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 return DSPF_LUT8;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 case SDL_PIXELFORMAT_RGB332:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 return DSPF_RGB332;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 case SDL_PIXELFORMAT_RGB555:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 return DSPF_ARGB1555;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 case SDL_PIXELFORMAT_ARGB4444:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 return DSPF_ARGB4444;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 case SDL_PIXELFORMAT_ARGB1555:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 return DSPF_ARGB1555;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 case SDL_PIXELFORMAT_RGB565:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 return DSPF_RGB16;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 case SDL_PIXELFORMAT_RGB24:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 return DSPF_RGB24;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 case SDL_PIXELFORMAT_RGB888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374 return DSPF_RGB32;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 case SDL_PIXELFORMAT_ARGB8888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376 return DSPF_ARGB;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 case SDL_PIXELFORMAT_YV12:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 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
379 case SDL_PIXELFORMAT_IYUV:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380 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
381 case SDL_PIXELFORMAT_YUY2:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 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
383 case SDL_PIXELFORMAT_UYVY:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 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
385 case SDL_PIXELFORMAT_YVYU:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 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
387 case SDL_PIXELFORMAT_INDEX1LSB:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 case SDL_PIXELFORMAT_INDEX1MSB:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 case SDL_PIXELFORMAT_INDEX4MSB:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 case SDL_PIXELFORMAT_RGB444:
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
394 #if (DFB_VERSION_ATLEAST(1,2,0))
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
395 return DSPF_RGB444;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
396 #else
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 return DSPF_UNKNOWN;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
398 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 case SDL_PIXELFORMAT_BGR24:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 case SDL_PIXELFORMAT_BGR888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 case SDL_PIXELFORMAT_RGBA8888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 case SDL_PIXELFORMAT_ABGR8888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 case SDL_PIXELFORMAT_BGRA8888:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409 case SDL_PIXELFORMAT_ARGB2101010:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
410 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
411 default:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
412 return DSPF_UNKNOWN;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
413 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
414 }
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 static int
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
417 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
418 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419 SDL_DFB_RENDERERDATA(renderer);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 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
421 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
422
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
423 if (renddata->size_changed || windata->wm_needs_redraw) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
424 DirectFB_AdjustWindowSurface(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
425 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
426 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
427 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
428
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
429 static int
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
430 DirectFB_DisplayModeChanged(SDL_Renderer * renderer)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
431 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
432 SDL_DFB_RENDERERDATA(renderer);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
433
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
434 renddata->size_changed = SDL_TRUE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
435 return 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
436 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
437
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
438 static int
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
439 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
440 {
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
441 SDL_DFB_RENDERERDATA(renderer);
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
442 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
443 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
444 SDL_DFB_DEVICEDATA(display->device);
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
445 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
446 DirectFB_TextureData *data = texture->driverdata;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
447 DFBDisplayLayerConfig layconf;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
448 int ret;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
449
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
450 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
451 && (!dispdata->vidIDinuse)
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
452 && 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
453 layconf.flags =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
454 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
455 DLCONF_SURFACE_CAPS;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
456 layconf.width = texture->w;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
457 layconf.height = texture->h;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
458 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
459 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
460
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
461 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
462 dispdata->vidID,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
463 &dispdata->vidlayer));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
464 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
465 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
466 DLSCL_EXCLUSIVE));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
467
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
468 if (devdata->use_yuv_underlays) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
469 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
470 if (ret != DFB_OK)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
471 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
472 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
473 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
474 vidlayer->SetConfiguration(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
475 &layconf));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
476 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
477 vidlayer->GetSurface(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
478 &data->surface));
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
479 dispdata->vidIDinuse = 1;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
480 data->display = display;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
481 return 0;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
482 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
483 return 1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
484 error:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
485 if (dispdata->vidlayer) {
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
486 SDL_DFB_RELEASE(data->surface);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
487 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
488 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
489 DLSCL_ADMINISTRATIVE));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
490 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
491 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
492 return 1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
493 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
494
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
495 static int
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
496 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
497 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
498 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
499 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
500 SDL_DFB_DEVICEDATA(display->device);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
501 DirectFB_TextureData *data;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
502 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
503 DFBSurfaceDescription dsc;
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
504 DFBSurfacePixelFormat pixelformat;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
505
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
506 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
507 texture->driverdata = data;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
508
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
509 /* find the right pixelformat */
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
510 pixelformat = SDLToDFBPixelFormat(texture->format);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
511 if (pixelformat == DSPF_UNKNOWN) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
512 SDL_SetError("Unknown pixel format %d\n", data->format);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
513 goto error;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
514 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
515
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
516 data->format = texture->format;
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
517 data->pitch = texture->w * DFB_BYTES_PER_PIXEL(pixelformat);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
518
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
519 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
520 /* fill surface description */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
521 dsc.flags =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
522 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
523 dsc.width = texture->w;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
524 dsc.height = texture->h;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
525 /* <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
526 * 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
527 * 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
528 * 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
529 */
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
530 dsc.caps = DSCAPS_PREMULTIPLIED;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
531 #if 0
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
532 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
533 dsc.caps |= DSCAPS_SYSTEMONLY;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
534 else
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
535 dsc.caps |= DSCAPS_VIDEOONLY;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
536 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
537
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
538 dsc.pixelformat = pixelformat;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
539 data->pixels = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
540
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
541 /* Create the surface */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
542 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
543 &data->surface));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
544 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
545 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
546 SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
547 &data->palette));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
548 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
549
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
550 }
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
551 #if (DFB_VERSION_ATLEAST(1,2,0))
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
552 data->render_options = DSRO_NONE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
553 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
554
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
555 if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
556 /* 3 plane YUVs return 1 bpp, but we need more space for other planes */
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
557 if(texture->format == SDL_PIXELFORMAT_YV12 ||
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
558 texture->format == SDL_PIXELFORMAT_IYUV) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
559 SDL_DFB_CALLOC(data->pixels, 1, (texture->h * data->pitch * 3 + texture->h * data->pitch * 3 % 2) / 2);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
560 } else {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
561 SDL_DFB_CALLOC(data->pixels, 1, texture->h * data->pitch);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
562 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
563 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
564
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
565 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
566
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
567 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
568 SDL_DFB_RELEASE(data->palette);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
569 SDL_DFB_RELEASE(data->surface);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
570 SDL_DFB_FREE(texture->driverdata);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
571 return -1;
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
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
574 static int
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
575 DirectFB_QueryTexturePixels(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
576 SDL_Texture * texture, void **pixels, int *pitch)
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
577 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
578 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
579 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
580
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
581 if (texturedata->display) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
582 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
583 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
584 *pixels = texturedata->pixels;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
585 *pitch = texturedata->pitch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
586 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
587 return 0;
2226
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
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
590 static int
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
591 DirectFB_SetTexturePalette(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
592 SDL_Texture * texture,
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
593 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
594 int ncolors)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
595 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
596 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
597 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
598
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
599 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
600 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
601 DFBColor entries[256];
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
602 int i;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
603
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
604 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
605 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
606 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
607 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
608 entries[i].a = 0xFF;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
609 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
610 SDL_DFB_CHECKERR(data->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
611 palette->SetEntries(data->palette, entries, ncolors,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
612 firstcolor));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
613 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
614 } else {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
615 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
616 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
617 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
618 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
619 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
620 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
621
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
622 static int
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
623 DirectFB_GetTexturePalette(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
624 SDL_Texture * texture, SDL_Color * colors,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
625 int firstcolor, int ncolors)
2226
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 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
628 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
629
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
630 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
631 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
632 DFBColor entries[256];
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
633 int i;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
634
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
635 SDL_DFB_CHECKERR(data->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
636 palette->GetEntries(data->palette, entries, ncolors,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
637 firstcolor));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
638
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
639 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
640 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
641 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
642 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
643 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
644 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
645 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
646 } else {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
647 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
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 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
651 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
652 }
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 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
655 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
656 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
657 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
658 }
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 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
661 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
662 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
663 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
664 }
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 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
667 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
668 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
669 switch (texture->blendMode) {
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
670 case SDL_BLENDMODE_NONE:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
671 case SDL_BLENDMODE_MASK:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
672 case SDL_BLENDMODE_BLEND:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
673 case SDL_BLENDMODE_ADD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
674 case SDL_BLENDMODE_MOD:
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
675 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
676 default:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
677 SDL_Unsupported();
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
678 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
679 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
680 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
681 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
682
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
683 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
684 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
685 {
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
686 #if (DFB_VERSION_ATLEAST(1,2,0))
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
687
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
688 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
689
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
690 switch (texture->scaleMode) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
691 case SDL_TEXTURESCALEMODE_NONE:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
692 case SDL_TEXTURESCALEMODE_FAST:
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_NONE;
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_SLOW:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
696 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
697 break;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
698 case SDL_TEXTURESCALEMODE_BEST:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
699 data->render_options =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
700 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
701 break;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
702 default:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
703 SDL_Unsupported();
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
704 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
705 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
706 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
707 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
708 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
709 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
710 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
711
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
712 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
713 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
714 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
715 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
716 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
717 DFBResult ret;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
718 Uint8 *dpixels;
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
719 int dpitch;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
720 Uint8 *src, *dst;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
721 int row;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
722 size_t length;
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
723 int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format));
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
724 // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
725
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
726 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
727 DSLF_WRITE | DSLF_READ,
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
728 ((void **) &dpixels), &dpitch));
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
729 src = (Uint8 *) pixels;
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
730 dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
731 length = rect->w * bpp;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
732 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
733 SDL_memcpy(dst, src, length);
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
734 src += pitch;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
735 dst += dpitch;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
736 }
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
737 /* copy other planes for 3 plane formats */
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
738 if (texture->format == SDL_PIXELFORMAT_YV12 ||
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
739 texture->format == SDL_PIXELFORMAT_IYUV) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
740 src = (Uint8 *) pixels + texture->h * pitch;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
741 dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
742 for (row = 0; row < rect->h / 2; ++row) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
743 SDL_memcpy(dst, src, length / 2);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
744 src += pitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
745 dst += dpitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
746 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
747 src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
748 dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
749 for (row = 0; row < rect->h / 2; ++row) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
750 SDL_memcpy(dst, src, length / 2);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
751 src += pitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
752 dst += dpitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
753 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
754 }
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
755 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
756 return 0;
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
757 error:
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
758 return 1;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
759
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
760 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
761
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
762 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
763 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
764 const SDL_Rect * rect, int markDirty,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
765 void **pixels, int *pitch)
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
766 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
767 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
768 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
769 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
770
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
771 if (markDirty) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
772 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
773 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
774
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
775 if (texturedata->display) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
776 void *fdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
777 int fpitch;
2226
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 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
780 DSLF_WRITE | DSLF_READ,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
781 &fdata, &fpitch));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
782 *pitch = fpitch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
783 *pixels = fdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
784 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
785 *pixels =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
786 (void *) ((Uint8 *) texturedata->pixels +
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
787 rect->y * texturedata->pitch +
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
788 rect->x * DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format)));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
789 *pitch = texturedata->pitch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
790 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
791 return 0;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
792
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
793 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
794 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
795 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
796
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
797 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
798 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
799 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
800 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
801 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
802
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
803 if (texturedata->display) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
804 texturedata->surface->Unlock(texturedata->surface);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
805 texturedata->pixels = NULL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
806 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
807 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
808
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
809 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
810 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
811 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
812 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
813 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
814 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
815
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
816 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
817 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
818 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
819 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
820
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
821 static int
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
822 PrepareDraw(SDL_Renderer * renderer)
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 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
825 SDL_DFB_WINDOWSURFACE(data->window);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
826
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
827 DFBResult ret;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
828 Uint8 r, g, b, a;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
829
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
830 r = renderer->r;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
831 g = renderer->g;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
832 b = renderer->b;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
833 a = renderer->a;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
834
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
835 SetBlendMode(data, renderer->blendMode, NULL);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
836 SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf, data->drawFlags));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
837
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
838 switch (renderer->blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
839 case SDL_BLENDMODE_NONE:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
840 case SDL_BLENDMODE_MASK:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
841 case SDL_BLENDMODE_BLEND:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
842 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
843 case SDL_BLENDMODE_ADD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
844 case SDL_BLENDMODE_MOD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
845 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
846 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
847 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
848 a = 255;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
849 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
850 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
851
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
852 SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, r, g, b, a));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
853 return 0;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
854 error:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
855 return -1;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
856 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
857
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
858 static int
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
859 DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y)
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
860 {
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
861 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
862 SDL_DFB_WINDOWSURFACE(data->window);
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
863 DFBResult ret;
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
864
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
865 PrepareDraw(renderer);
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
866 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y));
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
867 return 0;
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
868 error:
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
869 return -1;
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
870 }
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
871
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
872 static int
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
873 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
874 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
875 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
876 SDL_DFB_WINDOWSURFACE(data->window);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
877 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
878
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
879 PrepareDraw(renderer);
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
880 /* Use antialiasing when available */
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
881 #if (DFB_VERSION_ATLEAST(1,2,0))
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
882 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
883 #endif
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
884 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
885 return 0;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
886 error:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
887 return -1;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
888 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
889
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
890 static int
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
891 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
892 {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
893 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
894 SDL_DFB_WINDOWSURFACE(data->window);
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
895 DFBResult ret;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
896
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
897 PrepareDraw(renderer);
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
898 SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rect->x, rect->y,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
899 rect->w, rect->h));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
900
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
901 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
902 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
903 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
904 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
905
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
906 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
907 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
908 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
909 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
910 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
911 SDL_DFB_WINDOWSURFACE(data->window);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
912 DirectFB_TextureData *texturedata =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
913 (DirectFB_TextureData *) texture->driverdata;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
914 Uint8 alpha = 0xFF;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
915 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
916
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
917 if (texturedata->display) {
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
918 int px, py;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
919 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
920 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
921 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
922 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
923
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
924 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
925 vidlayer->SetSourceRectangle(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
926 srcrect->x, srcrect->y,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
927 srcrect->w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
928 srcrect->h));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
929 windata->window->GetPosition(windata->window, &px, &py);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
930 px += windata->client.x;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
931 py += windata->client.y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
932 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
933 vidlayer->SetScreenRectangle(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
934 px + dstrect->x,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
935 py + dstrect->y,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
936 dstrect->w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
937 dstrect->h));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
938 } else {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
939 DFBRectangle sr, dr;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
940 DFBSurfaceBlittingFlags flags = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
941
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
942 if (texturedata->dirty.list) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
943 SDL_DirtyRect *dirty;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
944 void *pixels;
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
945 int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
946 int pitch = texturedata->pitch;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
947
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
948 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
949 SDL_Rect *rect = &dirty->rect;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
950 pixels =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
951 (void *) ((Uint8 *) texturedata->pixels +
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
952 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
953 DirectFB_UpdateTexture(renderer, texture, rect,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
954 texturedata->pixels,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
955 texturedata->pitch);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
956 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
957 SDL_ClearDirtyRects(&texturedata->dirty);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
958 }
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
959
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
960 SDLtoDFBRect(srcrect, &sr);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
961 SDLtoDFBRect(dstrect, &dr);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
962
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
963 SDL_DFB_CHECKERR(destsurf->
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
964 SetColor(destsurf, 0xFF, 0xFF, 0xFF, 0xFF));
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
965 if (texture->
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
966 modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA))
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
967 {
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
968 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
969 alpha = texture->a;
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
970 SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, 0xFF, 0xFF,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
971 0xFF, alpha));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
972 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
973 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
974
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
975 SDL_DFB_CHECKERR(destsurf->SetColor(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
976 texture->r,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
977 texture->g,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
978 texture->b, alpha));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
979 flags |= DSBLIT_COLORIZE;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
980 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
981 if (alpha < 0xFF)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
982 flags |= DSBLIT_SRC_PREMULTCOLOR;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
983 } else
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
984 SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, 0xFF, 0xFF,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
985 0xFF, 0xFF));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
986
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
987 SetBlendMode(data, texture->blendMode, texturedata);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
988
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
989 SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
990 data->blitFlags | flags));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
991
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
992 #if (DFB_VERSION_ATLEAST(1,2,0))
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
993 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
994 texturedata->
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
995 render_options));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
996 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
997
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
998 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
999 SDL_DFB_CHECKERR(destsurf->Blit(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1000 texturedata->surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1001 &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
1002 } else {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
1003 SDL_DFB_CHECKERR(destsurf->StretchBlit(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1004 texturedata->surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1005 &sr, &dr));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1006 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1007 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1008 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1009 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1010 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1011 }
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 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1014 DirectFB_RenderPresent(SDL_Renderer * renderer)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1015 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1016 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
1017 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
1018 SDL_DFB_WINDOWDATA(window);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1019
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1020 DFBRectangle sr;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1021 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1022
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1023 sr.x = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1024 sr.y = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1025 sr.w = window->w;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1026 sr.h = window->h;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1027
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1028 /* Send the data to the display */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
1029 SDL_DFB_CHECK(windata->window_surface->Flip(windata->window_surface, NULL,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
1030 data->flipflags));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1031 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1032
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1033 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1034 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
1035 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1036 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
1037
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1038 if (!data) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1039 return;
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 SDL_DFB_RELEASE(data->palette);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1042 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
1043 if (data->display) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1044 DFB_DisplayData *dispdata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1045 (DFB_DisplayData *) data->display->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1046 dispdata->vidIDinuse = 0;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1047 dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1048 DLSCL_ADMINISTRATIVE);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1049 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
1050 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1051 SDL_FreeDirtyRects(&data->dirty);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1052 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
1053 SDL_free(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1054 texture->driverdata = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1055 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1056
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1057 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1058 DirectFB_DestroyRenderer(SDL_Renderer * renderer)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1059 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1060 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1061
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1062 if (data) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1063 SDL_free(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1064 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1065 SDL_free(renderer);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1066 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1067
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1068 /* vi: set ts=4 sw=4 expandtab: */