21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_HAIKU 28 #include <InterfaceKit.h> 32 #include "../../main/haiku/SDL_BApp.h" 50 void **
pixels,
int *pitch) {
53 if(!bscreen.IsValid()) {
57 while(!bwin->
Connected()) { snooze(100); }
64 bscreen.GetMode(&bmode);
74 bitmap =
new BBitmap(bwin->Bounds(), (color_space)bmode.space,
78 if(bitmap->InitCheck() != B_OK) {
79 return SDL_SetError(
"Could not initialize back buffer!\n");
86 *pixels = bitmap->Bits();
89 *pitch = bitmap->BytesPerRow();
112 BE_UpdateOnce(window);
122 if(!bscreen.IsValid()) {
129 BBitmap *bitmap =
NULL;
131 int32 windowPitch = bitmap->BytesPerRow();
137 int32 windowSub = bwin->
GetFbX() * BPP +
138 bwin->
GetFbY() * windowPitch;
139 clipping_rect *clips = bwin->
GetClips();
144 bscreen.WaitForRetrace();
145 for(i = 0; i < numClips; ++
i) {
146 clipping_rect rc = clips[
i];
148 int32
width = clips[
i].right - clips[
i].left + 1;
149 int32
height = clips[
i].bottom - clips[
i].top + 1;
151 clips[
i].top * bufferPitch + clips[
i].left *
BPP;
152 windowpx = (uint8*)bitmap->Bits() +
153 clips[
i].top * windowPitch + clips[
i].left * BPP -
165 memcpy(bufferpx, windowpx, width * BPP);
166 bufferpx += bufferPitch;
167 windowpx += windowPitch;
205 if(!bscreen.IsValid()) {
218 int32 windowSub = bwin->
GetFbX() * BPP +
219 bwin->
GetFbY() * windowPitch;
220 clipping_rect *clips = bwin->
GetClips();
225 bscreen.WaitForRetrace();
226 for(i = 0; i < numClips; ++
i) {
227 clipping_rect rc = clips[
i];
229 int32 width = clips[
i].right - clips[
i].left + 1;
230 int32 height = clips[
i].bottom - clips[
i].top + 1;
232 clips[
i].top * bufferPitch + clips[
i].left *
BPP;
233 windowpx = windowBaseAddress +
234 clips[
i].top * windowPitch + clips[
i].left * BPP - windowSub;
240 memcpy(bufferpx, windowpx, width * BPP);
241 bufferpx += bufferPitch;
242 windowpx += windowPitch;
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLint GLint GLsizei width
uint32_t Uint32
An unsigned 32-bit integer type.
int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
clipping_rect * GetClips()
GLint GLint GLsizei GLsizei height
void SetBitmap(BBitmap *bitmap)
void SetBufferExists(bool bufferExists)
GLint GLint GLint GLint GLint GLint y
int32 BE_BPPToSDLPxFormat(int32 bpp)
void SetBufferDirty(bool bufferDirty)
int BE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
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)
int BE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
void BE_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
The type used to identify a window.
SDL_Rect rects[MAX_RECTS]
bool CanTrashWindowBuffer()
void SetTrashBuffer(bool trash)
int32 BE_DrawThread(void *data)
A rectangle, with the origin at the upper left.