aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-18 21:40:23 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commitf7cb4170847373a84268479bd7487c20c58d5639 (patch)
tree30c883d3e81fc88dc3f972c11981e7ebc785648c /engines
parent5a05140ac34a6a177b90a22f8601f2adff4831d5 (diff)
downloadscummvm-rg350-f7cb4170847373a84268479bd7487c20c58d5639.tar.gz
scummvm-rg350-f7cb4170847373a84268479bd7487c20c58d5639.tar.bz2
scummvm-rg350-f7cb4170847373a84268479bd7487c20c58d5639.zip
GLK: Add picture drawing
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/picture.cpp13
-rw-r--r--engines/glk/picture.h2
-rw-r--r--engines/glk/window_text_buffer.cpp7
3 files changed, 13 insertions, 9 deletions
diff --git a/engines/glk/picture.cpp b/engines/glk/picture.cpp
index 89e75fa941..122d9c3f30 100644
--- a/engines/glk/picture.cpp
+++ b/engines/glk/picture.cpp
@@ -21,6 +21,8 @@
*/
#include "glk/picture.h"
+#include "glk/glk.h"
+#include "glk/screen.h"
#include "common/file.h"
#include "image/jpeg.h"
#include "image/png.h"
@@ -29,8 +31,8 @@ namespace Glk {
void Pictures::clear() {
for (uint idx = 0; idx < _store.size(); ++idx) {
- delete _store[idx]._picture;
- delete _store[idx]._scaled;
+ _store[idx]._picture->decrement();
+ _store[idx]._scaled->decrement();
}
_store.clear();
@@ -139,6 +141,7 @@ Picture *Pictures::scale(Picture *src, size_t sx, size_t sy) {
dst->transBlitFrom(*src, src->getBounds(), dst->getBounds(), (uint)-1);
storeScaled(dst);
+ return dst;
}
/*--------------------------------------------------------------------------*/
@@ -154,9 +157,9 @@ void Picture::decrement() {
}
}
-void Picture::drawPicture(int x0, int y0, int dx0, int dy0, int dx1, int dy1) {
- // TODO: drawPicture
+void Picture::drawPicture(const Common::Point &destPos, const Common::Rect &box) {
+ Graphics::Surface s = g_vm->_screen->getSubArea(box);
+ s.copyRectToSurface(*this, destPos.x - box.left, destPos.y, getBounds());
}
-
} // End of namespace Glk
diff --git a/engines/glk/picture.h b/engines/glk/picture.h
index c0108dd2a0..f221569368 100644
--- a/engines/glk/picture.h
+++ b/engines/glk/picture.h
@@ -61,7 +61,7 @@ public:
/**
* Draw the picture
*/
- void drawPicture(int x0, int y0, int dx0, int dy0, int dx1, int dy1);
+ void drawPicture(const Common::Point &destPos, const Common::Rect &box);
};
/**
diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp
index 4c55066603..35f5af9c6f 100644
--- a/engines/glk/window_text_buffer.cpp
+++ b/engines/glk/window_text_buffer.cpp
@@ -1070,7 +1070,8 @@ void TextBufferWindow::redraw() {
if (ln->_lPic) {
if (y < y1 && y + ln->_lPic->h > y0) {
- ln->_lPic->drawPicture(x0 / GLI_SUBPIX, y, x0 / GLI_SUBPIX, y0, x1 / GLI_SUBPIX, y1);
+ ln->_lPic->drawPicture(Point(x0 / GLI_SUBPIX, y),
+ Rect(x0 / GLI_SUBPIX, y0, x1 / GLI_SUBPIX, y1));
link = ln->_lHyper;
hy0 = y > y0 ? y : y0;
hy1 = y + ln->_lPic->h < y1 ? y + ln->_lPic->h : y1;
@@ -1084,8 +1085,8 @@ void TextBufferWindow::redraw() {
if (ln->_rPic) {
if (y < y1 && y + ln->_rPic->h > y0) {
- ln->_rPic->drawPicture(x1 / GLI_SUBPIX - ln->_rPic->w, y,
- x0 / GLI_SUBPIX, y0, x1 / GLI_SUBPIX, y1);
+ ln->_rPic->drawPicture(Point(x1 / GLI_SUBPIX - ln->_rPic->w, y),
+ Rect(x0 / GLI_SUBPIX, y0, x1 / GLI_SUBPIX, y1));
link = ln->_rHyper;
hy0 = y > y0 ? y : y0;
hy1 = y + ln->_rPic->h < y1 ? y + ln->_rPic->h : y1;