[Scummvm-git-logs] scummvm master -> 79a752c4f29f3cea11bad1b6d48af59700f09840
neuromancer
noreply at scummvm.org
Mon Jun 6 08:05:44 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ecc726ff8a HYPNO: Replace use of Graphics::ManagedSurface with Graphics::Surface
79a752c4f2 HYPNO: Avoid unnecessary scaling
Commit: ecc726ff8a6e74d3a622ee971ee2a4bb3d607085
https://github.com/scummvm/scummvm/commit/ecc726ff8a6e74d3a622ee971ee2a4bb3d607085
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-06-06T10:05:41+02:00
Commit Message:
HYPNO: Replace use of Graphics::ManagedSurface with Graphics::Surface
Changed paths:
engines/hypno/hypno.cpp
engines/hypno/hypno.h
diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index 2c6052196b0..7076d3f969d 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -136,7 +136,7 @@ Common::Error HypnoEngine::run() {
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
initGraphics(_screenW, _screenH, &_pixelFormat);
- _compositeSurface = new Graphics::ManagedSurface();
+ _compositeSurface = new Graphics::Surface();
_compositeSurface->create(_screenW, _screenH, _pixelFormat);
// Main event loop
@@ -318,10 +318,16 @@ void HypnoEngine::loadImage(const Common::String &name, int x, int y, bool trans
}
void HypnoEngine::drawImage(Graphics::Surface &surf, int x, int y, bool transparent) {
+ Common::Rect srcRect(surf.w, surf.h);
+ Common::Rect dstRect = srcRect;
+
+ dstRect.moveTo(x, y);
+ _compositeSurface->clip(srcRect, dstRect);
+
if (transparent) {
- _compositeSurface->transBlitFrom(surf, Common::Point(x, y), _transparentColor);
+ _compositeSurface->copyRectToSurfaceWithKey(surf, dstRect.left, dstRect.top, srcRect, _transparentColor);
} else
- _compositeSurface->blitFrom(surf, Common::Point(x, y));
+ _compositeSurface->copyRectToSurface(surf, dstRect.left, dstRect.top, srcRect);
}
Graphics::Surface *HypnoEngine::decodeFrame(const Common::String &name, int n, byte **palette) {
@@ -390,11 +396,8 @@ void HypnoEngine::changeScreenMode(const Common::String &mode) {
_compositeSurface->free();
delete _compositeSurface;
- _compositeSurface = new Graphics::ManagedSurface();
+ _compositeSurface = new Graphics::Surface();
_compositeSurface->create(_screenW, _screenH, _pixelFormat);
-
- _compositeSurface->setTransparentColor(_transparentColor);
-
} else if (mode == "320x200") {
if (_screenW == 320 && _screenH == 200)
return;
@@ -407,10 +410,8 @@ void HypnoEngine::changeScreenMode(const Common::String &mode) {
_compositeSurface->free();
delete _compositeSurface;
- _compositeSurface = new Graphics::ManagedSurface();
+ _compositeSurface = new Graphics::Surface();
_compositeSurface->create(_screenW, _screenH, _pixelFormat);
-
- _compositeSurface->setTransparentColor(_transparentColor);
} else
error("Unknown screen mode %s", mode.c_str());
}
@@ -462,20 +463,31 @@ void HypnoEngine::updateScreen(MVideo &video) {
if (video.scaled) {
Graphics::Surface *sframe = frame->scale(_screenW, _screenH);
+ Common::Rect srcRect(sframe->w, sframe->h);
+ Common::Rect dstRect = srcRect;
+
+ dstRect.moveTo(video.position);
+ _compositeSurface->clip(srcRect, dstRect);
if (video.transparent) {
- _compositeSurface->transBlitFrom(*sframe, video.position, _transparentColor);
+ _compositeSurface->copyRectToSurfaceWithKey(*sframe, dstRect.left, dstRect.top, srcRect, _transparentColor);
} else {
- _compositeSurface->blitFrom(*sframe, video.position);
+ _compositeSurface->copyRectToSurface(*sframe, dstRect.left, dstRect.top, srcRect);
}
sframe->free();
delete sframe;
} else {
+ Common::Rect srcRect(frame->w, frame->h);
+ Common::Rect dstRect = srcRect;
+
+ dstRect.moveTo(video.position);
+ _compositeSurface->clip(srcRect, dstRect);
+
if (video.transparent) {
- _compositeSurface->transBlitFrom(*frame, video.position, _transparentColor);
+ _compositeSurface->copyRectToSurfaceWithKey(*frame, dstRect.left, dstRect.top, srcRect, _transparentColor);
} else {
- _compositeSurface->blitFrom(*frame, video.position);
+ _compositeSurface->copyRectToSurface(*frame, dstRect.left, dstRect.top, srcRect);
}
}
}
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 6df6339d994..dc46d9e4940 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -31,7 +31,7 @@
#include "engines/engine.h"
#include "graphics/font.h"
#include "graphics/fontman.h"
-#include "graphics/managed_surface.h"
+#include "graphics/surface.h"
#include "graphics/palette.h"
#include "hypno/grammar.h"
@@ -41,10 +41,6 @@ namespace Image {
class ImageDecoder;
}
-namespace Graphics {
-class ManagedSurface;
-}
-
struct ADGameDescription;
namespace Hypno {
@@ -202,7 +198,7 @@ public:
int _screenW, _screenH;
Graphics::PixelFormat _pixelFormat;
void changeScreenMode(const Common::String &mode);
- Graphics::ManagedSurface *_compositeSurface;
+ Graphics::Surface *_compositeSurface;
uint32 _transparentColor;
Common::Rect screenRect;
void updateScreen(MVideo &video);
Commit: 79a752c4f29f3cea11bad1b6d48af59700f09840
https://github.com/scummvm/scummvm/commit/79a752c4f29f3cea11bad1b6d48af59700f09840
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-06-06T10:05:41+02:00
Commit Message:
HYPNO: Avoid unnecessary scaling
Changed paths:
engines/hypno/hypno.cpp
diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index 7076d3f969d..e00ae8b1b07 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -450,6 +450,7 @@ void HypnoEngine::updateVideo(MVideo &video) {
void HypnoEngine::updateScreen(MVideo &video) {
const Graphics::Surface *frame = video.decoder->decodeNextFrame();
bool dirtyPalette = video.decoder->hasDirtyPalette();
+ bool isFullscreen = (frame->w == _screenW && frame->h == _screenH);
if (frame->h == 0 || frame->w == 0 || video.decoder->getPalette() == nullptr)
return;
@@ -461,7 +462,7 @@ void HypnoEngine::updateScreen(MVideo &video) {
g_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
}
- if (video.scaled) {
+ if (video.scaled && !isFullscreen) {
Graphics::Surface *sframe = frame->scale(_screenW, _screenH);
Common::Rect srcRect(sframe->w, sframe->h);
Common::Rect dstRect = srcRect;
More information about the Scummvm-git-logs
mailing list