Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
23e3df14
Commit
23e3df14
authored
Aug 12, 2011
by
Nathan Heisey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduced SEGFAULT occurence on resize?
parent
eb58f97b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
6 deletions
+68
-6
SDL_BApp.h
src/main/beos/SDL_BApp.h
+2
-2
SDL_BWin.h
src/video/bwindow/SDL_BWin.h
+4
-1
SDL_bframebuffer.cc
src/video/bwindow/SDL_bframebuffer.cc
+59
-1
SDL_bframebuffer.h
src/video/bwindow/SDL_bframebuffer.h
+2
-0
SDL_bopengl.cc
src/video/bwindow/SDL_bopengl.cc
+1
-2
No files found.
src/main/beos/SDL_BApp.h
View file @
23e3df14
...
...
@@ -330,7 +330,7 @@ private:
SDL_SendWindowEvent
(
win
,
SDL_WINDOWEVENT_MOVED
,
xPos
,
yPos
);
/* FIXME: Attempt at fixing rendering problems */
BE_UpdateWindowFramebuffer
(
NULL
,
win
,
NULL
,
-
1
);
// BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); Handled by DirectConnected
}
void
_HandleWindowResized
(
BMessage
*
msg
)
{
...
...
@@ -349,7 +349,7 @@ private:
SDL_SendWindowEvent
(
win
,
SDL_WINDOWEVENT_RESIZED
,
w
,
h
);
/* FIXME: Attempt at fixing rendering problems */
BE_UpdateWindowFramebuffer
(
NULL
,
win
,
NULL
,
-
1
);
// BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); Handled by DirectConnected
}
bool
_GetWinID
(
BMessage
*
msg
,
int32
*
winID
)
{
...
...
src/video/bwindow/SDL_BWin.h
View file @
23e3df14
...
...
@@ -82,10 +82,11 @@ class SDL_BWin:public BDirectWindow
_trash_window_buffer
=
false
;
_buffer_locker
=
new
BLocker
();
_bitmap
=
NULL
;
#ifdef DRAWTHREAD
_draw_thread_id
=
spawn_thread
(
BE_DrawThread
,
"drawing_thread"
,
B_NORMAL_PRIORITY
,
(
void
*
)
this
);
resume_thread
(
_draw_thread_id
);
#endif
}
virtual
~
SDL_BWin
()
...
...
@@ -109,7 +110,9 @@ class SDL_BWin:public BDirectWindow
/* Clean up framebuffer stuff */
_buffer_locker
->
Lock
();
#ifdef DRAWTHREAD
wait_for_thread
(
_draw_thread_id
,
&
result
);
#endif
free
(
_clips
);
delete
_buffer_locker
;
}
...
...
src/video/bwindow/SDL_bframebuffer.cc
View file @
23e3df14
...
...
@@ -32,6 +32,8 @@
extern
"C"
{
#endif
int32
BE_UpdateOnce
(
SDL_Window
*
window
);
static
inline
SDL_BWin
*
_ToBeWin
(
SDL_Window
*
window
)
{
return
((
SDL_BWin
*
)(
window
->
driverdata
));
}
...
...
@@ -99,9 +101,14 @@ int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
SDL_BWin
*
bwin
=
_ToBeWin
(
window
);
#ifdef DRAWTHREAD
bwin
->
LockBuffer
();
bwin
->
SetBufferDirty
(
true
);
bwin
->
UnlockBuffer
();
#else
bwin
->
SetBufferDirty
(
true
);
BE_UpdateOnce
(
window
);
#endif
return
0
;
}
...
...
@@ -148,9 +155,11 @@ int32 BE_DrawThread(void *data) {
buffer */
for
(
y
=
0
;
y
<
height
;
++
y
)
{
if
(
bwin
->
CanTrashWindowBuffer
())
{
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
);
bufferpx
+=
bufferPitch
;
...
...
@@ -183,6 +192,55 @@ void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
bwin
->
UnlockBuffer
();
}
int32
BE_UpdateOnce
(
SDL_Window
*
window
)
{
SDL_BWin
*
bwin
=
_ToBeWin
(
window
);
BScreen
bscreen
;
if
(
!
bscreen
.
IsValid
())
{
return
-
1
;
}
if
(
bwin
->
ConnectionEnabled
()
&&
bwin
->
Connected
())
{
bwin
->
LockBuffer
();
int32
windowPitch
=
window
->
surface
->
pitch
;
int32
bufferPitch
=
bwin
->
GetRowBytes
();
uint8
*
windowpx
;
uint8
*
bufferpx
;
int32
BPP
=
bwin
->
GetBytesPerPx
();
uint8
*
windowBaseAddress
=
(
uint8
*
)
window
->
surface
->
pixels
;
int32
windowSub
=
bwin
->
GetFbX
()
*
BPP
+
bwin
->
GetFbY
()
*
windowPitch
;
clipping_rect
*
clips
=
bwin
->
GetClips
();
int32
numClips
=
bwin
->
GetNumClips
();
int
i
,
y
;
/* Blit each clipping rectangle */
bscreen
.
WaitForRetrace
();
for
(
i
=
0
;
i
<
numClips
;
++
i
)
{
clipping_rect
rc
=
clips
[
i
];
/* Get addresses of the start of each clipping rectangle */
int32
width
=
clips
[
i
].
right
-
clips
[
i
].
left
+
1
;
int32
height
=
clips
[
i
].
bottom
-
clips
[
i
].
top
+
1
;
bufferpx
=
bwin
->
GetBufferPx
()
+
clips
[
i
].
top
*
bufferPitch
+
clips
[
i
].
left
*
BPP
;
windowpx
=
windowBaseAddress
+
clips
[
i
].
top
*
windowPitch
+
clips
[
i
].
left
*
BPP
-
windowSub
;
/* Copy each row of pixels from the window buffer into the frame
buffer */
for
(
y
=
0
;
y
<
height
;
++
y
)
{
memcpy
(
bufferpx
,
windowpx
,
width
*
BPP
);
bufferpx
+=
bufferPitch
;
windowpx
+=
windowPitch
;
}
}
bwin
->
UnlockBuffer
();
}
return
0
;
}
#ifdef __cplusplus
}
#endif
src/video/bwindow/SDL_bframebuffer.h
View file @
23e3df14
...
...
@@ -26,6 +26,8 @@
extern
"C"
{
#endif
#define DRAWTHREAD
#include "../SDL_sysvideo.h"
extern
int
BE_CreateWindowFramebuffer
(
_THIS
,
SDL_Window
*
window
,
...
...
src/video/bwindow/SDL_bopengl.cc
View file @
23e3df14
...
...
@@ -49,7 +49,6 @@ int BE_GL_LoadLibrary(_THIS, const char *path)
if
(
get_image_symbol
(
info
.
id
,
"glBegin"
,
B_SYMBOL_TYPE_ANY
,
&
location
)
==
B_OK
)
{
printf
(
"HERE2
\n
"
);
_this
->
gl_config
.
dll_handle
=
(
void
*
)
info
.
id
;
_this
->
gl_config
.
driver_loaded
=
1
;
SDL_strlcpy
(
_this
->
gl_config
.
driver_path
,
"libGL.so"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment