aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorJohannes Schickel2011-05-01 16:54:45 +0200
committerJohannes Schickel2011-05-01 16:54:45 +0200
commit71bdb86e028db9556611f88b3686ce93312a8131 (patch)
tree3c24233044a8e72bd8ecd73b981f50c725d5d282 /engines/sword25
parent89b63e3adb4692c9659f8b133727ccc1e2af75b4 (diff)
parent8ff527ac4ef4237e63c0802a22eb0f942089e6c4 (diff)
downloadscummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.gz
scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.bz2
scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.zip
Merge pull request #16 "Add a PixelFormat to Graphics::Surface.".
For further discussion check here: https://github.com/scummvm/scummvm/pull/16 Conflicts: graphics/png.cpp
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/fmv/movieplayer.cpp2
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp2
-rw-r--r--engines/sword25/gfx/graphicengine.cpp6
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp9
-rw-r--r--engines/sword25/gfx/screenshot.cpp4
5 files changed, 13 insertions, 10 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index 919e669b68..975f08be22 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -125,7 +125,7 @@ void MoviePlayer::update() {
const Graphics::Surface *s = _decoder.decodeNextFrame();
if (s) {
// Transfer the next frame
- assert(s->bytesPerPixel == 4);
+ assert(s->format.bytesPerPixel == 4);
#ifdef THEORA_INDIRECT_RENDERING
byte *frameData = (byte *)s->getBasePtr(0, 0);
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
index 2b09be74f5..86236fbd21 100644
--- a/engines/sword25/fmv/theora_decoder.cpp
+++ b/engines/sword25/fmv/theora_decoder.cpp
@@ -290,7 +290,7 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
- _surface->create(_theoraInfo.frame_width, _theoraInfo.frame_height, 4);
+ _surface->create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat());
return true;
}
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 502d2d3b2a..8bdf2a4a6e 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -112,8 +112,10 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun
_screenRect.right = _width;
_screenRect.bottom = _height;
- _backSurface.create(width, height, 4);
- _frameBuffer.create(width, height, 4);
+ const Graphics::PixelFormat format = g_system->getScreenFormat();
+
+ _backSurface.create(width, height, format);
+ _frameBuffer.create(width, height, format);
// Standardmäßig ist Vsync an.
setVsync(true);
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index b740c0ec68..806d9b27ad 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -187,7 +187,8 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
// Create an encapsulating surface for the data
Graphics::Surface srcImage;
- srcImage.bytesPerPixel = 4;
+ // TODO: Is the data really in the screen format?
+ srcImage.format = g_system->getScreenFormat();
srcImage.pitch = _width * 4;
srcImage.w = _width;
srcImage.h = _height;
@@ -409,7 +410,7 @@ void RenderedImage::copyDirectly(int posX, int posY) {
*/
Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) {
Graphics::Surface *s = new Graphics::Surface();
- s->create(xSize, ySize, srcImage.bytesPerPixel);
+ s->create(xSize, ySize, srcImage.format);
int *horizUsage = scaleLine(xSize, srcImage.w);
int *vertUsage = scaleLine(ySize, srcImage.h);
@@ -420,8 +421,8 @@ Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int x
byte *destP = (byte *)s->getBasePtr(0, yp);
for (int xp = 0; xp < xSize; ++xp) {
- const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.bytesPerPixel);
- for (int byteCtr = 0; byteCtr < srcImage.bytesPerPixel; ++byteCtr) {
+ const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel);
+ for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) {
*destP++ = *tempSrcP++;
}
}
diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index ee664d6328..6ea2b574d6 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -128,14 +128,14 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data)
// generates a pixel of the target image. Finally, the result as a PNG file is stored as a file.
// The source image must be 800x600.
- if (data->w != 800 || data->h != 600 || data->bytesPerPixel != 4) {
+ if (data->w != 800 || data->h != 600 || data->format.bytesPerPixel != 4) {
error("The sreenshot dimensions have to be 800x600 in order to be saved as a thumbnail.");
return false;
}
// Buffer for the output thumbnail
Graphics::Surface thumbnail;
- thumbnail.create(200, 125, 4);
+ thumbnail.create(200, 125, g_system->getScreenFormat());
// Über das Zielbild iterieren und einen Pixel zur Zeit berechnen.
uint x, y;