Skip to content

Commit

Permalink
BLADERUNNER: Avoid global constructor for pixelformat
Browse files Browse the repository at this point in the history
  • Loading branch information
madmoose authored and sev- committed Sep 29, 2016
1 parent 5a12394 commit 691d0f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions engines/bladerunner/bladerunner.cpp
Expand Up @@ -58,7 +58,8 @@ bool BladeRunnerEngine::hasFeature(EngineFeature f) const {
}

Common::Error BladeRunnerEngine::run() {
initGraphics(640, 480, true, &RGB555);
Graphics::PixelFormat format = createRGB555();
initGraphics(640, 480, true, &format);

if (!startup())
return Common::Error(Common::kUnknownError, "Failed to initialize resources");
Expand All @@ -78,7 +79,7 @@ Common::Error BladeRunnerEngine::run() {
bool BladeRunnerEngine::startup() {
bool r;

_surface1.create(640, 480, RGB555);
_surface1.create(640, 480, createRGB555());

r = openArchive("STARTUP.MIX");
if (!r)
Expand Down
7 changes: 5 additions & 2 deletions engines/bladerunner/bladerunner.h
Expand Up @@ -35,8 +35,6 @@

namespace BladeRunner {

const Graphics::PixelFormat RGB555(2, 5, 5, 5, 0, 10, 5, 0, 0);

class Chapters;
class Scene;
class Script;
Expand Down Expand Up @@ -91,6 +89,11 @@ class BladeRunnerEngine : public Engine {
void ISez(const char *str);
};

static inline
const Graphics::PixelFormat createRGB555() {
return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
}

} // End of namespace BladeRunner

#endif
2 changes: 1 addition & 1 deletion engines/bladerunner/vqa_decoder.cpp
Expand Up @@ -550,7 +550,7 @@ VQADecoder::VQAVideoTrack::VQAVideoTrack(VQADecoder *vqaDecoder) {
_zbufChunk = new uint8[roundup(_maxZBUFChunkSize)];

_surface = new Graphics::Surface();
_surface->create(_width, _height, RGB555);
_surface->create(_width, _height, createRGB555());
}

VQADecoder::VQAVideoTrack::~VQAVideoTrack() {
Expand Down

0 comments on commit 691d0f9

Please sign in to comment.