diff options
author | Paul Gilbert | 2018-11-18 21:31:58 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 5a05140ac34a6a177b90a22f8601f2adff4831d5 (patch) | |
tree | a42401c712c3b270ed41fd04909a669faef0826a /engines/glk/picture.cpp | |
parent | bd86fd7bbf19324e06834ee8f2e08e7e0df02e14 (diff) | |
download | scummvm-rg350-5a05140ac34a6a177b90a22f8601f2adff4831d5.tar.gz scummvm-rg350-5a05140ac34a6a177b90a22f8601f2adff4831d5.tar.bz2 scummvm-rg350-5a05140ac34a6a177b90a22f8601f2adff4831d5.zip |
GLK: Add picture scaling
Diffstat (limited to 'engines/glk/picture.cpp')
-rw-r--r-- | engines/glk/picture.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/engines/glk/picture.cpp b/engines/glk/picture.cpp index 8461983c45..89e75fa941 100644 --- a/engines/glk/picture.cpp +++ b/engines/glk/picture.cpp @@ -126,6 +126,21 @@ Picture *Pictures::load(uint32 id) { return pic; } +Picture *Pictures::scale(Picture *src, size_t sx, size_t sy) { + // Check for the presence of an already scaled version of that size + Picture *dst = retrieve(src->_id, true); + if (dst && dst->w == sx && dst->h == sy) + return dst; + + // Create a new picture of the destination size and rescale the source picture + dst = new Picture(sx, sy, src->format); + dst->_id = src->_id; + dst->_scaled = true; + dst->transBlitFrom(*src, src->getBounds(), dst->getBounds(), (uint)-1); + + storeScaled(dst); +} + /*--------------------------------------------------------------------------*/ void Picture::increment() { @@ -139,11 +154,6 @@ void Picture::decrement() { } } -Picture *Picture::scale(int sx, int sy) { - // TODO: gli_picture_scale - return nullptr; -} - void Picture::drawPicture(int x0, int y0, int dx0, int dy0, int dx1, int dy1) { // TODO: drawPicture } |