SDL 2.0
SDL_DirectFB_render.c
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "../../SDL_internal.h"
22
23#if SDL_VIDEO_DRIVER_DIRECTFB
24#include "SDL_DirectFB_window.h"
25#include "SDL_DirectFB_modes.h"
26
27#include "SDL_syswm.h"
28#include "SDL_DirectFB_shape.h"
29
30#include "../SDL_sysvideo.h"
31#include "../../render/SDL_sysrender.h"
32
33#ifndef DFB_VERSION_ATLEAST
34
35#define DFB_VERSIONNUM(X, Y, Z) \
36 ((X)*1000 + (Y)*100 + (Z))
37
38#define DFB_COMPILEDVERSION \
39 DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
40
41#define DFB_VERSION_ATLEAST(X, Y, Z) \
42 (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
43
44#define SDL_DFB_CHECK(x) x
45
46#endif
47
48/* the following is not yet tested ... */
49#define USE_DISPLAY_PALETTE (0)
50
51
52#define SDL_DFB_RENDERERDATA(rend) DirectFB_RenderData *renddata = ((rend) ? (DirectFB_RenderData *) (rend)->driverdata : NULL)
53#define SDL_DFB_WINDOWSURFACE(win) IDirectFBSurface *destsurf = ((DFB_WindowData *) ((win)->driverdata))->surface;
54
55typedef struct
56{
58 DFBSurfaceFlipFlags flipflags;
59 int size_changed;
60 int lastBlendMode;
61 DFBSurfaceBlittingFlags blitFlags;
62 DFBSurfaceDrawingFlags drawFlags;
63 IDirectFBSurface* target;
64} DirectFB_RenderData;
65
66typedef struct
67{
68 IDirectFBSurface *surface;
70 void *pixels;
71 int pitch;
72 IDirectFBPalette *palette;
73 int isDirty;
74
75 SDL_VideoDisplay *display; /* only for yuv textures */
76
77#if (DFB_VERSION_ATLEAST(1,2,0))
78 DFBSurfaceRenderOptions render_options;
79#endif
80} DirectFB_TextureData;
81
82static SDL_INLINE void
83SDLtoDFBRect(const SDL_Rect * sr, DFBRectangle * dr)
84{
85 dr->x = sr->x;
86 dr->y = sr->y;
87 dr->h = sr->h;
88 dr->w = sr->w;
89}
90static SDL_INLINE void
91SDLtoDFBRect_Float(const SDL_FRect * sr, DFBRectangle * dr)
92{
93 dr->x = sr->x;
94 dr->y = sr->y;
95 dr->h = sr->h;
96 dr->w = sr->w;
97}
98
99
100static int
101TextureHasAlpha(DirectFB_TextureData * data)
102{
103 /* Drawing primitive ? */
104 if (!data)
105 return 0;
106
107 return (DFB_PIXELFORMAT_HAS_ALPHA(DirectFB_SDLToDFBPixelFormat(data->format)) ? 1 : 0);
108#if 0
109 switch (data->format) {
119 return 1;
120 default:
121 return 0;
122 }
123#endif
124}
125
126static SDL_INLINE IDirectFBSurface *get_dfb_surface(SDL_Window *window)
127{
128 SDL_SysWMinfo wm_info;
129 SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
130
131 SDL_VERSION(&wm_info.version);
132 if (!SDL_GetWindowWMInfo(window, &wm_info)) {
133 return NULL;
134 }
135
136 return wm_info.info.dfb.surface;
137}
138
139static SDL_INLINE IDirectFBWindow *get_dfb_window(SDL_Window *window)
140{
141 SDL_SysWMinfo wm_info;
142 SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
143
144 SDL_VERSION(&wm_info.version);
145 if (!SDL_GetWindowWMInfo(window, &wm_info)) {
146 return NULL;
147 }
148
149 return wm_info.info.dfb.window;
150}
151
152static void
153SetBlendMode(DirectFB_RenderData * data, int blendMode,
154 DirectFB_TextureData * source)
155{
156 IDirectFBSurface *destsurf = data->target;
157
158 /* FIXME: check for format change */
159 if (1 || data->lastBlendMode != blendMode) {
160 switch (blendMode) {
162 /**< No blending */
163 data->blitFlags = DSBLIT_NOFX;
164 data->drawFlags = DSDRAW_NOFX;
165 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
166 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO));
167 break;
168#if 0
169 case SDL_BLENDMODE_MASK:
170 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
171 data->drawFlags = DSDRAW_BLEND;
172 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
173 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA));
174 break;
175#endif
177 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
178 data->drawFlags = DSDRAW_BLEND;
179 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
180 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA));
181 break;
183 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
184 data->drawFlags = DSDRAW_BLEND;
185 /* FIXME: SRCALPHA kills performance on radeon ...
186 * It will be cheaper to copy the surface to a temporary surface and premultiply
187 */
188 if (source && TextureHasAlpha(source))
189 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
190 else
191 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
192 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ONE));
193 break;
195 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
196 data->drawFlags = DSDRAW_BLEND;
197 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ZERO));
198 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_SRCCOLOR));
199
200 break;
201 }
202 data->lastBlendMode = blendMode;
203 }
204}
205
206static int
207PrepareDraw(SDL_Renderer * renderer, const SDL_RenderCommand *cmd)
208{
209 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
210 IDirectFBSurface *destsurf = data->target;
211 Uint8 r = cmd->data.draw.r;
212 Uint8 g = cmd->data.draw.g;
213 Uint8 b = cmd->data.draw.b;
214 Uint8 a = cmd->data.draw.a;
215
216 SetBlendMode(data, cmd->data.draw.blend, NULL);
217 SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf, data->drawFlags));
218
219 switch (renderer->blendMode) {
221 /* case SDL_BLENDMODE_MASK: */
223 break;
226 r = ((int) r * (int) a) / 255;
227 g = ((int) g * (int) a) / 255;
228 b = ((int) b * (int) a) / 255;
229 a = 255;
230 break;
231 case SDL_BLENDMODE_INVALID: break;
232 }
233
234 SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, r, g, b, a));
235 return 0;
236 error:
237 return -1;
238}
239
240static void
241DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
242{
243 SDL_DFB_RENDERERDATA(renderer);
244
245 if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
246 /* Rebind the context to the window area and update matrices */
247 /* SDL_CurrentContext = NULL; */
248 /* data->updateSize = SDL_TRUE; */
249 renddata->size_changed = SDL_TRUE;
250 }
251}
252
253static void
254DirectFB_ActivateRenderer(SDL_Renderer * renderer)
255{
256 SDL_DFB_RENDERERDATA(renderer);
257
258 if (renddata->size_changed /* || windata->wm_needs_redraw */) {
259 renddata->size_changed = SDL_FALSE;
260 }
261}
262
263static int
264DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
265{
268 SDL_DFB_DEVICEDATA(display->device);
269 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
270 DirectFB_TextureData *data = texture->driverdata;
271 DFBDisplayLayerConfig layconf;
272 DFBResult ret;
273
274 if (devdata->use_yuv_direct && (dispdata->vidID >= 0)
275 && (!dispdata->vidIDinuse)
276 && SDL_ISPIXELFORMAT_FOURCC(data->format)) {
277 layconf.flags =
278 DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
279 DLCONF_SURFACE_CAPS;
280 layconf.width = texture->w;
281 layconf.height = texture->h;
282 layconf.pixelformat = DirectFB_SDLToDFBPixelFormat(data->format);
283 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE;
284
285 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
286 dispdata->vidID,
287 &dispdata->vidlayer));
288 SDL_DFB_CHECKERR(dispdata->
289 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
290 DLSCL_EXCLUSIVE));
291
292 if (devdata->use_yuv_underlays) {
293 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1);
294 if (ret != DFB_OK)
295 SDL_DFB_DEBUG("Underlay Setlevel not supported\n");
296 }
297 SDL_DFB_CHECKERR(dispdata->
298 vidlayer->SetConfiguration(dispdata->vidlayer,
299 &layconf));
300 SDL_DFB_CHECKERR(dispdata->
301 vidlayer->GetSurface(dispdata->vidlayer,
302 &data->surface));
303 dispdata->vidIDinuse = 1;
304 data->display = display;
305 return 0;
306 }
307 return 1;
308 error:
309 if (dispdata->vidlayer) {
310 SDL_DFB_RELEASE(data->surface);
311 SDL_DFB_CHECKERR(dispdata->
312 vidlayer->SetCooperativeLevel(dispdata->vidlayer,
313 DLSCL_ADMINISTRATIVE));
314 SDL_DFB_RELEASE(dispdata->vidlayer);
315 }
316 return 1;
317}
318
319static int
320DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
321{
324 SDL_DFB_DEVICEDATA(display->device);
325 DirectFB_TextureData *data;
326 DFBSurfaceDescription dsc;
327 DFBSurfacePixelFormat pixelformat;
328
329 DirectFB_ActivateRenderer(renderer);
330
331 SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
332 texture->driverdata = data;
333
334 /* find the right pixelformat */
335 pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format);
336 if (pixelformat == DSPF_UNKNOWN) {
337 SDL_SetError("Unknown pixel format %d", data->format);
338 goto error;
339 }
340
341 data->format = texture->format;
342 data->pitch = texture->w * DFB_BYTES_PER_PIXEL(pixelformat);
343
344 if (DirectFB_AcquireVidLayer(renderer, texture) != 0) {
345 /* fill surface description */
346 dsc.flags =
347 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
348 dsc.width = texture->w;
349 dsc.height = texture->h;
350 if(texture->format == SDL_PIXELFORMAT_YV12 ||
351 texture->format == SDL_PIXELFORMAT_IYUV) {
352 /* dfb has problems with odd sizes -make them even internally */
353 dsc.width += (dsc.width % 2);
354 dsc.height += (dsc.height % 2);
355 }
356 /* <1.2 Never use DSCAPS_VIDEOONLY here. It kills performance
357 * No DSCAPS_SYSTEMONLY either - let dfb decide
358 * 1.2: DSCAPS_SYSTEMONLY boosts performance by factor ~8
359 * Depends on other settings as well. Let dfb decide.
360 */
361 dsc.caps = DSCAPS_PREMULTIPLIED;
362#if 0
364 dsc.caps |= DSCAPS_SYSTEMONLY;
365 else
366 dsc.caps |= DSCAPS_VIDEOONLY;
367#endif
368
369 dsc.pixelformat = pixelformat;
370 data->pixels = NULL;
371
372 /* Create the surface */
373 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
374 &data->surface));
376 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
377#if 1
378 SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &data->palette));
379#else
380 /* DFB has issues with blitting LUT8 surfaces.
381 * Creating a new palette does not help.
382 */
383 DFBPaletteDescription pal_desc;
384 pal_desc.flags = DPDESC_SIZE; /* | DPDESC_ENTRIES */
385 pal_desc.size = 256;
386 SDL_DFB_CHECKERR(devdata->dfb->CreatePalette(devdata->dfb, &pal_desc,&data->palette));
387 SDL_DFB_CHECKERR(data->surface->SetPalette(data->surface, data->palette));
388#endif
389 }
390
391 }
392#if (DFB_VERSION_ATLEAST(1,2,0))
393 data->render_options = DSRO_NONE;
394#endif
395 if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
396 /* 3 plane YUVs return 1 bpp, but we need more space for other planes */
397 if(texture->format == SDL_PIXELFORMAT_YV12 ||
398 texture->format == SDL_PIXELFORMAT_IYUV) {
399 SDL_DFB_ALLOC_CLEAR(data->pixels, (texture->h * data->pitch + ((texture->h + texture->h % 2) * (data->pitch + data->pitch % 2) * 2) / 4));
400 } else {
401 SDL_DFB_ALLOC_CLEAR(data->pixels, texture->h * data->pitch);
402 }
403 }
404
405 return 0;
406
407 error:
408 SDL_DFB_RELEASE(data->palette);
409 SDL_DFB_RELEASE(data->surface);
410 SDL_DFB_FREE(texture->driverdata);
411 return -1;
412}
413
414#if 0
415static int
416DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
417{
418#if (DFB_VERSION_ATLEAST(1,2,0))
419
420 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
421
422 switch (texture->scaleMode) {
423 case SDL_SCALEMODE_NONE:
424 case SDL_SCALEMODE_FAST:
425 data->render_options = DSRO_NONE;
426 break;
427 case SDL_SCALEMODE_SLOW:
428 data->render_options = DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE;
429 break;
430 case SDL_SCALEMODE_BEST:
431 data->render_options =
432 DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE | DSRO_ANTIALIAS;
433 break;
434 default:
435 data->render_options = DSRO_NONE;
436 texture->scaleMode = SDL_SCALEMODE_NONE;
437 return SDL_Unsupported();
438 }
439#endif
440 return 0;
441}
442#endif
443
444static int
445DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
446 const SDL_Rect * rect, const void *pixels, int pitch)
447{
448 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
449 Uint8 *dpixels;
450 int dpitch;
451 Uint8 *src, *dst;
452 int row;
453 size_t length;
454 int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
455 /* FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes */
456
457 DirectFB_ActivateRenderer(renderer);
458
459 if ((texture->format == SDL_PIXELFORMAT_YV12) ||
460 (texture->format == SDL_PIXELFORMAT_IYUV)) {
461 bpp = 1;
462 }
463
464 SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
465 DSLF_WRITE | DSLF_READ,
466 ((void **) &dpixels), &dpitch));
467 src = (Uint8 *) pixels;
468 dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
469 length = rect->w * bpp;
470 for (row = 0; row < rect->h; ++row) {
472 src += pitch;
473 dst += dpitch;
474 }
475 /* copy other planes for 3 plane formats */
476 if ((texture->format == SDL_PIXELFORMAT_YV12) ||
477 (texture->format == SDL_PIXELFORMAT_IYUV)) {
478 src = (Uint8 *) pixels + texture->h * pitch;
479 dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
480 for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
481 SDL_memcpy(dst, src, length / 2);
482 src += pitch / 2;
483 dst += dpitch / 2;
484 }
485 src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
486 dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
487 for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
488 SDL_memcpy(dst, src, length / 2);
489 src += pitch / 2;
490 dst += dpitch / 2;
491 }
492 }
493 SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
494 data->isDirty = 0;
495 return 0;
496 error:
497 return 1;
498
499}
500
501static int
502DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
503 const SDL_Rect * rect, void **pixels, int *pitch)
504{
505 DirectFB_TextureData *texturedata =
506 (DirectFB_TextureData *) texture->driverdata;
507
508 DirectFB_ActivateRenderer(renderer);
509
510#if 0
511 if (markDirty) {
512 SDL_AddDirtyRect(&texturedata->dirty, rect);
513 }
514#endif
515
516 if (texturedata->display) {
517 void *fdata;
518 int fpitch;
519
520 SDL_DFB_CHECKERR(texturedata->surface->Lock(texturedata->surface,
521 DSLF_WRITE | DSLF_READ,
522 &fdata, &fpitch));
523 *pitch = fpitch;
524 *pixels = fdata;
525 } else {
526 *pixels =
527 (void *) ((Uint8 *) texturedata->pixels +
528 rect->y * texturedata->pitch +
529 rect->x * DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format)));
530 *pitch = texturedata->pitch;
531 texturedata->isDirty = 1;
532 }
533 return 0;
534
535 error:
536 return -1;
537}
538
539static void
540DirectFB_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
541{
542 DirectFB_TextureData *texturedata =
543 (DirectFB_TextureData *) texture->driverdata;
544
545 DirectFB_ActivateRenderer(renderer);
546
547 if (texturedata->display) {
548 SDL_DFB_CHECK(texturedata->surface->Unlock(texturedata->surface));
549 texturedata->pixels = NULL;
550 }
551}
552
553#if 0
554static void
555DirectFB_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
556 int numrects, const SDL_Rect * rects)
557{
558 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
559 int i;
560
561 for (i = 0; i < numrects; ++i) {
562 SDL_AddDirtyRect(&data->dirty, &rects[i]);
563 }
564}
565#endif
566
567static int DirectFB_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
568{
569 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
570 DirectFB_TextureData *tex_data = NULL;
571
572 DirectFB_ActivateRenderer(renderer);
573 if (texture) {
574 tex_data = (DirectFB_TextureData *) texture->driverdata;
575 data->target = tex_data->surface;
576 } else {
577 data->target = get_dfb_surface(data->window);
578 }
579 data->lastBlendMode = 0;
580 return 0;
581}
582
583
584static int
585DirectFB_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd)
586{
587 return 0; /* nothing to do in this backend. */
588}
589
590static int
591DirectFB_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
592{
593 const size_t len = count * sizeof (SDL_FPoint);
595
596 if (!verts) {
597 return -1;
598 }
599
600 cmd->data.draw.count = count;
601 SDL_memcpy(verts, points, len);
602 return 0;
603}
604
605static int
606DirectFB_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
607{
608 const size_t len = count * sizeof (SDL_FRect);
610
611 if (!verts) {
612 return -1;
613 }
614
615 cmd->data.draw.count = count;
616 SDL_memcpy(verts, rects, count);
617 return 0;
618}
619
620static int
621DirectFB_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
622 const SDL_Rect * srcrect, const SDL_FRect * dstrect)
623{
624 DFBRectangle *verts = (DFBRectangle *) SDL_AllocateRenderVertices(renderer, 2 * sizeof (DFBRectangle), 0, &cmd->data.draw.first);
625
626 if (!verts) {
627 return -1;
628 }
629
630 cmd->data.draw.count = 1;
631
632 SDLtoDFBRect(srcrect, verts++);
633 SDLtoDFBRect_Float(dstrect, verts);
634
635 return 0;
636}
637
638static int
639DirectFB_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
640 const SDL_Rect * srcrect, const SDL_FRect * dstrect,
641 const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
642{
643 return SDL_Unsupported();
644}
645
646
647static int
648DirectFB_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
649{
650 /* !!! FIXME: there are probably some good optimization wins in here if someone wants to look it over. */
651 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
652 IDirectFBSurface *destsurf = data->target;
653 DFBRegion clip_region;
654 size_t i;
655
656 DirectFB_ActivateRenderer(renderer);
657
658 SDL_zero(clip_region); /* in theory, this always gets set before use. */
659
660 while (cmd) {
661 switch (cmd->command) {
663 break; /* not used here */
664
666 const SDL_Rect *viewport = &cmd->data.viewport.rect;
667 clip_region.x1 = viewport->x;
668 clip_region.y1 = viewport->y;
669 clip_region.x2 = clip_region.x1 + viewport->w - 1;
670 clip_region.y2 = clip_region.y1 + viewport->h - 1;
671 destsurf->SetClip(destsurf, &clip_region);
672 break;
673 }
674
676 /* !!! FIXME: how does this SetClip interact with the one in SETVIEWPORT? */
677 if (cmd->data.cliprect.enabled) {
678 const SDL_Rect *rect = &cmd->data.cliprect.rect;
679 clip_region.x1 = rect->x;
680 clip_region.x2 = rect->x + rect->w;
681 clip_region.y1 = rect->y;
682 clip_region.y2 = rect->y + rect->h;
683 destsurf->SetClip(destsurf, &clip_region);
684 }
685 break;
686 }
687
688 case SDL_RENDERCMD_CLEAR: {
689 const Uint8 r = cmd->data.color.r;
690 const Uint8 g = cmd->data.color.g;
691 const Uint8 b = cmd->data.color.b;
692 const Uint8 a = cmd->data.color.a;
693 destsurf->Clear(destsurf, r, g, b, a);
694 break;
695 }
696
698 const size_t count = cmd->data.draw.count;
699 const SDL_FPoint *points = (SDL_FPoint *) (((Uint8 *) vertices) + cmd->data.draw.first);
700 PrepareDraw(renderer, cmd);
701 for (i = 0; i < count; i++) {
702 const int x = points[i].x + clip_region.x1;
703 const int y = points[i].y + clip_region.y1;
704 destsurf->DrawLine(destsurf, x, y, x, y);
705 }
706 break;
707 }
708
710 const SDL_FPoint *points = (SDL_FPoint *) (((Uint8 *) vertices) + cmd->data.draw.first);
711 const size_t count = cmd->data.draw.count;
712
713 PrepareDraw(renderer, cmd);
714
715 #if (DFB_VERSION_ATLEAST(1,2,0)) /* !!! FIXME: should this be set once, somewhere else? */
716 destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS);
717 #endif
718
719 for (i = 0; i < count - 1; i++) {
720 const int x1 = points[i].x + clip_region.x1;
721 const int y1 = points[i].y + clip_region.y1;
722 const int x2 = points[i + 1].x + clip_region.x1;
723 const int y2 = points[i + 1].y + clip_region.y1;
724 destsurf->DrawLine(destsurf, x1, y1, x2, y2);
725 }
726 break;
727 }
728
730 const SDL_FRect *rects = (SDL_FRect *) (((Uint8 *) vertices) + cmd->data.draw.first);
731 const size_t count = cmd->data.draw.count;
732
733 PrepareDraw(renderer, cmd);
734
735 for (i = 0; i < count; i++, rects++) {
736 destsurf->FillRectangle(destsurf, rects->x + clip_region.x1, rects->y + clip_region.y1, rects->w, rects->h);
737 }
738 break;
739 }
740
741 case SDL_RENDERCMD_COPY: {
743 const Uint8 r = cmd->data.draw.r;
744 const Uint8 g = cmd->data.draw.g;
745 const Uint8 b = cmd->data.draw.b;
746 const Uint8 a = cmd->data.draw.a;
747 DFBRectangle *verts = (DFBRectangle *) (((Uint8 *) vertices) + cmd->data.draw.first);
748 DirectFB_TextureData *texturedata = (DirectFB_TextureData *) texture->driverdata;
749 DFBRectangle *sr = verts++;
750 DFBRectangle *dr = verts;
751
752 dr->x += clip_region.x1;
753 dr->y += clip_region.y1;
754
755 if (texturedata->display) {
756 int px, py;
758 IDirectFBWindow *dfbwin = get_dfb_window(window);
760 SDL_VideoDisplay *display = texturedata->display;
761 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
762
763 dispdata->vidlayer->SetSourceRectangle(dispdata->vidlayer, sr->x, sr->y, sr->w, sr->h);
764 dfbwin->GetPosition(dfbwin, &px, &py);
765 px += windata->client.x;
766 py += windata->client.y;
767 dispdata->vidlayer->SetScreenRectangle(dispdata->vidlayer, px + dr->x, py + dr->y, dr->w, dr->h);
768 } else {
769 DFBSurfaceBlittingFlags flags = 0;
770 if (texturedata->isDirty) {
771 const SDL_Rect rect = { 0, 0, texture->w, texture->h };
772 DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch);
773 }
774
775 if (a != 0xFF) {
776 flags |= DSBLIT_BLEND_COLORALPHA;
777 }
778
779 if ((r & g & b) != 0xFF) {
780 flags |= DSBLIT_COLORIZE;
781 }
782
783 destsurf->SetColor(destsurf, r, g, b, a);
784
785 /* ???? flags |= DSBLIT_SRC_PREMULTCOLOR; */
786
787 SetBlendMode(data, texture->blendMode, texturedata);
788
789 destsurf->SetBlittingFlags(destsurf, data->blitFlags | flags);
790
791#if (DFB_VERSION_ATLEAST(1,2,0))
792 destsurf->SetRenderOptions(destsurf, texturedata->render_options);
793#endif
794
795 if (sr->w == dr->w && sr->h == dr->h) {
796 destsurf->Blit(destsurf, texturedata->surface, sr, dr->x, dr->y);
797 } else {
798 destsurf->StretchBlit(destsurf, texturedata->surface, sr, dr);
799 }
800 }
801 break;
802 }
803
805 break; /* unsupported */
806
808 break;
809 }
810
811 cmd = cmd->next;
812 }
813
814 return 0;
815}
816
817
818static void
819DirectFB_RenderPresent(SDL_Renderer * renderer)
820{
821 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
824 SDL_ShapeData *shape_data = (window->shaper ? window->shaper->driverdata : NULL);
825
826 DirectFB_ActivateRenderer(renderer);
827
828 if (shape_data && shape_data->surface) {
829 /* saturate the window surface alpha channel */
830 SDL_DFB_CHECK(windata->window_surface->SetSrcBlendFunction(windata->window_surface, DSBF_ONE));
831 SDL_DFB_CHECK(windata->window_surface->SetDstBlendFunction(windata->window_surface, DSBF_ONE));
832 SDL_DFB_CHECK(windata->window_surface->SetDrawingFlags(windata->window_surface, DSDRAW_BLEND));
833 SDL_DFB_CHECK(windata->window_surface->SetColor(windata->window_surface, 0, 0, 0, 0xff));
834 SDL_DFB_CHECK(windata->window_surface->FillRectangle(windata->window_surface, 0,0, windata->size.w, windata->size.h));
835
836 /* blit the mask */
837 SDL_DFB_CHECK(windata->surface->SetSrcBlendFunction(windata->surface, DSBF_DESTCOLOR));
838 SDL_DFB_CHECK(windata->surface->SetDstBlendFunction(windata->surface, DSBF_ZERO));
839 SDL_DFB_CHECK(windata->surface->SetBlittingFlags(windata->surface, DSBLIT_BLEND_ALPHACHANNEL));
840#if (DFB_VERSION_ATLEAST(1,2,0))
841 SDL_DFB_CHECK(windata->surface->SetRenderOptions(windata->surface, DSRO_NONE));
842#endif
843 SDL_DFB_CHECK(windata->surface->Blit(windata->surface, shape_data->surface, NULL, 0, 0));
844 }
845
846 /* Send the data to the display */
847 SDL_DFB_CHECK(windata->window_surface->Flip(windata->window_surface, NULL,
848 data->flipflags));
849}
850
851static void
852DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
853{
854 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
855
856 DirectFB_ActivateRenderer(renderer);
857
858 if (!data) {
859 return;
860 }
861 SDL_DFB_RELEASE(data->palette);
862 SDL_DFB_RELEASE(data->surface);
863 if (data->display) {
864 DFB_DisplayData *dispdata =
865 (DFB_DisplayData *) data->display->driverdata;
866 dispdata->vidIDinuse = 0;
867 /* FIXME: Shouldn't we reset the cooperative level */
868 SDL_DFB_CHECK(dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer,
869 DLSCL_ADMINISTRATIVE));
870 SDL_DFB_RELEASE(dispdata->vidlayer);
871 }
872 SDL_DFB_FREE(data->pixels);
873 SDL_free(data);
874 texture->driverdata = NULL;
875}
876
877static void
878DirectFB_DestroyRenderer(SDL_Renderer * renderer)
879{
880 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
881#if 0
883 if (display->palette) {
884 SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, data);
885 }
886#endif
887
888 SDL_free(data);
890}
891
892static int
893DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
894 Uint32 format, void * pixels, int pitch)
895{
896 Uint32 sdl_format;
897 unsigned char* laypixels;
898 int laypitch;
899 DFBSurfacePixelFormat dfb_format;
900 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
901 IDirectFBSurface *winsurf = data->target;
902
903 DirectFB_ActivateRenderer(renderer);
904
905 winsurf->GetPixelFormat(winsurf, &dfb_format);
906 sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
907 winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch);
908
909 laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
911 sdl_format, laypixels, laypitch,
912 format, pixels, pitch);
913
914 winsurf->Unlock(winsurf);
915
916 return 0;
917}
918
919#if 0
920static int
921DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
922 Uint32 format, const void * pixels, int pitch)
923{
926 Uint32 sdl_format;
927 unsigned char* laypixels;
928 int laypitch;
929 DFBSurfacePixelFormat dfb_format;
930
931 SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format));
932 sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
933
934 SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_WRITE, (void **) &laypixels, &laypitch));
935
936 laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
938 format, pixels, pitch,
939 sdl_format, laypixels, laypitch);
940
941 SDL_DFB_CHECK(windata->surface->Unlock(windata->surface));
942
943 return 0;
944}
945#endif
946
947
949DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
950{
951 IDirectFBSurface *winsurf = get_dfb_surface(window);
952 /*SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);*/
954 DirectFB_RenderData *data = NULL;
955 DFBSurfaceCapabilities scaps;
956
957 if (!winsurf) {
958 return NULL;
959 }
960
962 SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
963
964 renderer->WindowEvent = DirectFB_WindowEvent;
965 renderer->CreateTexture = DirectFB_CreateTexture;
966 renderer->UpdateTexture = DirectFB_UpdateTexture;
967 renderer->LockTexture = DirectFB_LockTexture;
968 renderer->UnlockTexture = DirectFB_UnlockTexture;
969 renderer->QueueSetViewport = DirectFB_QueueSetViewport;
970 renderer->QueueSetDrawColor = DirectFB_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */
971 renderer->QueueDrawPoints = DirectFB_QueueDrawPoints;
972 renderer->QueueDrawLines = DirectFB_QueueDrawPoints; /* lines and points queue vertices the same way. */
973 renderer->QueueFillRects = DirectFB_QueueFillRects;
974 renderer->QueueCopy = DirectFB_QueueCopy;
975 renderer->QueueCopyEx = DirectFB_QueueCopyEx;
976 renderer->RunCommandQueue = DirectFB_RunCommandQueue;
977 renderer->RenderPresent = DirectFB_RenderPresent;
978
979 /* FIXME: Yet to be tested */
980 renderer->RenderReadPixels = DirectFB_RenderReadPixels;
981 /* renderer->RenderWritePixels = DirectFB_RenderWritePixels; */
982
983 renderer->DestroyTexture = DirectFB_DestroyTexture;
984 renderer->DestroyRenderer = DirectFB_DestroyRenderer;
985 renderer->SetRenderTarget = DirectFB_SetRenderTarget;
986
988 renderer->window = window; /* SDL window */
990
993
994 data->window = window;
995 data->target = winsurf;
996
997 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT;
998
1000 data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC;
1002 } else
1003 data->flipflags |= DSFLIP_ONSYNC;
1004
1005 SDL_DFB_CHECKERR(winsurf->GetCapabilities(winsurf, &scaps));
1006
1007#if 0
1008 if (scaps & DSCAPS_DOUBLE)
1009 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
1010 else if (scaps & DSCAPS_TRIPLE)
1011 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
1012 else
1013 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
1014#endif
1015
1017
1018#if 0
1019 /* Set up a palette watch on the display palette */
1020 if (display-> palette) {
1021 SDL_AddPaletteWatch(display->palette, DisplayPaletteChanged, data);
1022 }
1023#endif
1024
1025 return renderer;
1026
1027 error:
1030 return NULL;
1031}
1032
1033
1035 DirectFB_CreateRenderer,
1036 {
1037 "directfb",
1039 /* (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
1040 SDL_TEXTUREMODULATE_ALPHA),
1041 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND |
1042 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
1043 (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST |
1044 SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST), */
1045 0,
1046 {
1047 /* formats filled in later */
1048 },
1049 0,
1050 0}
1051};
1052
1053#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
1054
1055/* vi: set ts=4 sw=4 expandtab: */
#define SDL_DFB_DEBUG(x...)
#define SDL_DFB_CHECKERR(x...)
#define SDL_DFB_FREE(x)
#define SDL_DFB_ALLOC_CLEAR(r, s)
void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri)
#define SDL_DFB_CHECK(x...)
#define SDL_DFB_DEVICEDATA(dev)
#define SDL_DFB_RELEASE(x)
DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format)
Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
#define SDL_DFB_WINDOWDATA(win)
@ SDL_BLENDMODE_NONE
Definition: SDL_blendmode.h:42
@ SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
@ SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44
@ SDL_BLENDMODE_INVALID
Definition: SDL_blendmode.h:53
@ SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
#define SDL_SetError
#define SDL_memset
#define SDL_free
#define SDL_memcpy
#define SDL_ConvertPixels
#define SDL_GetWindowWMInfo
#define SDL_Unsupported()
Definition: SDL_error.h:53
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: SDL_opengl.h:1572
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
GLboolean GLboolean GLboolean b
struct _cl_event * event
GLfixed GLfixed GLint GLint GLfixed points
GLenum src
GLfixed GLfixed GLfixed y2
GLfixed y1
GLuint GLfloat GLfloat GLfloat x1
GLsizei GLsizei GLchar * source
GLenum GLsizei len
GLboolean GLboolean GLboolean GLboolean a
GLfixed GLfixed x2
GLenum GLenum dst
GLenum GLenum void * row
GLboolean GLboolean g
GLfloat angle
GLbitfield flags
GLenum GLenum GLuint texture
GLuint GLsizei GLsizei * length
GLenum target
#define SDL_BYTESPERPIXEL(X)
Definition: SDL_pixels.h:128
#define SDL_ISPIXELFORMAT_INDEXED(format)
Definition: SDL_pixels.h:134
@ SDL_PIXELFORMAT_INDEX4MSB
Definition: SDL_pixels.h:183
@ SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:251
@ SDL_PIXELFORMAT_ARGB1555
Definition: SDL_pixels.h:212
@ SDL_PIXELFORMAT_YV12
Definition: SDL_pixels.h:277
@ SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:254
@ SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:257
@ SDL_PIXELFORMAT_IYUV
Definition: SDL_pixels.h:279
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:248
@ SDL_PIXELFORMAT_ARGB4444
Definition: SDL_pixels.h:200
@ SDL_PIXELFORMAT_INDEX4LSB
Definition: SDL_pixels.h:180
@ SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:260
#define SDL_ISPIXELFORMAT_FOURCC(format)
Definition: SDL_pixels.h:167
void * SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes, const size_t alignment, size_t *offset)
Definition: SDL_render.c:284
@ SDL_RENDERER_ACCELERATED
Definition: SDL_render.h:67
@ SDL_RENDERER_PRESENTVSYNC
Definition: SDL_render.h:69
@ SDL_RENDERER_TARGETTEXTURE
Definition: SDL_render.h:71
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
Definition: SDL_render.h:112
@ SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:94
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
@ SDL_TRUE
Definition: SDL_stdinc.h:164
@ SDL_FALSE
Definition: SDL_stdinc.h:163
uint32_t Uint32
Definition: SDL_stdinc.h:203
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_RenderDriver DirectFB_RenderDriver
@ SDL_RENDERCMD_SETCLIPRECT
Definition: SDL_sysrender.h:76
@ SDL_RENDERCMD_DRAW_LINES
Definition: SDL_sysrender.h:80
@ SDL_RENDERCMD_SETVIEWPORT
Definition: SDL_sysrender.h:75
@ SDL_RENDERCMD_DRAW_POINTS
Definition: SDL_sysrender.h:79
@ SDL_RENDERCMD_NO_OP
Definition: SDL_sysrender.h:74
@ SDL_RENDERCMD_FILL_RECTS
Definition: SDL_sysrender.h:81
@ SDL_RENDERCMD_COPY
Definition: SDL_sysrender.h:82
@ SDL_RENDERCMD_CLEAR
Definition: SDL_sysrender.h:78
@ SDL_RENDERCMD_SETDRAWCOLOR
Definition: SDL_sysrender.h:77
@ SDL_RENDERCMD_COPY_EX
Definition: SDL_sysrender.h:83
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1089
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Definition: SDL_version.h:79
@ SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:156
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:167
#define SDL_INLINE
Definition: begin_code.h:134
EGLSurface surface
Definition: eglext.h:248
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
EGLSurface EGLint * rects
Definition: eglext.h:282
The structure that defines a point (floating point)
Definition: SDL_rect.h:61
A rectangle, with the origin at the upper left (floating point).
Definition: SDL_rect.h:88
float h
Definition: SDL_rect.h:92
float x
Definition: SDL_rect.h:89
float w
Definition: SDL_rect.h:91
float y
Definition: SDL_rect.h:90
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
int h
Definition: SDL_rect.h:80
int w
Definition: SDL_rect.h:80
int y
Definition: SDL_rect.h:79
int x
Definition: SDL_rect.h:79
union SDL_RenderCommand::@30 data
struct SDL_RenderCommand * next
struct SDL_RenderCommand::@30::@33 draw
struct SDL_RenderCommand::@30::@31 viewport
SDL_BlendMode blend
SDL_RenderCommandType command
Definition: SDL_sysrender.h:88
struct SDL_RenderCommand::@30::@32 cliprect
SDL_Texture * texture
struct SDL_RenderCommand::@30::@34 color
SDL_RendererInfo info
int(* QueueCopy)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
SDL_Window * window
int(* QueueDrawLines)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
void(* DestroyRenderer)(SDL_Renderer *renderer)
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
void(* RenderPresent)(SDL_Renderer *renderer)
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
int(* QueueDrawPoints)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
int(* QueueFillRects)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FRect *rects, int count)
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
int(* RunCommandQueue)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
int(* QueueCopyEx)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcquad, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* QueueSetViewport)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
SDL_RendererInfo info
void * driverdata
SDL_BlendMode blendMode
int(* QueueSetDrawColor)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
IDirectFBSurface * surface
union SDL_SysWMinfo::@17 info
struct wl_surface * surface
Definition: SDL_syswm.h:259
Window window
Definition: SDL_syswm.h:221
SDL_version version
Definition: SDL_syswm.h:199
SDL_VideoDevice * device
Definition: SDL_sysvideo.h:137
Window state change event data (event.window.*)
Definition: SDL_events.h:196
The type used to identify a window.
Definition: SDL_sysvideo.h:74
static SDL_Renderer * renderer
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
SDL_Rect rect
Definition: testrelative.c:27
SDL_Rect viewport
Definition: testviewport.c:28