21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_HAIKU 28 #include <InterfaceKit.h> 32 #include "../../main/haiku/SDL_BApp.h" 52 void **
pixels,
int *pitch) {
55 if(!bscreen.IsValid()) {
59 while(!bwin->
Connected()) { snooze(100); }
66 bscreen.GetMode(&bmode);
76 bitmap =
new BBitmap(bwin->Bounds(), (color_space)bmode.space,
80 if(bitmap->InitCheck() != B_OK) {
82 return SDL_SetError(
"Could not initialize back buffer!");
89 *pixels = bitmap->Bits();
92 *pitch = bitmap->BytesPerRow();
115 HAIKU_UpdateOnce(window);
125 if(!bscreen.IsValid()) {
132 BBitmap *bitmap =
NULL;
134 int32 windowPitch = bitmap->BytesPerRow();
140 int32 windowSub = bwin->
GetFbX() * BPP +
141 bwin->
GetFbY() * windowPitch;
142 clipping_rect *clips = bwin->
GetClips();
147 bscreen.WaitForRetrace();
148 for(i = 0; i < numClips; ++
i) {
150 int32
width = clips[
i].right - clips[
i].left + 1;
151 int32
height = clips[
i].bottom - clips[
i].top + 1;
153 clips[
i].top * bufferPitch + clips[
i].left *
BPP;
154 windowpx = (uint8*)bitmap->Bits() +
155 clips[
i].top * windowPitch + clips[
i].left * BPP -
167 memcpy(bufferpx, windowpx, width * BPP);
168 bufferpx += bufferPitch;
169 windowpx += windowPitch;
205 static int32 HAIKU_UpdateOnce(
SDL_Window *window) {
208 if(!bscreen.IsValid()) {
221 int32 windowSub = bwin->
GetFbX() * BPP +
222 bwin->
GetFbY() * windowPitch;
223 clipping_rect *clips = bwin->
GetClips();
228 bscreen.WaitForRetrace();
229 for(i = 0; i < numClips; ++
i) {
231 int32 width = clips[
i].right - clips[
i].left + 1;
232 int32 height = clips[
i].bottom - clips[
i].top + 1;
234 clips[
i].top * bufferPitch + clips[
i].left *
BPP;
235 windowpx = windowBaseAddress +
236 clips[
i].top * windowPitch + clips[
i].left * BPP - windowSub;
242 memcpy(bufferpx, windowpx, width * BPP);
243 bufferpx += bufferPitch;
244 windowpx += windowPitch;
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
clipping_rect * GetClips()
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
void SetBitmap(BBitmap *bitmap)
void SetBufferExists(bool bufferExists)
GLint GLint GLsizei width
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
void SetBufferDirty(bool bufferDirty)
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)
int32 HAIKU_BPPToSDLPxFormat(int32 bpp)
GLint GLint GLsizei GLsizei height
EGLSurface EGLNativeWindowType * window
The type used to identify a window.
bool CanTrashWindowBuffer()
void SetTrashBuffer(bool trash)
EGLSurface EGLint * rects
int32 HAIKU_DrawThread(void *data)
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
A rectangle, with the origin at the upper left.