diff options
author | Christoph Mallon | 2011-08-07 14:35:01 +0200 |
---|---|---|
committer | Christoph Mallon | 2011-08-07 15:19:09 +0200 |
commit | e35b4f20c1041b13361aa2ebc4e758873bb1cee3 (patch) | |
tree | b07e8cc3f161fb91f7220d94f24f264cfd13b788 /graphics | |
parent | b4b6ce0954f4a636be0b7b88197376b3917af31f (diff) | |
download | scummvm-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 'graphics')
-rw-r--r-- | graphics/thumbnail.cpp | 17 | ||||
-rw-r--r-- | graphics/thumbnail.h | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index e9576efe7a..3684974117 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -94,23 +94,24 @@ bool skipThumbnail(Common::SeekableReadStream &in) { return true; } -bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) { +Graphics::Surface* loadThumbnail(Common::SeekableReadStream &in) { ThumbnailHeader header; if (!loadHeader(in, header, true)) - return false; + return 0; if (header.bpp != 2) { warning("trying to load thumbnail with unsupported bit depth %d", header.bpp); - return false; + return 0; } Graphics::PixelFormat format = g_system->getOverlayFormat(); - to.create(header.width, header.height, format); + Graphics::Surface *const to = new Graphics::Surface(); + to->create(header.width, header.height, format); - OverlayColor *pixels = (OverlayColor *)to.pixels; - for (int y = 0; y < to.h; ++y) { - for (int x = 0; x < to.w; ++x) { + OverlayColor *pixels = (OverlayColor *)to->pixels; + for (int y = 0; y < to->h; ++y) { + for (int x = 0; x < to->w; ++x) { uint8 r, g, b; colorToRGB<ColorMasks<565> >(in.readUint16BE(), r, g, b); @@ -119,7 +120,7 @@ bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) { } } - return true; + return to; } bool saveThumbnail(Common::WriteStream &out) { diff --git a/graphics/thumbnail.h b/graphics/thumbnail.h index 452125cb47..babc35bd5f 100644 --- a/graphics/thumbnail.h +++ b/graphics/thumbnail.h @@ -53,7 +53,7 @@ bool skipThumbnail(Common::SeekableReadStream &in); * The loaded thumbnail will be automatically converted to the * current overlay pixelformat. */ -bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to); +Graphics::Surface* loadThumbnail(Common::SeekableReadStream &in); /** * Saves a thumbnail to the given write stream. |