mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 07:30:56 +00:00
GRAPHICS: Add Surface::copyRectToSurfaceWithKey()
This commit is contained in:
parent
6aadac6ef7
commit
07498687bd
@ -533,6 +533,24 @@ public:
|
||||
_innerSurface.copyRectToSurface(srcSurface, destX, destY, subRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a bitmap to the internal buffer of the surface.
|
||||
*
|
||||
* The pixel format of the buffer must match the pixel format of the surface.
|
||||
*/
|
||||
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key) {
|
||||
_innerSurface.copyRectToSurfaceWithKey(buffer, srcPitch, destX, destY, width, height, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a bitmap to the internal buffer of the surface.
|
||||
*
|
||||
* The pixel format of the buffer must match the pixel format of the surface.
|
||||
*/
|
||||
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key) {
|
||||
_innerSurface.copyRectToSurfaceWithKey(srcSurface, destX, destY, subRect, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the data from another surface, reinitializing the
|
||||
* surface to match the dimensions of the passed surface.
|
||||
|
@ -188,6 +188,26 @@ void Surface::copyRectToSurface(const Graphics::Surface &srcSurface, int destX,
|
||||
copyRectToSurface(srcSurface.getBasePtr(subRect.left, subRect.top), srcSurface.pitch, destX, destY, subRect.width(), subRect.height());
|
||||
}
|
||||
|
||||
void Surface::copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key) {
|
||||
assert(buffer);
|
||||
|
||||
assert(destX >= 0 && destX < w);
|
||||
assert(destY >= 0 && destY < h);
|
||||
assert(height > 0 && destY + height <= h);
|
||||
assert(width > 0 && destX + width <= w);
|
||||
|
||||
// Copy buffer data to internal buffer
|
||||
const byte *src = (const byte *)buffer;
|
||||
byte *dst = (byte *)getBasePtr(destX, destY);
|
||||
Graphics::keyBlit(dst, src, pitch, srcPitch, width, height, format.bytesPerPixel, key);
|
||||
}
|
||||
|
||||
void Surface::copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key) {
|
||||
assert(srcSurface.format == format);
|
||||
|
||||
copyRectToSurfaceWithKey(srcSurface.getBasePtr(subRect.left, subRect.top), srcSurface.pitch, destX, destY, subRect.width(), subRect.height(), key);
|
||||
}
|
||||
|
||||
void Surface::hLine(int x, int y, int x2, uint32 color) {
|
||||
// Clipping
|
||||
if (y < 0 || y >= h)
|
||||
|
@ -289,6 +289,34 @@ public:
|
||||
*/
|
||||
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect);
|
||||
|
||||
/**
|
||||
* Copy a bitmap to the internal buffer of the surface.
|
||||
*
|
||||
* The pixel format of the buffer must match the pixel format of the surface.
|
||||
*
|
||||
* @param buffer Buffer containing the graphics data source.
|
||||
* @param srcPitch Pitch of the buffer (number of bytes in a scanline).
|
||||
* @param destX The x coordinate of the destination rectangle.
|
||||
* @param destY The y coordinate of the destination rectangle.
|
||||
* @param width Width of the destination rectangle.
|
||||
* @param height Height of the destination rectangle.
|
||||
* @param key
|
||||
*/
|
||||
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key);
|
||||
|
||||
/**
|
||||
* Copy a bitmap to the internal buffer of the surface.
|
||||
*
|
||||
* The pixel format of the buffer must match the pixel format of the surface.
|
||||
*
|
||||
* @param srcSurface Source of the bitmap data.
|
||||
* @param destX The x coordinate of the destination rectangle.
|
||||
* @param destY The y coordinate of the destination rectangle.
|
||||
* @param subRect The subRect of the surface to be blitted.
|
||||
* @param key
|
||||
*/
|
||||
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key);
|
||||
|
||||
/**
|
||||
* Convert the data to another pixel format.
|
||||
*
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "common/system.h"
|
||||
#include "common/translation.h"
|
||||
#include "common/util.h"
|
||||
#include "graphics/conversion.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/fonts/amigafont.h"
|
||||
#include "gui/about.h"
|
||||
@ -1099,7 +1098,7 @@ void EE::draw(int sn, int x1, int y1) {
|
||||
int x = x1 * _scale;
|
||||
int y = y1 * _scale;
|
||||
|
||||
Graphics::keyBlit((byte *)_back.getBasePtr(x, y), (const byte *)_sp[sn].getPixels(), _back.pitch, _sp[sn].pitch, _sp[sn].w, _sp[sn].h, _back.format.bytesPerPixel, _colorKey);
|
||||
_back.copyRectToSurfaceWithKey(_sp[sn].getPixels(), _sp[sn].pitch, x, y, _sp[sn].w, _sp[sn].h, _colorKey);
|
||||
g_system->copyRectToOverlay(_back.getBasePtr(x, y), _back.pitch, _windowX + x, _windowY + y, _sp[sn].w, _sp[sn].h);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user