annotate src/video/directfb/SDL_DirectFB_render.c @ 5218:b1b0811a1ccc

merged
author Eric Wing <ewing . public |-at-| gmail . com>
date Sun, 06 Feb 2011 21:23:32 -0800
parents 164f20ba08eb
children 58265e606e4e
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
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3685
diff changeset
3 Copyright (C) 1997-2010 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
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
21
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
22 SDL1.3 DirectFB driver by couriersud@arcor.de
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
23
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 */
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
25 #include "SDL_DirectFB_video.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
26 #include "SDL_DirectFB_window.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
27 #include "SDL_DirectFB_modes.h"
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
29 #include "SDL_DirectFB_shape.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
30
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
31 #include "../SDL_sysvideo.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
32 #include "../../render/SDL_sysrender.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
33 //#include "../SDL_rect_c.h"
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
34 //#include "../SDL_yuv_sw_c.h"
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
36 /* 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
37 #define USE_DISPLAY_PALETTE (0)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
38
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
39
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
40 #define SDL_DFB_RENDERERDATA(rend) DirectFB_RenderData *renddata = ((rend) ? (DirectFB_RenderData *) (rend)->driverdata : NULL)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
41
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
42
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 /* GDI renderer implementation */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 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
46 Uint32 flags);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
47 static void 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
48 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
49 SDL_Texture * texture);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 static int DirectFB_QueryTexturePixels(SDL_Renderer * renderer,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
51 SDL_Texture * texture,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
52 void **pixels, int *pitch);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
53 static int DirectFB_SetTexturePalette(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
54 SDL_Texture * texture,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
55 const SDL_Color * colors,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
56 int firstcolor, int ncolors);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
57 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
58 SDL_Texture * texture,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
59 SDL_Color * colors,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
60 int firstcolor, int ncolors);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
61 static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
62 SDL_Texture * texture);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
63 static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
64 SDL_Texture * texture);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
65 static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
66 SDL_Texture * texture);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
67 static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
68 SDL_Texture * texture);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 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
70 SDL_Texture * texture,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
71 const SDL_Rect * rect,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
72 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
73 static int DirectFB_LockTexture(SDL_Renderer * renderer,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
74 SDL_Texture * texture,
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
75 const SDL_Rect * rect,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
76 void **pixels, int *pitch);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 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
78 SDL_Texture * texture);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 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
80 SDL_Texture * texture, int numrects,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 const SDL_Rect * rects);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
82 static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
83 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
84 const SDL_Point * points, int count);
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
85 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
86 const SDL_Point * points, int count);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
87 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
88 const SDL_Rect ** rects, int count);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
89 static int DirectFB_RenderFillRects(SDL_Renderer * renderer,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
90 const SDL_Rect ** rects, int count);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
91 static int DirectFB_RenderCopy(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
92 SDL_Texture * texture,
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 const SDL_Rect * srcrect,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 const SDL_Rect * dstrect);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 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
96 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
97 SDL_Texture * texture);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 static void DirectFB_DestroyRenderer(SDL_Renderer * renderer);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
99 static int DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
100 Uint32 format, void * pixels, int pitch);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
101 static int DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
102 Uint32 format, const void * pixels, int pitch);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
103
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
105 #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
106
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 SDL_RenderDriver DirectFB_RenderDriver = {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 DirectFB_CreateRenderer,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 "directfb",
5145
c8e049de174c Making the API simpler, the renderer present semantics are always having a backbuffer and then discarding it. This is best for hardware accelerated rendering.
Sam Lantinga <slouken@libsdl.org>
parents: 5144
diff changeset
111 (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
112 /* (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
113 SDL_TEXTUREMODULATE_ALPHA),
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
114 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND |
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
115 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
116 (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST |
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
117 SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST),*/
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
118 0,
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
120 /* formats filled in later */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
121 },
2226
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 0}
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
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 typedef struct
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
128 SDL_Window *window;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 DFBSurfaceFlipFlags flipflags;
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;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
142 IDirectFBPalette *palette;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
143 int isDirty;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
144
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
145 SDL_VideoDisplay *display; /* only for yuv textures */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
146
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
147 #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
148 DFBSurfaceRenderOptions render_options;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
149 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 } DirectFB_TextureData;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
152 static __inline__ void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
153 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
154 {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
155 dr->x = sr->x;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
156 dr->y = sr->y;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
157 dr->h = sr->h;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
158 dr->w = sr->w;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
159 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
160
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
161
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
162 static int
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
163 TextureHasAlpha(DirectFB_TextureData * data)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
164 {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
165 /* Drawing primitive ? */
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
166 if (!data)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
167 return 0;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
168
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
169 return (DFB_PIXELFORMAT_HAS_ALPHA(DirectFB_SDLToDFBPixelFormat(data->format)) ? 1 : 0);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
170 #if 0
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
171 switch (data->format) {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
172 case SDL_PIXELFORMAT_INDEX4LSB:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
173 case SDL_PIXELFORMAT_INDEX4MSB:
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
174 case SDL_PIXELFORMAT_ARGB4444:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
175 case SDL_PIXELFORMAT_ARGB1555:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
176 case SDL_PIXELFORMAT_ARGB8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
177 case SDL_PIXELFORMAT_RGBA8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
178 case SDL_PIXELFORMAT_ABGR8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
179 case SDL_PIXELFORMAT_BGRA8888:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
180 case SDL_PIXELFORMAT_ARGB2101010:
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
181 return 1;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
182 default:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
183 return 0;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
184 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
185 #endif
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
186 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
187
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
188 static void
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
189 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
190 DirectFB_TextureData * source)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
191 {
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
192 SDL_DFB_WINDOWSURFACE(data->window);
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
193
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
194 //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
195 if (1 || data->lastBlendMode != blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
196 switch (blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
197 case SDL_BLENDMODE_NONE:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
198 /**< No blending */
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
199 data->blitFlags = DSBLIT_NOFX;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
200 data->drawFlags = DSDRAW_NOFX;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
201 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
202 SDL_DFB_CHECK(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
203 break;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
204 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
205 case SDL_BLENDMODE_MASK:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
206 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
207 data->drawFlags = DSDRAW_BLEND;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
208 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
209 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
210 break;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
211 #endif
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
212 case SDL_BLENDMODE_BLEND:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
213 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
214 data->drawFlags = DSDRAW_BLEND;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
215 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
216 SDL_DFB_CHECK(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
217 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
218 case SDL_BLENDMODE_ADD:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
219 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
220 data->drawFlags = DSDRAW_BLEND;
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
221 // 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
222 // 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
223 // a temporay surface and premultiply
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
224 if (source && TextureHasAlpha(source))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
225 SDL_DFB_CHECK(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
226 else
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
227 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
228 SDL_DFB_CHECK(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
229 break;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
230 case SDL_BLENDMODE_MOD:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
231 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
232 data->drawFlags = DSDRAW_BLEND;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
233 //SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_DESTCOLOR));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
234 //SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
235 //data->glBlendFunc(GL_ZERO, GL_SRC_COLOR);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
236 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ZERO));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
237 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_SRCCOLOR));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
238
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
239 break;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
240 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
241 data->lastBlendMode = blendMode;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
242 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
243 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
244
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
245 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
246 DisplayPaletteChanged(void *userdata, SDL_Palette * palette)
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
248 #if USE_DISPLAY_PALETTE
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
249 DirectFB_RenderData *data = (DirectFB_RenderData *) userdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
250 SDL_DFB_WINDOWSURFACE(data->window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
251 IDirectFBPalette *surfpal;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
252
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 int i;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
254 int ncolors;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
255 DFBColor entries[256];
3520
83518f8fcd61 Fixed calls to SDL_AddRenderDriver()
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
256
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
257 SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
258
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
259 /* FIXME: number of colors */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
260 ncolors = (palette->ncolors < 256 ? palette->ncolors : 256);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
261
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
262 for (i = 0; i < ncolors; ++i) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
263 entries[i].r = palette->colors[i].r;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
264 entries[i].g = palette->colors[i].g;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
265 entries[i].b = palette->colors[i].b;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
266 entries[i].a = palette->colors[i].unused;
3520
83518f8fcd61 Fixed calls to SDL_AddRenderDriver()
Sam Lantinga <slouken@libsdl.org>
parents: 3500
diff changeset
267 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
268 SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
269 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
270 error:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
271 #else
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
272 SDL_Unsupported();
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
273 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
274 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
275 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
276
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
277 static void
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
278 DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
279 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
280 SDL_DFB_RENDERERDATA(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
281
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
282 if (event->event == SDL_WINDOWEVENT_RESIZED) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
283 /* Rebind the context to the window area and update matrices */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
284 //SDL_CurrentContext = NULL;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
285 //data->updateSize = SDL_TRUE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
286 renddata->size_changed = SDL_TRUE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
287 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
288 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
289
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
290 int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
291 DirectFB_RenderClear(SDL_Renderer * renderer)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
292 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
293 SDL_DFB_RENDERERDATA(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
294
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
295 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
296
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
297 return 0;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 SDL_Renderer *
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 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
302 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 SDL_DFB_WINDOWDATA(window);
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3640
diff changeset
304 SDL_VideoDisplay *display = window->display;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 SDL_Renderer *renderer = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 DirectFB_RenderData *data = NULL;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
307 DFBSurfaceCapabilities scaps;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
308 //char *p;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
310 SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
311 SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
313 renderer->WindowEvent = DirectFB_WindowEvent;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 renderer->CreateTexture = DirectFB_CreateTexture;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
315 renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
316 renderer->SetTextureColorMod = DirectFB_SetTextureColorMod;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
317 renderer->SetTextureBlendMode = DirectFB_SetTextureBlendMode;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 renderer->UpdateTexture = DirectFB_UpdateTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 renderer->LockTexture = DirectFB_LockTexture;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
320 renderer->RenderClear = DirectFB_RenderClear;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 renderer->UnlockTexture = DirectFB_UnlockTexture;
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
322 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
323 renderer->RenderDrawLines = DirectFB_RenderDrawLines;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
324 /* SetDrawColor - no needed */
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
325 renderer->RenderFillRects = DirectFB_RenderFillRects;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
326 /* RenderDrawEllipse - no reference implementation yet */
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
327 /* RenderFillEllipse - no reference implementation yet */
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 renderer->RenderCopy = DirectFB_RenderCopy;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 renderer->RenderPresent = DirectFB_RenderPresent;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
330
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
331 /* FIXME: Yet to be tested */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
332 renderer->RenderReadPixels = DirectFB_RenderReadPixels;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
333 //renderer->RenderWritePixels = DirectFB_RenderWritePixels;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
334
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 renderer->DestroyTexture = DirectFB_DestroyTexture;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 renderer->DestroyRenderer = DirectFB_DestroyRenderer;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
337
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
338 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
339 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
340 renderer->SetTexturePalette = DirectFB_SetTexturePalette;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
341 renderer->GetTexturePalette = DirectFB_GetTexturePalette;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
342 renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
343 renderer->DirtyTexture = DirectFB_DirtyTexture;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
344 renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
345 renderer->RenderDrawRects = DirectFB_RenderDrawRects;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
346 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
347
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 renderer->info = DirectFB_RenderDriver.info;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3640
diff changeset
349 renderer->window = window; /* SDL window */
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 renderer->driverdata = data;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
352 renderer->info.flags =
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
353 SDL_RENDERER_ACCELERATED;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
355 data->window = window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
356
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
357 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
358
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 if (flags & SDL_RENDERER_PRESENTVSYNC) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
360 data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 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
362 } else
8133d1d278da Date: Wed, 26 Nov 2008 19:50:31 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2737
diff changeset
363 data->flipflags |= DSFLIP_ONSYNC;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
365 SDL_DFB_CHECKERR(windata->surface->
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
366 GetCapabilities(windata->surface, &scaps));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
367
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
368 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
369 if (scaps & DSCAPS_DOUBLE)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
370 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
371 else if (scaps & DSCAPS_TRIPLE)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
372 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
373 else
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
374 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
375 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
376
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
377 DirectFB_SetSupportedPixelFormats(&renderer->info);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
378
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
379 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
380 /* Set up a palette watch on the display palette */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
381 if (display->palette) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
382 SDL_AddPaletteWatch(display->palette, DisplayPaletteChanged, data);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
383 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
384 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 return renderer;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 SDL_DFB_FREE(renderer);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 SDL_DFB_FREE(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 return NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
394 static void
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
395 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
396 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 SDL_DFB_RENDERERDATA(renderer);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
398 SDL_Window *window = renderer->window;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 SDL_DFB_WINDOWDATA(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
400
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
401 if (renddata->size_changed || windata->wm_needs_redraw) {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
402 DirectFB_AdjustWindowSurface(window);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
403 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
406
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
407 static int
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
408 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
409 {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
410 //SDL_DFB_RENDERERDATA(renderer);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
411 SDL_Window *window = renderer->window;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3640
diff changeset
412 SDL_VideoDisplay *display = window->display;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
413 SDL_DFB_DEVICEDATA(display->device);
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
414 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
415 DirectFB_TextureData *data = texture->driverdata;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
416 DFBDisplayLayerConfig layconf;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
417 DFBResult ret;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
418
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
419 if (devdata->use_yuv_direct && (dispdata->vidID >= 0)
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
420 && (!dispdata->vidIDinuse)
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
421 && 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
422 layconf.flags =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
423 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
424 DLCONF_SURFACE_CAPS;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
425 layconf.width = texture->w;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
426 layconf.height = texture->h;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
427 layconf.pixelformat = DirectFB_SDLToDFBPixelFormat(data->format);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
428 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
429
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
430 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
431 dispdata->vidID,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
432 &dispdata->vidlayer));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
433 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
434 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
435 DLSCL_EXCLUSIVE));
2737
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 if (devdata->use_yuv_underlays) {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
438 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
439 if (ret != DFB_OK)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
440 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
441 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
442 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
443 vidlayer->SetConfiguration(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
444 &layconf));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
445 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
446 vidlayer->GetSurface(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
447 &data->surface));
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
448 dispdata->vidIDinuse = 1;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
449 data->display = display;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
450 return 0;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
451 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
452 return 1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
453 error:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
454 if (dispdata->vidlayer) {
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
455 SDL_DFB_RELEASE(data->surface);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
456 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
457 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
458 DLSCL_ADMINISTRATIVE));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
459 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
460 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
461 return 1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
462 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
463
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
464 static int
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
465 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
466 {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
467 SDL_Window *window = renderer->window;
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3640
diff changeset
468 SDL_VideoDisplay *display = window->display;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469 SDL_DFB_DEVICEDATA(display->device);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
470 DirectFB_TextureData *data;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
471 DFBSurfaceDescription dsc;
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
472 DFBSurfacePixelFormat pixelformat;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
474 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
475
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
476 SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
477 texture->driverdata = data;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
478
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
479 /* find the right pixelformat */
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
480 pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format);
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
481 if (pixelformat == DSPF_UNKNOWN) {
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
482 SDL_SetError("Unknown pixel format %d\n", data->format);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
483 goto error;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
484 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
485
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
486 data->format = texture->format;
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
487 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
488
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
489 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
490 /* fill surface description */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
491 dsc.flags =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
492 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
493 dsc.width = texture->w;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
494 dsc.height = texture->h;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
495 if(texture->format == SDL_PIXELFORMAT_YV12 ||
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
496 texture->format == SDL_PIXELFORMAT_IYUV) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
497 /* dfb has problems with odd sizes -make them even internally */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
498 dsc.width += (dsc.width % 2);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
499 dsc.height += (dsc.height % 2);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
500 }
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
501 /* <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
502 * 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
503 * 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
504 * 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
505 */
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
506 dsc.caps = DSCAPS_PREMULTIPLIED;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
507 #if 0
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
508 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
509 dsc.caps |= DSCAPS_SYSTEMONLY;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
510 else
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
511 dsc.caps |= DSCAPS_VIDEOONLY;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
512 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
513
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
514 dsc.pixelformat = pixelformat;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
515 data->pixels = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
516
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
517 /* Create the surface */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
518 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
519 &data->surface));
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
520 if (SDL_ISPIXELFORMAT_INDEXED(data->format)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
521 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
522 #if 1
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
523 SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &data->palette));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
524 #else
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
525 /* DFB has issues with blitting LUT8 surfaces.
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
526 * Creating a new palette does not help.
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
527 */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
528 DFBPaletteDescription pal_desc;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
529 pal_desc.flags = DPDESC_SIZE; // | DPDESC_ENTRIES
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
530 pal_desc.size = 256;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
531 SDL_DFB_CHECKERR(devdata->dfb->CreatePalette(devdata->dfb, &pal_desc,&data->palette));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
532 SDL_DFB_CHECKERR(data->surface->SetPalette(data->surface, data->palette));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
533 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
534 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
535
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
536 }
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
537 #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
538 data->render_options = DSRO_NONE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
539 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
540 if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
541 /* 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
542 if(texture->format == SDL_PIXELFORMAT_YV12 ||
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
543 texture->format == SDL_PIXELFORMAT_IYUV) {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
544 SDL_DFB_ALLOC_CLEAR(data->pixels, (texture->h * data->pitch + ((texture->h + texture->h % 2) * (data->pitch + data->pitch % 2) * 2) / 4));
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
545 } else {
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
546 SDL_DFB_ALLOC_CLEAR(data->pixels, texture->h * data->pitch);
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
547 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
548 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
549
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
550 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
551
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
552 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
553 SDL_DFB_RELEASE(data->palette);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
554 SDL_DFB_RELEASE(data->surface);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
555 SDL_DFB_FREE(texture->driverdata);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
556 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
557 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
558
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
559 static int
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
560 DirectFB_QueryTexturePixels(SDL_Renderer * renderer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
561 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
562 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
563 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
564 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
565
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
566 if (texturedata->display) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
567 return -1;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
568 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
569 *pixels = texturedata->pixels;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
570 *pitch = texturedata->pitch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
571 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
572 return 0;
2226
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
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
575 static int
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
576 DirectFB_SetTexturePalette(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
577 SDL_Texture * texture,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
578 const SDL_Color * colors, int firstcolor,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
579 int ncolors)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
580 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
581 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
582 if (SDL_ISPIXELFORMAT_INDEXED(data->format)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
583 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
584 DFBColor entries[256];
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
585 int i;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
586
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
587 if (ncolors > 256)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
588 ncolors = 256;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
589
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
590 for (i = 0; i < ncolors; ++i) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
591 entries[i].r = colors[i].r;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
592 entries[i].g = colors[i].g;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
593 entries[i].b = colors[i].b;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
594 entries[i].a = 0xff;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
595 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
596 SDL_DFB_CHECKERR(data->
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
597 palette->SetEntries(data->palette, entries, ncolors, firstcolor));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
598 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
599 } else {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
600 SDL_SetError("YUV textures don't have a palette");
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
601 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
602 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
603 error:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
604 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
605 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
606
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
607 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
608 DirectFB_GetTexturePalette(SDL_Renderer * renderer,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
609 SDL_Texture * texture, SDL_Color * colors,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
610 int firstcolor, int ncolors)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
611 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
612 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
613
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
614 if (SDL_ISPIXELFORMAT_INDEXED(data->format)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
615 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
616 DFBColor entries[256];
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
617 int i;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
618
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
619 SDL_DFB_CHECKERR(data->
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
620 palette->GetEntries(data->palette, entries, ncolors,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
621 firstcolor));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
622
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
623 for (i = 0; i < ncolors; ++i) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
624 colors[i].r = entries[i].r;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
625 colors[i].g = entries[i].g;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
626 colors[i].b = entries[i].b;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
627 colors->unused = SDL_ALPHA_OPAQUE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
628 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
629 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
630 } else {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
631 SDL_SetError("YUV textures don't have a palette");
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
632 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
633 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
634 error:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
635 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
636 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
637
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
638 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
639 DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
640 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
641 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
642 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
643
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
644 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
645 DirectFB_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
646 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
647 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
648 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
649
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
650 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
651 DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
652 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
653 switch (texture->blendMode) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
654 case SDL_BLENDMODE_NONE:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
655 //case SDL_BLENDMODE_MASK:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
656 case SDL_BLENDMODE_BLEND:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
657 case SDL_BLENDMODE_ADD:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
658 case SDL_BLENDMODE_MOD:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
659 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
660 default:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
661 SDL_Unsupported();
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
662 texture->blendMode = SDL_BLENDMODE_NONE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
663 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
664 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
665 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
666
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
667 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
668 DirectFB_SetDrawBlendMode(SDL_Renderer * renderer)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
669 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
670 switch (renderer->blendMode) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
671 case SDL_BLENDMODE_NONE:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
672 //case SDL_BLENDMODE_MASK:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
673 case SDL_BLENDMODE_BLEND:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
674 case SDL_BLENDMODE_ADD:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
675 case SDL_BLENDMODE_MOD:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
676 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
677 default:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
678 SDL_Unsupported();
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
679 renderer->blendMode = SDL_BLENDMODE_NONE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
680 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
681 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
682 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
683
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
684 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
685 static int
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
686 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
687 {
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
688 #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
689
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
690 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
691
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
692 switch (texture->scaleMode) {
4929
aa8888658021 Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
693 case SDL_SCALEMODE_NONE:
aa8888658021 Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
694 case SDL_SCALEMODE_FAST:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
695 data->render_options = DSRO_NONE;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
696 break;
4929
aa8888658021 Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
697 case SDL_SCALEMODE_SLOW:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
698 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
699 break;
4929
aa8888658021 Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
700 case SDL_SCALEMODE_BEST:
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
701 data->render_options =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
702 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
703 break;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
704 default:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
705 SDL_Unsupported();
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
706 data->render_options = DSRO_NONE;
4929
aa8888658021 Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents: 4636
diff changeset
707 texture->scaleMode = SDL_SCALEMODE_NONE;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
708 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
709 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
710 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
711 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
712 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
713 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
714
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
715 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
716 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
717 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
718 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
719 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
720 Uint8 *dpixels;
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
721 int dpitch;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
722 Uint8 *src, *dst;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
723 int row;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
724 size_t length;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
725 int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
726 // 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
727
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
728 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
729
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
730 if ((texture->format == SDL_PIXELFORMAT_YV12) ||
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
731 (texture->format == SDL_PIXELFORMAT_IYUV)) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
732 bpp = 1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
733 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
734
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
735 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
736 DSLF_WRITE | DSLF_READ,
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2244
diff changeset
737 ((void **) &dpixels), &dpitch));
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
738 src = (Uint8 *) pixels;
2930
8acbb14124c5 Date: Mon, 29 Dec 2008 23:29:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2927
diff changeset
739 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
740 length = rect->w * bpp;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
741 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
742 SDL_memcpy(dst, src, length);
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
743 src += pitch;
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
744 dst += dpitch;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
745 }
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
746 /* copy other planes for 3 plane formats */
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
747 if ((texture->format == SDL_PIXELFORMAT_YV12) ||
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
748 (texture->format == SDL_PIXELFORMAT_IYUV)) {
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
749 src = (Uint8 *) pixels + texture->h * pitch;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
750 dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
751 for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
752 SDL_memcpy(dst, src, length / 2);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
753 src += pitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
754 dst += dpitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
755 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
756 src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
757 dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
758 for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
3335
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
759 SDL_memcpy(dst, src, length / 2);
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
760 src += pitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
761 dst += dpitch / 2;
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
762 }
b8d313de8a65 Adam Strzelecki to SDL
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
763 }
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
764 SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
765 data->isDirty = 0;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
766 return 0;
2244
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
767 error:
Sam Lantinga <slouken@libsdl.org>
parents: 2241
diff changeset
768 return 1;
2241
4932f192c565 Date: Wed, 15 Aug 2007 01:08:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
769
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
770 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
771
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
772 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
773 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
774 const SDL_Rect * rect, void **pixels, int *pitch)
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
775 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
776 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
777 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
778
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
779 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
780
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
781 #if 0
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
782 if (markDirty) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
783 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
784 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
785 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
786
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
787 if (texturedata->display) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
788 void *fdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
789 int fpitch;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
790
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
791 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
792 DSLF_WRITE | DSLF_READ,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
793 &fdata, &fpitch));
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
794 *pitch = fpitch;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
795 *pixels = fdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
796 } else {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
797 *pixels =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
798 (void *) ((Uint8 *) texturedata->pixels +
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
799 rect->y * texturedata->pitch +
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
800 rect->x * DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format)));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
801 *pitch = texturedata->pitch;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
802 texturedata->isDirty = 1;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
803 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
804 return 0;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
805
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
806 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
807 return -1;
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
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
810 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
811 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
812 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
813 DirectFB_TextureData *texturedata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
814 (DirectFB_TextureData *) texture->driverdata;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
815
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
816 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
817
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
818 if (texturedata->display) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
819 SDL_DFB_CHECK(texturedata->surface->Unlock(texturedata->surface));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
820 texturedata->pixels = NULL;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
821 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
822 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
823
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
824 #if 0
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
825 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
826 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
827 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
828 {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
829 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
830 int i;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
831
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
832 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
833 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
834 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
835 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
836 #endif
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
837
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
838 static int
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
839 PrepareDraw(SDL_Renderer * renderer)
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
840 {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
841 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
842 SDL_DFB_WINDOWSURFACE(data->window);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
843
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
844 Uint8 r, g, b, a;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
845
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
846 r = renderer->r;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
847 g = renderer->g;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
848 b = renderer->b;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
849 a = renderer->a;
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 SetBlendMode(data, renderer->blendMode, NULL);
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
852 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
853
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
854 switch (renderer->blendMode) {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
855 case SDL_BLENDMODE_NONE:
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
856 //case SDL_BLENDMODE_MASK:
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
857 case SDL_BLENDMODE_BLEND:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
858 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
859 case SDL_BLENDMODE_ADD:
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
860 case SDL_BLENDMODE_MOD:
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
861 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
862 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
863 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
864 a = 255;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
865 break;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
866 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
867
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
868 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
869 return 0;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
870 error:
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
871 return -1;
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
872 }
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
873
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
874 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
875 const SDL_Point * points, int count)
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
876 {
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
877 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
878 SDL_DFB_WINDOWSURFACE(data->window);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
879 int i;
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
880
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
881 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
882
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
883 PrepareDraw(renderer);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
884 for (i=0; i < count; i++)
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
885 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y));
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
886 return 0;
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
887 error:
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
888 return -1;
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
889 }
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
890
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
891 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
892 const SDL_Point * points, int count)
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
893 {
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
894 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
895 SDL_DFB_WINDOWSURFACE(data->window);
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
896 int i;
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
897
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
898 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
899
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
900 PrepareDraw(renderer);
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
901 /* Use antialiasing when available */
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
902 #if (DFB_VERSION_ATLEAST(1,2,0))
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
903 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
904 #endif
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
905
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
906 for (i=0; i < count - 1; i++)
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
907 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i+1].x, points[i+1].y));
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
908
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
909 return 0;
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
910 error:
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
911 return -1;
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
912 }
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
913
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2884
diff changeset
914 static int
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
915 DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
916 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
917 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
918 SDL_DFB_WINDOWSURFACE(data->window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
919 int i;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
920
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
921 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
922
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
923 PrepareDraw(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
924
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
925 for (i=0; i<count; i++)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
926 SDL_DFB_CHECKERR(destsurf->DrawRectangle(destsurf, rects[i]->x, rects[i]->y,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
927 rects[i]->w, rects[i]->h));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
928
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
929 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
930 error:
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
931 return -1;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
932 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
933
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
934 static int
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
935 DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
936 {
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
937 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
938 SDL_DFB_WINDOWSURFACE(data->window);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
939 int i;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
940
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
941 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
942
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
943 PrepareDraw(renderer);
3640
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
944
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
945 for (i=0; i<count; i++)
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
946 SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rects[i]->x, rects[i]->y,
58c1b9ec7074 DirectFB driver compiles again
Couriersud <couriersud@arcor.de>
parents: 3520
diff changeset
947 rects[i]->w, rects[i]->h));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
948
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
949 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
950 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
951 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
952 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
953
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
954 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
955 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
956 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
957 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
958 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
959 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
960 DirectFB_TextureData *texturedata =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
961 (DirectFB_TextureData *) texture->driverdata;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
962 Uint8 alpha, r, g, b;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
963
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
964 DirectFB_ActivateRenderer(renderer);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
965
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
966 if (texturedata->display) {
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
967 int px, py;
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
968 SDL_Window *window = renderer->window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
969 SDL_DFB_WINDOWDATA(window);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
970 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
971 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
972
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
973 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
974 vidlayer->SetSourceRectangle(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
975 srcrect->x, srcrect->y,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
976 srcrect->w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
977 srcrect->h));
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
978 SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, &px, &py));
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
979 px += windata->client.x;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
980 py += windata->client.y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
981 SDL_DFB_CHECKERR(dispdata->
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
982 vidlayer->SetScreenRectangle(dispdata->vidlayer,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
983 px + dstrect->x,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
984 py + dstrect->y,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
985 dstrect->w,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
986 dstrect->h));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
987 } else {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
988 DFBRectangle sr, dr;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
989 DFBSurfaceBlittingFlags flags = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
990
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
991 #if 0
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
992 if (texturedata->dirty.list) {
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
993 SDL_DirtyRect *dirty;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
994 void *pixels;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
995 int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
996 int pitch = texturedata->pitch;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
997
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
998 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
999 SDL_Rect *rect = &dirty->rect;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1000 pixels =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1001 (void *) ((Uint8 *) texturedata->pixels +
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1002 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
1003 DirectFB_UpdateTexture(renderer, texture, rect,
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1004 pixels,
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1005 texturedata->pitch);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1006 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1007 SDL_ClearDirtyRects(&texturedata->dirty);
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1008 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1009 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1010 if (texturedata->isDirty)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1011 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1012 SDL_Rect rect;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1013
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1014 rect.x = 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1015 rect.y = 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1016 rect.w = texture->w;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1017 rect.h = texture->h;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1018
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1019 DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1020 }
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1021
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1022 SDLtoDFBRect(srcrect, &sr);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1023 SDLtoDFBRect(dstrect, &dr);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1024
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1025 alpha = r = g = b = 0xff;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1026 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1027 alpha = texture->a;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1028 flags |= DSBLIT_BLEND_COLORALPHA;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1029 }
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1030
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1031 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1032 r = texture->r;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1033 g = texture->g;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1034 b = texture->b;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1035 flags |= DSBLIT_COLORIZE;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1036 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1037 SDL_DFB_CHECKERR(destsurf->
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1038 SetColor(destsurf, r, g, b, alpha));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1039
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1040 // ???? flags |= DSBLIT_SRC_PREMULTCOLOR;
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1041
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1042 SetBlendMode(data, texture->blendMode, texturedata);
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1043
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
1044 SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1045 data->blitFlags | flags));
2884
9dde605c7540 Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
1046
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
1047 #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
1048 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1049 texturedata->
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1050 render_options));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1051 #endif
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1052
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1053 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
1054 SDL_DFB_CHECKERR(destsurf->Blit(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1055 texturedata->surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1056 &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
1057 } else {
3038
c73a5f8a03d2 Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
Couriersud <couriersud@arcor.de>
parents: 3037
diff changeset
1058 SDL_DFB_CHECKERR(destsurf->StretchBlit(destsurf,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1059 texturedata->surface,
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1060 &sr, &dr));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1061 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1062 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1063 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1064 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1065 return -1;
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 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1069 DirectFB_RenderPresent(SDL_Renderer * renderer)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1070 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1071 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
1072 SDL_Window *window = renderer->window;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
1073 SDL_DFB_WINDOWDATA(window);
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1074 SDL_ShapeData *shape_data = (window->shaper ? window->shaper->driverdata : NULL);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1075
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1076 DirectFB_ActivateRenderer(renderer);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1077
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1078 if (shape_data && shape_data->surface) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1079 /* saturate the window surface alpha channel */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1080 SDL_DFB_CHECK(windata->window_surface->SetSrcBlendFunction(windata->window_surface, DSBF_ONE));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1081 SDL_DFB_CHECK(windata->window_surface->SetDstBlendFunction(windata->window_surface, DSBF_ONE));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1082 SDL_DFB_CHECK(windata->window_surface->SetDrawingFlags(windata->window_surface, DSDRAW_BLEND));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1083 SDL_DFB_CHECK(windata->window_surface->SetColor(windata->window_surface, 0, 0, 0, 0xff));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1084 SDL_DFB_CHECK(windata->window_surface->FillRectangle(windata->window_surface, 0,0, windata->size.w, windata->size.h));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1085
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1086 /* blit the mask */
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1087 SDL_DFB_CHECK(windata->surface->SetSrcBlendFunction(windata->surface, DSBF_DESTCOLOR));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1088 SDL_DFB_CHECK(windata->surface->SetDstBlendFunction(windata->surface, DSBF_ZERO));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1089 SDL_DFB_CHECK(windata->surface->SetBlittingFlags(windata->surface, DSBLIT_BLEND_ALPHACHANNEL));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1090 #if (DFB_VERSION_ATLEAST(1,2,0))
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1091 SDL_DFB_CHECK(windata->surface->SetRenderOptions(windata->surface, DSRO_NONE));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1092 #endif
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1093 SDL_DFB_CHECK(windata->surface->Blit(windata->surface, shape_data->surface, NULL, 0, 0));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1094 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1095
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1096 /* Send the data to the display */
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
1097 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
1098 data->flipflags));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1099 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1100
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1101 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1102 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
1103 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1104 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
1105
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1106 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1107
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1108 if (!data) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1109 return;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1110 }
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1111 //SDL_FreeDirtyRects(&data->dirty);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1112 SDL_DFB_RELEASE(data->palette);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1113 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
1114 if (data->display) {
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1115 DFB_DisplayData *dispdata =
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1116 (DFB_DisplayData *) data->display->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1117 dispdata->vidIDinuse = 0;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
1118 /* FIXME: Shouldn't we reset the cooperative level */
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
1119 SDL_DFB_CHECK(dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer,
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
1120 DLSCL_ADMINISTRATIVE));
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1121 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
1122 }
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2722
diff changeset
1123 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
1124 SDL_free(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1125 texture->driverdata = NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1126 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1127
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1128 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1129 DirectFB_DestroyRenderer(SDL_Renderer * renderer)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1130 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1131 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1132 SDL_VideoDisplay *display = renderer->window->display;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1133
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1134 #if 0
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1135 if (display->palette) {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1136 SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, data);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1137 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1138 #endif
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3038
diff changeset
1139
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1140 if (data) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1141 SDL_free(data);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1142 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1143 SDL_free(renderer);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1144 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1145
5202
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1146 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1147 DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1148 Uint32 format, void * pixels, int pitch)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1149 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1150 SDL_Window *window = renderer->window;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1151 SDL_DFB_WINDOWDATA(window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1152 Uint32 sdl_format;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1153 void * laypixels;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1154 int laypitch;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1155 DFBSurfacePixelFormat dfb_format;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1156
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1157 DirectFB_ActivateRenderer(renderer);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1158
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1159 SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1160 sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1161 SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_READ, (void **) &laypixels, &laypitch));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1162
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1163 laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1164 SDL_ConvertPixels(rect->w, rect->h,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1165 sdl_format, laypixels, laypitch,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1166 format, pixels, pitch);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1167
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1168 SDL_DFB_CHECK(windata->surface->Unlock(windata->surface));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1169
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1170 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1171 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1172
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1173 static int
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1174 DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1175 Uint32 format, const void * pixels, int pitch)
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1176 {
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1177 SDL_Window *window = renderer->window;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1178 SDL_DFB_WINDOWDATA(window);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1179 Uint32 sdl_format;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1180 void * laypixels;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1181 int laypitch;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1182 DFBSurfacePixelFormat dfb_format;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1183
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1184 SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1185 sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1186
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1187 SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_WRITE, (void **) &laypixels, &laypitch));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1188
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1189 laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1190 SDL_ConvertPixels(rect->w, rect->h,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1191 format, pixels, pitch,
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1192 sdl_format, laypixels, laypitch);
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1193
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1194 SDL_DFB_CHECK(windata->surface->Unlock(windata->surface));
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1195
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1196 return 0;
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1197 }
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1198
164f20ba08eb Updated the DirectFB support, from Couriersud
Sam Lantinga <slouken@libsdl.org>
parents: 5157
diff changeset
1199
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1200 /* vi: set ts=4 sw=4 expandtab: */