aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/view.h
diff options
context:
space:
mode:
authorColin Snover2016-12-31 20:39:57 -0600
committerColin Snover2017-03-27 19:42:31 -0500
commit31daa956d62b39429cb6638ed3fb549ac488833a (patch)
treefa831adefae05d82209b3f565055f7b761ca8691 /engines/sci/graphics/view.h
parent1298762b7665dc1b7aeedf0271eadfb284309ef1 (diff)
downloadscummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.tar.gz
scummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.tar.bz2
scummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.zip
SCI: Implement bounds-checked reads of game resources
Diffstat (limited to 'engines/sci/graphics/view.h')
-rw-r--r--engines/sci/graphics/view.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 5e422468b5..808e203682 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -23,6 +23,8 @@
#ifndef SCI_GRAPHICS_VIEW_H
#define SCI_GRAPHICS_VIEW_H
+#include "sci/util.h"
+
namespace Sci {
enum Sci32ViewNativeResolution {
@@ -41,17 +43,19 @@ struct CelInfo {
uint16 offsetEGA;
uint32 offsetRLE;
uint32 offsetLiteral;
- byte *rawBitmap;
+ Common::SpanOwner<SciSpan<const byte> > rawBitmap;
};
struct LoopInfo {
bool mirrorFlag;
uint16 celCount;
- CelInfo *cel;
+ Common::Array<CelInfo> cel;
};
-#define SCI_VIEW_EGAMAPPING_SIZE 16
-#define SCI_VIEW_EGAMAPPING_COUNT 8
+enum {
+ SCI_VIEW_EGAMAPPING_SIZE = 16,
+ SCI_VIEW_EGAMAPPING_COUNT = 8
+};
class GfxScreen;
class GfxPalette;
@@ -73,7 +77,7 @@ public:
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
void getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const;
- const byte *getBitmap(int16 loopNo, int16 celNo);
+ const SciSpan<const byte> &getBitmap(int16 loopNo, int16 celNo);
void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires);
void drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY);
uint16 getLoopCount() const { return _loopCount; }
@@ -88,8 +92,8 @@ public:
private:
void initData(GuiResourceId resourceId);
- void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCount);
- void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey);
+ void unpackCel(int16 loopNo, int16 celNo, SciSpan<byte> &outPtr);
+ void unditherBitmap(SciSpan<byte> &bitmap, int16 width, int16 height, byte clearKey);
ResourceManager *_resMan;
GfxCoordAdjuster16 *_coordAdjuster;
@@ -98,18 +102,16 @@ private:
GuiResourceId _resourceId;
Resource *_resource;
- byte *_resourceData;
- int _resourceSize;
uint16 _loopCount;
- LoopInfo *_loop;
+ Common::Array<LoopInfo> _loop;
bool _embeddedPal;
Palette _viewPalette;
// specifies scaling resolution for SCI2 views (see gk1/windows, Wolfgang in room 720)
Sci32ViewNativeResolution _sci2ScaleRes;
- byte *_EGAmapping;
+ SciSpan<const byte> _EGAmapping;
// this is set for sci0early to adjust for the getCelRect() change
int16 _adjustForSci0Early;