aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorChristoph Mallon2011-08-07 14:35:01 +0200
committerChristoph Mallon2011-08-07 15:19:09 +0200
commite35b4f20c1041b13361aa2ebc4e758873bb1cee3 (patch)
treeb07e8cc3f161fb91f7220d94f24f264cfd13b788 /engines
parentb4b6ce0954f4a636be0b7b88197376b3917af31f (diff)
downloadscummvm-rg350-e35b4f20c1041b13361aa2ebc4e758873bb1cee3.tar.gz
scummvm-rg350-e35b4f20c1041b13361aa2ebc4e758873bb1cee3.tar.bz2
scummvm-rg350-e35b4f20c1041b13361aa2ebc4e758873bb1cee3.zip
GRAPHICS: Simplify the interface of Graphics::loadThumbnail().
Now it returns the Surface, so the caller does not need to create one and pass it.
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/detection.cpp7
-rw-r--r--engines/cruise/saveload.cpp7
-rw-r--r--engines/draci/saveload.cpp8
-rw-r--r--engines/hugo/detection.cpp7
-rw-r--r--engines/kyra/saveload.cpp7
-rw-r--r--engines/saga/detection.cpp8
-rw-r--r--engines/sci/detection.cpp8
-rw-r--r--engines/scumm/saveload.cpp7
-rw-r--r--engines/sword1/detection.cpp8
-rw-r--r--engines/teenagent/detection.cpp5
-rw-r--r--engines/toon/detection.cpp7
-rw-r--r--engines/tsage/saveload.cpp7
12 files changed, 16 insertions, 70 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index a0736d0cc3..93fcd2d283 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -258,12 +258,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
char saveVersion = in->readByte();
if (saveVersion >= 4) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index 6392009373..c3d1ea6643 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -62,12 +62,9 @@ bool readSavegameHeader(Common::InSaveFile *in, CruiseSavegameHeader &header) {
while ((ch = (char)in->readByte()) != '\0') header.saveName += ch;
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
return true;
}
diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp
index 1479dd3c77..78315d1a97 100644
--- a/engines/draci/saveload.cpp
+++ b/engines/draci/saveload.cpp
@@ -58,13 +58,9 @@ bool readSavegameHeader(Common::InSaveFile *in, DraciSavegameHeader &header) {
header.playtime = in->readUint32LE();
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- header.thumbnail->free();
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
return true;
}
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index f70a21aa8f..5d972f5658 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -241,12 +241,7 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s
SaveStateDescriptor desc(slot, saveName);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*file, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index f41cf0c6e3..42c5d3e8a8 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -113,12 +113,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
if (header.version >= 14) {
if (loadThumbnail) {
- header.thumbnail = new Graphics::Surface();
- assert(header.thumbnail);
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = 0;
- }
+ header.thumbnail = Graphics::loadThumbnail(*in);
} else {
Graphics::skipThumbnail(*in);
}
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 2f1b61eed8..091ec8d427 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -256,13 +256,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s
desc.setWriteProtectedFlag(false);
if (version >= 6) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
uint32 saveDate = in->readUint32BE();
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 82f762e3db..33ca3a6c9c 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -676,13 +676,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
SaveStateDescriptor desc(slot, meta.name);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 3cc710c207..870ec8cdf7 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -686,12 +686,7 @@ Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int sl
Graphics::Surface *thumb = 0;
if (Graphics::checkThumbnailHeader(*in)) {
- thumb = new Graphics::Surface();
- assert(thumb);
- if (!Graphics::loadThumbnail(*in, *thumb)) {
- delete thumb;
- thumb = 0;
- }
+ thumb = Graphics::loadThumbnail(*in);
}
delete in;
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 0c1e74082f..4da636bce9 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -274,13 +274,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
in->skip(1);
if (Graphics::checkThumbnailHeader(*in)) {
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*in, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
-
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
desc.setThumbnail(thumbnail);
}
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index 72a338664b..fa5a578636 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -177,9 +177,8 @@ public:
ssd.setDeletableFlag(true);
//checking for the thumbnail
- Common::ScopedPtr<Graphics::Surface> thumb(new Graphics::Surface);
- if (Graphics::loadThumbnail(*in, *thumb))
- ssd.setThumbnail(thumb.release());
+ if (Graphics::Surface *const thumb = Graphics::loadThumbnail(*in))
+ ssd.setThumbnail(thumb);
return ssd;
}
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index 810a37720a..ac4caae8b2 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -224,12 +224,7 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s
SaveStateDescriptor desc(slot, saveName);
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- if (!Graphics::loadThumbnail(*file, *thumbnail)) {
- delete thumbnail;
- thumbnail = 0;
- }
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
desc.setThumbnail(thumbnail);
desc.setDeletableFlag(true);
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index 40444cd630..e07964d443 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -249,12 +249,9 @@ bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &head
while ((ch = (char)in->readByte()) != '\0') header.saveName += ch;
// Get the thumbnail
- header.thumbnail = new Graphics::Surface();
- if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
- delete header.thumbnail;
- header.thumbnail = NULL;
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail)
return false;
- }
// Read in save date/time
header.saveYear = in->readSint16LE();