Some video fixes
This commit is contained in:
parent
3c7c721663
commit
06dfd29b23
3 changed files with 69 additions and 28 deletions
|
@ -156,7 +156,8 @@ class SDL_BWin:public BDirectWindow
|
||||||
/* Determine if the pixel buffer is usable after this update */
|
/* Determine if the pixel buffer is usable after this update */
|
||||||
_trash_window_buffer = _trash_window_buffer
|
_trash_window_buffer = _trash_window_buffer
|
||||||
|| ((info->buffer_state & B_BUFFER_RESIZED)
|
|| ((info->buffer_state & B_BUFFER_RESIZED)
|
||||||
|| (info->buffer_state & B_BUFFER_RESET));
|
|| (info->buffer_state & B_BUFFER_RESET)
|
||||||
|
|| (info->driver_state == B_MODE_CHANGED));
|
||||||
LockBuffer();
|
LockBuffer();
|
||||||
|
|
||||||
switch(info->buffer_state & B_DIRECT_MODE_MASK) {
|
switch(info->buffer_state & B_DIRECT_MODE_MASK) {
|
||||||
|
@ -193,7 +194,12 @@ class SDL_BWin:public BDirectWindow
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Call the base object directconnected */
|
||||||
|
BDirectWindow::DirectConnected(info);
|
||||||
|
|
||||||
UnlockBuffer();
|
UnlockBuffer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,6 +413,9 @@ class SDL_BWin:public BDirectWindow
|
||||||
bool BufferExists() { return _buffer_created; }
|
bool BufferExists() { return _buffer_created; }
|
||||||
bool BufferIsDirty() { return _buffer_dirty; }
|
bool BufferIsDirty() { return _buffer_dirty; }
|
||||||
BBitmap *GetBitmap() { return _bitmap; }
|
BBitmap *GetBitmap() { return _bitmap; }
|
||||||
|
#if SDL_VIDEO_OPENGL
|
||||||
|
BGLView *GetGLView() { return _SDL_GLView; }
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Setter methods */
|
/* Setter methods */
|
||||||
void SetID(int32 id) { _id = id; }
|
void SetID(int32 id) { _id = id; }
|
||||||
|
|
|
@ -62,12 +62,20 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||||
|
|
||||||
/* Create the new bitmap object */
|
/* Create the new bitmap object */
|
||||||
BBitmap *bitmap = bwin->GetBitmap();
|
BBitmap *bitmap = bwin->GetBitmap();
|
||||||
|
|
||||||
if(bitmap) {
|
if(bitmap) {
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
}
|
}
|
||||||
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
|
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
|
||||||
false, /* Views not accepted */
|
false, /* Views not accepted */
|
||||||
true); /* Contiguous memory required */
|
true); /* Contiguous memory required */
|
||||||
|
|
||||||
|
if(bitmap->InitCheck() != B_OK) {
|
||||||
|
SDL_SetError("Could not initialize back buffer!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bwin->SetBitmap(bitmap);
|
bwin->SetBitmap(bitmap);
|
||||||
|
|
||||||
/* Set the pixel pointer */
|
/* Set the pixel pointer */
|
||||||
|
@ -132,7 +140,7 @@ int32 BE_DrawThread(void *data) {
|
||||||
int32 height = clips[i].bottom - clips[i].top + 1;
|
int32 height = clips[i].bottom - clips[i].top + 1;
|
||||||
bufferpx = bwin->GetBufferPx() +
|
bufferpx = bwin->GetBufferPx() +
|
||||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||||
windowpx = (uint8*)bitmap->Bits(); +
|
windowpx = (uint8*)bitmap->Bits() +
|
||||||
clips[i].top * windowPitch + clips[i].left * BPP -
|
clips[i].top * windowPitch + clips[i].left * BPP -
|
||||||
windowSub;
|
windowSub;
|
||||||
|
|
||||||
|
@ -143,11 +151,14 @@ int32 BE_DrawThread(void *data) {
|
||||||
if(bwin->CanTrashWindowBuffer()) {
|
if(bwin->CanTrashWindowBuffer()) {
|
||||||
goto escape; /* Break out before the buffer is killed */
|
goto escape; /* Break out before the buffer is killed */
|
||||||
}
|
}
|
||||||
|
// printf("memcpy(0x%x, 0x%x, %i) ", bufferpx, windowpx, width * BPP);
|
||||||
memcpy(bufferpx, windowpx, width * BPP);
|
memcpy(bufferpx, windowpx, width * BPP);
|
||||||
bufferpx += bufferPitch;
|
bufferpx += bufferPitch;
|
||||||
windowpx += windowPitch;
|
windowpx += windowPitch;
|
||||||
}
|
}
|
||||||
|
// printf("\t-\t");
|
||||||
}
|
}
|
||||||
|
// printf("\n");
|
||||||
bwin->SetBufferDirty(false);
|
bwin->SetBufferDirty(false);
|
||||||
escape:
|
escape:
|
||||||
bwin->UnlockBuffer();
|
bwin->UnlockBuffer();
|
||||||
|
|
|
@ -119,6 +119,52 @@ void *BE_GL_GetProcAddress(_THIS, const char *proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void BE_GL_SwapWindow(_THIS, SDL_Window * window) {
|
||||||
|
_ToBeWin(window)->SwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
|
||||||
|
_GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
|
||||||
|
/* FIXME: Not sure what flags should be included here; may want to have
|
||||||
|
most of them */
|
||||||
|
SDL_BWin *bwin = _ToBeWin(window);
|
||||||
|
bwin->CreateGLView(BGL_RGB | BGL_DOUBLE);
|
||||||
|
return (SDL_GLContext)(bwin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
|
||||||
|
/* Currently, automatically unlocks the view */
|
||||||
|
((SDL_BWin*)context)->RemoveGLView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int BE_GL_SetSwapInterval(_THIS, int interval) {
|
||||||
|
printf(__FILE__": %d- swap interval set\n", __LINE__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BE_GL_GetSwapInterval(_THIS) {
|
||||||
|
printf(__FILE__": %d- swap interval requested\n", __LINE__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BE_GL_UnloadLibrary(_THIS) {
|
||||||
|
printf(__FILE__": %d- Library unloaded\n", __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */
|
#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */
|
||||||
|
|
||||||
int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
|
int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
|
||||||
|
@ -182,38 +228,13 @@ void *BE_GL_GetProcAddress(_THIS, const char *proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
void BE_GL_SwapWindow(_THIS, SDL_Window * window) {
|
|
||||||
_ToBeWin(window)->SwapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
|
|
||||||
_GetBeApp()->SetCurrentContext((BGLView*)context);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
|
|
||||||
/* FIXME: Not sure what flags should be included here; may want to have
|
|
||||||
most of them */
|
|
||||||
return (SDL_GLContext)(_ToBeWin(window)->CreateGLView(
|
|
||||||
BGL_RGB | BGL_DOUBLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
|
|
||||||
/* Currently, automatically unlocks the view */
|
|
||||||
// _ToBeWin(window)->RemoveGLView(); FIXME: Need to get the bwindow somehow
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int BE_GL_SetSwapInterval(_THIS, int interval) {
|
|
||||||
}
|
|
||||||
|
|
||||||
int BE_GL_GetSwapInterval(_THIS) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BE_GL_UnloadLibrary(_THIS) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue