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
41cbb17d
Commit
41cbb17d
authored
Jul 28, 2011
by
Nathan Heisey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render thread partially corrected
parent
bf4cf189
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
70 deletions
+36
-70
SDL_BApp.h
src/main/beos/SDL_BApp.h
+3
-41
SDL_BWin.h
src/video/bwindow/SDL_BWin.h
+16
-15
SDL_bkeyboard.cc
src/video/bwindow/SDL_bkeyboard.cc
+3
-3
SDL_bmodes.cc
src/video/bwindow/SDL_bmodes.cc
+14
-11
No files found.
src/main/beos/SDL_BApp.h
View file @
41cbb17d
...
@@ -356,66 +356,28 @@ private:
...
@@ -356,66 +356,28 @@ private:
/* Vector imitators */
/* Vector functions: Wraps vector stuff in case we need to change
implementation */
void
_SetSDLWindow
(
SDL_Window
*
win
,
int32
winID
)
{
void
_SetSDLWindow
(
SDL_Window
*
win
,
int32
winID
)
{
window_map
[
winID
]
=
win
;
window_map
[
winID
]
=
win
;
}
}
int32
_GetNumWindowSlots
()
{
int32
_GetNumWindowSlots
()
{
#ifdef __cplusplus
return
window_map
.
size
();
return
window_map
.
size
();
#else
return
_size
;
#endif
}
}
void
_PopBackWindow
()
{
void
_PopBackWindow
()
{
#ifdef __cplusplus
window_map
.
pop_back
();
window_map
.
pop_back
();
#else
--
_size
;
#endif
}
}
void
_PushBackWindow
(
SDL_Window
*
win
)
{
void
_PushBackWindow
(
SDL_Window
*
win
)
{
#ifdef __cplusplus
window_map
.
push_back
(
win
);
window_map
.
push_back
(
win
);
#else
/* Resize array */
if
(
_length
==
_size
)
{
_ResizeArray
();
}
window_map
[
_size
]
=
win
;
++
_size
;
#endif
}
}
#ifndef __cplusplus
_ResizeArray
()
{
_length
+=
4
;
/* Increase capacity by some arbitrary number */
SDL_Window
*
temp
=
(
SDL_Window
*
)
SDL_calloc
(
_length
,
sizeof
(
SDL_Window
*
));
/* Move windows from old list to new list */
int32
i
;
for
(
i
=
0
;
i
<
_size
;
++
i
)
{
temp
[
i
]
=
window_map
[
i
];
}
SDL_free
(
window_map
);
window_map
=
temp
;
}
#endif
/* Members */
/* Members */
#ifdef __cplusplus
vector
<
SDL_Window
*>
window_map
;
/* Keeps track of SDL_Windows by index-id */
vector
<
SDL_Window
*>
window_map
;
/* Keeps track of SDL_Windows by index-id */
#else
int32
_size
;
int32
_length
;
SDL_Window
*
window_map
;
#endif
display_mode
*
saved_mode
;
display_mode
*
saved_mode
;
};
};
...
...
src/video/bwindow/SDL_BWin.h
View file @
41cbb17d
...
@@ -77,14 +77,13 @@ class SDL_BWin:public BDirectWindow
...
@@ -77,14 +77,13 @@ class SDL_BWin:public BDirectWindow
/* Handle framebuffer stuff */
/* Handle framebuffer stuff */
_connected
=
_connection_disabled
=
false
;
_connected
=
_connection_disabled
=
false
;
_buffer_created
=
_buffer_dirty
=
false
;
_buffer_created
=
_buffer_dirty
=
false
;
_trash_
_
window_buffer
=
false
;
_trash_window_buffer
=
false
;
_buffer_locker
=
new
BLocker
();
_buffer_locker
=
new
BLocker
();
_window_buffer
=
NULL
;
_window_buffer
=
NULL
;
_draw_thread_id
=
spawn_thread
(
BE_DrawThread
,
"drawing_thread"
,
_draw_thread_id
=
spawn_thread
(
BE_DrawThread
,
"drawing_thread"
,
B_NORMAL_PRIORITY
,
(
void
*
)
this
);
B_NORMAL_PRIORITY
,
(
void
*
)
this
);
resume_thread
(
_draw_thread_id
);
resume_thread
(
_draw_thread_id
);
// LockBuffer(); /* Unlocked by buffer initialization */
}
}
virtual
~
SDL_BWin
()
virtual
~
SDL_BWin
()
...
@@ -153,6 +152,11 @@ class SDL_BWin:public BDirectWindow
...
@@ -153,6 +152,11 @@ class SDL_BWin:public BDirectWindow
if
(
!
_connected
&&
_connection_disabled
)
{
if
(
!
_connected
&&
_connection_disabled
)
{
return
;
return
;
}
}
/* Determine if the pixel buffer is usable after this update */
_trash_window_buffer
=
_trash_window_buffer
||
((
info
->
buffer_state
&
B_BUFFER_RESIZED
)
||
(
info
->
buffer_state
&
B_BUFFER_RESET
));
LockBuffer
();
LockBuffer
();
switch
(
info
->
buffer_state
&
B_DIRECT_MODE_MASK
)
{
switch
(
info
->
buffer_state
&
B_DIRECT_MODE_MASK
)
{
...
@@ -165,12 +169,6 @@ class SDL_BWin:public BDirectWindow
...
@@ -165,12 +169,6 @@ class SDL_BWin:public BDirectWindow
_clips
=
NULL
;
_clips
=
NULL
;
}
}
/* Can we reuse the window's pixel buffer after this? */
_trash__window_buffer
=
((
info
->
buffer_state
&
B_BUFFER_RESIZED
)
||
(
info
->
buffer_state
&
B_BUFFER_RESET
)
||
((
info
->
buffer_state
&
B_DIRECT_MODE_MASK
)
==
B_DIRECT_START
));
_num_clips
=
info
->
clip_list_count
;
_num_clips
=
info
->
clip_list_count
;
_clips
=
(
clipping_rect
*
)
malloc
(
_num_clips
*
sizeof
(
clipping_rect
));
_clips
=
(
clipping_rect
*
)
malloc
(
_num_clips
*
sizeof
(
clipping_rect
));
if
(
_clips
)
{
if
(
_clips
)
{
...
@@ -181,16 +179,18 @@ class SDL_BWin:public BDirectWindow
...
@@ -181,16 +179,18 @@ class SDL_BWin:public BDirectWindow
_row_bytes
=
info
->
bytes_per_row
;
_row_bytes
=
info
->
bytes_per_row
;
_bounds
=
info
->
window_bounds
;
_bounds
=
info
->
window_bounds
;
_bytes_per_px
=
info
->
bits_per_pixel
/
8
;
_bytes_per_px
=
info
->
bits_per_pixel
/
8
;
}
_buffer_dirty
=
true
;
/* Whatever the case, I think this merits a repaint event */
/* Now we check for a good buffer */
// _RepaintEvent();
// SetBufferExists(!_trash_window_buffer);
}
break
;
break
;
case
B_DIRECT_STOP
:
case
B_DIRECT_STOP
:
_connected
=
false
;
_connected
=
false
;
break
;
break
;
}
}
UnlockBuffer
();
UnlockBuffer
();
}
}
...
@@ -401,17 +401,18 @@ class SDL_BWin:public BDirectWindow
...
@@ -401,17 +401,18 @@ class SDL_BWin:public BDirectWindow
uint8
*
GetBufferPx
()
{
return
_bits
;
}
uint8
*
GetBufferPx
()
{
return
_bits
;
}
int32
GetBytesPerPx
()
{
return
_bytes_per_px
;
}
int32
GetBytesPerPx
()
{
return
_bytes_per_px
;
}
uint8
*
GetWindowFramebuffer
()
{
return
_window_buffer
;
}
uint8
*
GetWindowFramebuffer
()
{
return
_window_buffer
;
}
bool
CanTrashWindowBuffer
()
{
return
_trash_
_
window_buffer
;
}
bool
CanTrashWindowBuffer
()
{
return
_trash_window_buffer
;
}
bool
BufferExists
()
{
return
_buffer_created
;
}
bool
BufferExists
()
{
return
_buffer_created
;
}
bool
BufferIsDirty
()
{
return
_buffer_dirty
;
}
bool
BufferIsDirty
()
{
return
_buffer_dirty
;
}
/* Setter methods */
/* Setter methods */
void
SetID
(
int32
id
)
{
_id
=
id
;
}
void
SetID
(
int32
id
)
{
_id
=
id
;
}
bool
SetBufferExists
(
bool
bufferExists
)
{
_buffer_created
=
bufferExists
;
}
void
SetBufferExists
(
bool
bufferExists
)
{
_buffer_created
=
bufferExists
;
}
void
SetWindowFramebuffer
(
uint8
*
fb
)
{
_window_buffer
=
fb
;
}
void
SetWindowFramebuffer
(
uint8
*
fb
)
{
_window_buffer
=
fb
;
}
void
LockBuffer
()
{
_buffer_locker
->
Lock
();
}
void
LockBuffer
()
{
_buffer_locker
->
Lock
();
}
void
UnlockBuffer
()
{
_buffer_locker
->
Unlock
();
}
void
UnlockBuffer
()
{
_buffer_locker
->
Unlock
();
}
void
SetBufferDirty
(
bool
bufferDirty
)
{
_buffer_dirty
=
bufferDirty
;
}
void
SetBufferDirty
(
bool
bufferDirty
)
{
_buffer_dirty
=
bufferDirty
;
}
void
SetTrashBuffer
(
bool
trash
)
{
_trash_window_buffer
=
trash
;
}
...
@@ -603,7 +604,7 @@ private:
...
@@ -603,7 +604,7 @@ private:
int32
_num_clips
;
int32
_num_clips
;
int32
_bytes_per_px
;
int32
_bytes_per_px
;
uint8
*
_window_buffer
;
/* A copy of the window buffer */
uint8
*
_window_buffer
;
/* A copy of the window buffer */
bool
_trash_
_
window_buffer
;
bool
_trash_window_buffer
;
thread_id
_draw_thread_id
;
thread_id
_draw_thread_id
;
};
};
...
...
src/video/bwindow/SDL_bkeyboard.cc
View file @
41cbb17d
...
@@ -149,10 +149,10 @@ void BE_InitOSKeymap() {
...
@@ -149,10 +149,10 @@ void BE_InitOSKeymap() {
keymap
[
0x63
]
=
SDL_GetScancodeFromKey
(
SDLK_RIGHT
);
keymap
[
0x63
]
=
SDL_GetScancodeFromKey
(
SDLK_RIGHT
);
keymap
[
0x64
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_0
);
keymap
[
0x64
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_0
);
keymap
[
0x65
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_PERIOD
);
keymap
[
0x65
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_PERIOD
);
keymap
[
0x66
]
=
SDL_GetScancodeFromKey
(
SDLK_LGUI
);
/* FIXME: Is this the right translation? */
keymap
[
0x66
]
=
SDL_GetScancodeFromKey
(
SDLK_LGUI
);
keymap
[
0x67
]
=
SDL_GetScancodeFromKey
(
SDLK_RGUI
);
/* FIXME: Is this the right translation? */
keymap
[
0x67
]
=
SDL_GetScancodeFromKey
(
SDLK_RGUI
);
keymap
[
0x68
]
=
SDL_GetScancodeFromKey
(
SDLK_MENU
);
keymap
[
0x68
]
=
SDL_GetScancodeFromKey
(
SDLK_MENU
);
keymap
[
0x69
]
=
SDL_GetScancodeFromKey
(
SDLK_
UNKNOWN
);
/* FIXME: I couldn't find a translation
*/
keymap
[
0x69
]
=
SDL_GetScancodeFromKey
(
SDLK_
2
);
/* SDLK_EURO
*/
keymap
[
0x6a
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_EQUALS
);
keymap
[
0x6a
]
=
SDL_GetScancodeFromKey
(
SDLK_KP_EQUALS
);
keymap
[
0x6b
]
=
SDL_GetScancodeFromKey
(
SDLK_POWER
);
keymap
[
0x6b
]
=
SDL_GetScancodeFromKey
(
SDLK_POWER
);
}
}
...
...
src/video/bwindow/SDL_bmodes.cc
View file @
41cbb17d
...
@@ -234,16 +234,15 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
...
@@ -234,16 +234,15 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
/* Create a copy of the pixel buffer if it doesn't recycle */
/* Create a copy of the pixel buffer if it doesn't recycle */
*
pixels
=
bwin
->
GetWindowFramebuffer
();
*
pixels
=
bwin
->
GetWindowFramebuffer
();
if
(
bwin
->
CanTrashWindowBuffer
()
||
(
*
pixels
)
==
NULL
)
{
if
(
(
*
pixels
)
!=
NULL
)
{
if
(
(
*
pixels
)
!=
NULL
)
{
SDL_free
(
*
pixels
);
SDL_free
(
*
pixels
);
}
}
*
pixels
=
SDL_calloc
((
*
pitch
)
*
bwin
->
GetFbHeight
()
*
*
pixels
=
SDL_calloc
((
*
pitch
)
*
bwin
->
GetFbHeight
()
*
bwin
->
GetBytesPerPx
(),
sizeof
(
uint8
));
bwin
->
GetBytesPerPx
(),
sizeof
(
uint8
));
bwin
->
SetWindowFramebuffer
((
uint8
*
)(
*
pixels
));
bwin
->
SetWindowFramebuffer
((
uint8
*
)(
*
pixels
));
}
bwin
->
SetBufferExists
(
true
);
bwin
->
SetBufferExists
(
true
);
bwin
->
SetTrashBuffer
(
false
);
bwin
->
UnlockBuffer
();
bwin
->
UnlockBuffer
();
return
0
;
return
0
;
}
}
...
@@ -305,15 +304,19 @@ int32 BE_DrawThread(void *data) {
...
@@ -305,15 +304,19 @@ int32 BE_DrawThread(void *data) {
buffer */
buffer */
for
(
y
=
0
;
y
<
height
;
++
y
)
for
(
y
=
0
;
y
<
height
;
++
y
)
{
{
if
(
bwin
->
CanTrashWindowBuffer
())
{
goto
escape
;
/* Break out before the buffer is killed */
}
memcpy
(
bufferpx
,
windowpx
,
width
*
BPP
);
memcpy
(
bufferpx
,
windowpx
,
width
*
BPP
);
bufferpx
+=
bufferPitch
;
bufferpx
+=
bufferPitch
;
windowpx
+=
windowPitch
;
windowpx
+=
windowPitch
;
}
}
}
}
bwin
->
SetBufferDirty
(
false
);
bwin
->
SetBufferDirty
(
false
);
escape
:
bwin
->
UnlockBuffer
();
bwin
->
UnlockBuffer
();
}
else
{
}
else
{
snooze
(
1000
);
snooze
(
1
6
000
);
}
}
}
}
...
...
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