mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ANDROID: Some texture convinience functions
This commit is contained in:
@@ -250,6 +250,8 @@ void OSystem_Android::initOverlay() {
|
||||
LOGI("overlay size is %ux%u", overlay_width, overlay_height);
|
||||
|
||||
_overlay_texture->allocBuffer(overlay_width, overlay_height);
|
||||
_overlay_texture->setDrawRect(0, 0,
|
||||
_egl_surface_width, _egl_surface_height);
|
||||
}
|
||||
|
||||
void OSystem_Android::initSize(uint width, uint height,
|
||||
@@ -264,6 +266,9 @@ void OSystem_Android::initSize(uint width, uint height,
|
||||
_game_texture->allocBuffer(width, height);
|
||||
_game_texture->fillBuffer(0);
|
||||
#endif
|
||||
|
||||
_game_texture->setDrawRect(0, 0, _egl_surface_width, _egl_surface_height);
|
||||
|
||||
// Don't know mouse size yet - it gets reallocated in
|
||||
// setMouseCursor. We need the palette allocated before
|
||||
// setMouseCursor however, so just take a guess at the desired
|
||||
@@ -364,8 +369,7 @@ void OSystem_Android::updateScreen() {
|
||||
}
|
||||
|
||||
if (_focus_rect.isEmpty()) {
|
||||
_game_texture->drawTexture(0, 0, _egl_surface_width,
|
||||
_egl_surface_height);
|
||||
_game_texture->drawTextureRect();
|
||||
} else {
|
||||
GLCALL(glPushMatrix());
|
||||
GLCALL(glScalex(xdiv(_egl_surface_width, _focus_rect.width()),
|
||||
@@ -377,8 +381,7 @@ void OSystem_Android::updateScreen() {
|
||||
xdiv(_game_texture->height(), _egl_surface_height),
|
||||
1 << 16));
|
||||
|
||||
_game_texture->drawTexture(0, 0, _egl_surface_width,
|
||||
_egl_surface_height);
|
||||
_game_texture->drawTextureRect();
|
||||
GLCALL(glPopMatrix());
|
||||
}
|
||||
|
||||
@@ -388,8 +391,7 @@ void OSystem_Android::updateScreen() {
|
||||
// ugly, but the modern theme sets a wacko factor, only god knows why
|
||||
cs = 1;
|
||||
|
||||
GLCALL(_overlay_texture->drawTexture(0, 0, _egl_surface_width,
|
||||
_egl_surface_height));
|
||||
GLCALL(_overlay_texture->drawTextureRect());
|
||||
}
|
||||
|
||||
if (_show_mouse) {
|
||||
@@ -422,7 +424,7 @@ void OSystem_Android::updateScreen() {
|
||||
|
||||
GLCALL(glScalex(cs << 16, cs << 16, 1 << 16));
|
||||
|
||||
_mouse_texture->drawTexture();
|
||||
_mouse_texture->drawTextureOrigin();
|
||||
|
||||
GLCALL(glPopMatrix());
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ GLESBaseTexture::GLESBaseTexture(GLenum glFormat, GLenum glType,
|
||||
_surface(),
|
||||
_texture_width(0),
|
||||
_texture_height(0),
|
||||
_draw_rect(),
|
||||
_all_dirty(false),
|
||||
_dirty_rect(),
|
||||
_pixelFormat(pixelFormat),
|
||||
|
||||
@@ -59,8 +59,29 @@ public:
|
||||
|
||||
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
|
||||
|
||||
inline void drawTexture() {
|
||||
drawTexture(0, 0, _surface.w, _surface.h);
|
||||
inline void setDrawRect(const Common::Rect &rect) {
|
||||
_draw_rect = rect;
|
||||
}
|
||||
|
||||
inline void setDrawRect(int16 w, int16 h) {
|
||||
_draw_rect = Common::Rect(w, h);
|
||||
}
|
||||
|
||||
inline void setDrawRect(int16 x1, int16 y1, int16 x2, int16 y2) {
|
||||
_draw_rect = Common::Rect(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
inline const Common::Rect &getDrawRect() {
|
||||
return _draw_rect;
|
||||
}
|
||||
|
||||
inline void drawTextureRect() {
|
||||
drawTexture(_draw_rect.left, _draw_rect.top,
|
||||
_draw_rect.width(), _draw_rect.height());
|
||||
}
|
||||
|
||||
inline void drawTextureOrigin() {
|
||||
drawTexture(0, 0, _surface.w, _surface.h);
|
||||
}
|
||||
|
||||
inline GLuint width() const {
|
||||
@@ -136,7 +157,8 @@ protected:
|
||||
GLuint _texture_width;
|
||||
GLuint _texture_height;
|
||||
|
||||
// Covers dirty area
|
||||
Common::Rect _draw_rect;
|
||||
|
||||
bool _all_dirty;
|
||||
Common::Rect _dirty_rect;
|
||||
|
||||
@@ -160,10 +182,6 @@ public:
|
||||
|
||||
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
|
||||
|
||||
inline void drawTexture() {
|
||||
drawTexture(0, 0, _surface.w, _surface.h);
|
||||
}
|
||||
|
||||
protected:
|
||||
byte *_pixels;
|
||||
byte *_buf;
|
||||
@@ -217,10 +235,6 @@ public:
|
||||
|
||||
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
|
||||
|
||||
inline void drawTexture() {
|
||||
drawTexture(0, 0, _surface.w, _surface.h);
|
||||
}
|
||||
|
||||
virtual const byte *palette_const() const {
|
||||
return _texture;
|
||||
};
|
||||
@@ -285,10 +299,6 @@ public:
|
||||
|
||||
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
|
||||
|
||||
inline void drawTexture() {
|
||||
drawTexture(0, 0, _surface.w, _surface.h);
|
||||
}
|
||||
|
||||
virtual const byte *palette_const() const {
|
||||
return (byte *)_palette;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user