annotate src/video/directfb/SDL_DirectFB_render.c @ 5144:31e7f523ab3d

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