Skip to content

Commit

Permalink
SHERLOCK: surface setPixels get pixelformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kiewitz committed Jun 12, 2015
1 parent a08b0b9 commit 6c2c0cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions engines/sherlock/scalpel/scalpel_user_interface.cpp
Expand Up @@ -122,6 +122,9 @@ void ScalpelUserInterface::reset() {
void ScalpelUserInterface::drawInterface(int bufferNum) {
Screen &screen = *_vm->_screen;

if (_vm->getPlatform() == Common::kPlatform3DO)
return; // 3DO: don't do anything for now

if (bufferNum & 1)
screen._backBuffer1.transBlitFrom((*_controlPanel)[0], Common::Point(0, CONTROLS_Y));
if (bufferNum & 2)
Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/screen.cpp
Expand Up @@ -546,7 +546,7 @@ void Screen::makeField(const Common::Rect &r) {

void Screen::setDisplayBounds(const Common::Rect &r) {
assert(r.left == 0 && r.top == 0);
_sceneSurface.setPixels(_backBuffer1.getPixels(), r.width(), r.height());
_sceneSurface.setPixels(_backBuffer1.getPixels(), r.width(), r.height(), _backBuffer1.getPixelFormat());

_backBuffer = &_sceneSurface;
}
Expand Down
8 changes: 6 additions & 2 deletions engines/sherlock/surface.cpp
Expand Up @@ -52,6 +52,10 @@ void Surface::create(uint16 width, uint16 height, Common::Platform platform) {
_freePixels = true;
}

Graphics::PixelFormat Surface::getPixelFormat() {
return _surface.format;
}

void Surface::blitFrom(const Surface &src) {
blitFrom(src, Common::Point(0, 0));
}
Expand Down Expand Up @@ -264,8 +268,8 @@ void Surface::free() {
}
}

void Surface::setPixels(byte *pixels, int width, int height) {
_surface.format = Graphics::PixelFormat::createFormatCLUT8();
void Surface::setPixels(byte *pixels, int width, int height, Graphics::PixelFormat pixelFormat) {
_surface.format = pixelFormat;
_surface.w = _surface.pitch = width;
_surface.h = height;
_surface.setPixels(pixels);
Expand Down
4 changes: 3 additions & 1 deletion engines/sherlock/surface.h
Expand Up @@ -80,6 +80,8 @@ class Surface: public Fonts {
*/
void create(uint16 width, uint16 height, Common::Platform platform);

Graphics::PixelFormat getPixelFormat();

/**
* Copy a surface into this one
*/
Expand Down Expand Up @@ -155,7 +157,7 @@ class Surface: public Fonts {
/**
* Set the pixels for the surface to an existing data block
*/
void setPixels(byte *pixels, int width, int height);
void setPixels(byte *pixels, int width, int height, Graphics::PixelFormat format);

/**
* Draws the given string into the back buffer using the images stored in _font
Expand Down

0 comments on commit 6c2c0cd

Please sign in to comment.