Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Cortado
Commits
dd86ad5e
Commit
dd86ad5e
authored
Mar 21, 2010
by
ogg.k.ogg.k
Browse files
synchronize renderer methods - you don't really want to add an item
while you are rendering the items list
parent
06db3036
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/com/fluendo/jtiger/Renderer.java
View file @
dd86ad5e
...
...
@@ -30,7 +30,7 @@ public class Renderer {
/**
* Add a new event to the renderer.
*/
public
void
add
(
com
.
fluendo
.
jkate
.
Event
ev
)
{
public
synchronized
void
add
(
com
.
fluendo
.
jkate
.
Event
ev
)
{
items
.
addElement
(
new
Item
(
ev
));
dirty
=
true
;
}
...
...
@@ -39,7 +39,7 @@ public class Renderer {
* Update the renderer, and all the events it tracks.
* Returns 1 if there is nothing to draw, as an optimization
*/
public
int
update
(
Component
c
,
Dimension
d
,
double
t
)
{
public
synchronized
int
update
(
Component
c
,
Dimension
d
,
double
t
)
{
for
(
int
n
=
0
;
n
<
items
.
size
();
++
n
)
{
boolean
ret
=
((
Item
)
items
.
elementAt
(
n
)).
update
(
c
,
d
,
t
);
if
(!
ret
)
{
...
...
@@ -61,7 +61,7 @@ public class Renderer {
/**
* Renders onto the given image.
*/
public
Image
render
(
Component
c
,
Image
img
)
{
public
synchronized
Image
render
(
Component
c
,
Image
img
)
{
/* there used to be some non copying code using BufferedImage, but that's not in SDK 1.1, so we do it the slow way */
Image
copy
=
c
.
createImage
(
img
.
getWidth
(
null
),
img
.
getHeight
(
null
));
Graphics
g
=
copy
.
getGraphics
();
...
...
@@ -81,12 +81,12 @@ public class Renderer {
/**
* Flushes all events.
*/
public
void
flush
()
{
public
synchronized
void
flush
()
{
items
.
removeAllElements
();
dirty
=
true
;
}
public
boolean
isDirty
()
{
public
synchronized
boolean
isDirty
()
{
return
dirty
;
}
}
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