diff options
author | Paul Gilbert | 2014-08-21 22:15:00 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-21 22:15:00 -0400 |
commit | 41df7734db18cf1cb7a2fe4004e3adef98a8cb41 (patch) | |
tree | 343acb93daa05b61c45d803c5e2430bafd2cb6ad /engines/access | |
parent | 8d1d1f6739b3b9f456d618a8740d754ddac2eb41 (diff) | |
download | scummvm-rg350-41df7734db18cf1cb7a2fe4004e3adef98a8cb41.tar.gz scummvm-rg350-41df7734db18cf1cb7a2fe4004e3adef98a8cb41.tar.bz2 scummvm-rg350-41df7734db18cf1cb7a2fe4004e3adef98a8cb41.zip |
ACCESS: Standardise plotting methods and added comments
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 2 | ||||
-rw-r--r-- | engines/access/asurface.cpp | 63 | ||||
-rw-r--r-- | engines/access/asurface.h | 14 |
3 files changed, 28 insertions, 51 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 32835a01c8..ae03dfc7fa 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -318,7 +318,7 @@ void AccessEngine::plotList1() { if (ie._flags & 2) { _buffer2.plotB(frame, Common::Point(bounds.left, bounds.top)); } else { - _buffer2.plotFrame(frame, Common::Point(bounds.left, bounds.top)); + _buffer2.plotF(frame, Common::Point(bounds.left, bounds.top)); } } } diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index 44686ab8f4..d3503ef645 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -203,50 +203,10 @@ void ASurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Poi _lastBoundsW = r.width(); _lastBoundsH = r.height(); - plotFrame(frame, pt); + plotF(frame, pt); } } -void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt) { - frame->copyTo(this, pt); -// g_system->copyRectToScreen((byte *)getPixels(), 320, 0, 0, 320, 200); -// g_system->updateScreen(); - - -/* - byte *destP = (byte *)getBasePtr(pt.x, _scrollY + pt.y); - byte *srcP = frame->_data; - - int8 leftVal1 = 18; - int8 leftVal2 = -8; - if (_leftSkip) { - ++leftVal2; - leftVal1 = -12; - } - int8 rightVal = (_rightSkip) ? -7 : -8; - - // Skip over any lines of the frame - for (int yp = 0; yp < _topSkip; ++yp) { - srcP += *(srcP + 1) + 2; - } - - byte *srcLineP = srcP; - byte *destLineP = destP; - for (int yp = 0; yp < frame->h; ++yp, srcP = srcLineP, destP = destLineP) { - // Get length of line - int v = *srcP++; - int len = *srcP++; - srcLineP = srcP + len; - destLineP = destP + this->pitch; - - // Draw the line of the frame - if (v != 0 || len != 0) { - warning("TODO: Line draw"); - } - } - */ -} - void ASurface::copyTo(ASurface *dest, const Common::Point &destPos) { for (int yp = 0; yp < h; ++yp) { byte *srcP = (byte *)getBasePtr(0, yp); @@ -305,22 +265,33 @@ void ASurface::copyTo(ASurface *dest, const Common::Rect &bounds) { } } -void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) { + +void ASurface::plotF(SpriteFrame *frame, const Common::Point &pt) { + frame->copyTo(this, pt); +} + +void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) { ASurface flippedFrame; frame->flipHorizontal(flippedFrame); - flippedFrame.copyTo(this, bounds); + flippedFrame.copyTo(this, pt); } void ASurface::sPlotF(SpriteFrame *frame, const Common::Rect &bounds) { frame->copyTo(this, bounds); } -void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) { - frame->copyTo(this, pt); +void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) { + ASurface flippedFrame; + frame->flipHorizontal(flippedFrame); + flippedFrame.copyTo(this, bounds); } void ASurface::copyBlock(ASurface *src, const Common::Rect &bounds) { - copyRectToSurface(*src, bounds.left, bounds.top, bounds); + Common::Rect r = bounds; + r.clip(Common::Rect(0, 0, this->w, this->h)); + + if (r.isValidRect()) + copyRectToSurface(*src, r.left, r.top, r); } void ASurface::saveBlock(const Common::Rect &bounds) { diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 88e156100b..be3597d217 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -54,8 +54,6 @@ public: static void init(); public: - virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt); -public: virtual ~ASurface(); void create(uint16 width, uint16 height); @@ -69,15 +67,23 @@ public: void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt); /** - * Scaled draw frame + * Scaled draw frame in forward orientation */ void sPlotF(SpriteFrame *frame, const Common::Rect &bounds); /** - * Scaled flipped horizontal draw frame + * Scaled draw frame in backwards orientation */ void sPlotB(SpriteFrame *frame, const Common::Rect &bounds); + /** + * Draw an image full-size in forward orientation + */ + void plotF(SpriteFrame *frame, const Common::Point &pt); + + /** + * Draw an image full-size in backwards orientation + */ void plotB(SpriteFrame *frame, const Common::Point &pt); void copyBlock(ASurface *src, const Common::Rect &bounds); |