projects
/
drnoksnes
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d26b4a1
)
add some fixes for hwsurfaces
author
Javier S. Pedro
<maemo@javispedro.com>
Tue, 23 Aug 2011 16:29:16 +0000
(18:29 +0200)
committer
Javier S. Pedro
<maemo@javispedro.com>
Tue, 23 Aug 2011 16:29:16 +0000
(18:29 +0200)
platform/sdlvscalers.cpp
patch
|
blob
|
history
diff --git
a/platform/sdlvscalers.cpp
b/platform/sdlvscalers.cpp
index
8afbdf8
..
ab3dd56
100644
(file)
--- a/
platform/sdlvscalers.cpp
+++ b/
platform/sdlvscalers.cpp
@@
-31,6
+31,8
@@
static void centerRectangle(SDL_Rect& result, int areaW, int areaH, int w, int h
result.w = w;
result.y = areaH / 2 - h / 2;
result.h = h;
result.w = w;
result.y = areaH / 2 - h / 2;
result.h = h;
+ /* We need to keep this 4-byte aligned (each pixel is 2-byte) */
+ result.x &= ~1;
}
/* Base scaler for stupid scalers */
}
/* Base scaler for stupid scalers */
@@
-103,10
+105,14
@@
public:
x = 1.0f; y = 1.0f;
};
x = 1.0f; y = 1.0f;
};
- virtual void prepare() { };
+ virtual void prepare()
+ {
+ if (SDL_MUSTLOCK(m_screen)) SDL_LockSurface(m_screen);
+ };
virtual void finish()
{
virtual void finish()
{
+ if (SDL_MUSTLOCK(m_screen)) SDL_UnlockSurface(m_screen);
SDL_UpdateRects(m_screen, 1, &m_area);
};
SDL_UpdateRects(m_screen, 1, &m_area);
};
@@
-289,10
+295,13
@@
public:
x = 2.0f; y = 2.0f;
};
x = 2.0f; y = 2.0f;
};
- void prepare() { };
+ void prepare() {
+ SDL_FillRect(m_screen, NULL, 0);
+ };
void finish()
{
void finish()
{
+ if (SDL_MUSTLOCK(m_screen)) SDL_LockSurface(m_screen);
uint16 * src = reinterpret_cast<uint16*>(m_surface);
uint16 * dst = reinterpret_cast<uint16*>(
((uint8*) m_screen->pixels)
uint16 * src = reinterpret_cast<uint16*>(m_surface);
uint16 * dst = reinterpret_cast<uint16*>(
((uint8*) m_screen->pixels)
@@
-353,7
+362,13
@@
public:
if (y&1) src += src_pitch;
}
if (y&1) src += src_pitch;
}
- SDL_UpdateRects(m_screen, 1, &m_area);
+ if (SDL_MUSTLOCK(m_screen)) SDL_UnlockSurface(m_screen);
+
+ if (m_screen->flags & SDL_DOUBLEBUF) {
+ SDL_Flip(m_screen);
+ } else {
+ SDL_UpdateRects(m_screen, 1, &m_area);
+ }
};
void pause() { };
};
void pause() { };