GRAPHICS: Support bliting CLUT8 Surface in non-CLUT8 ManagedSurface
The inner blitting code already handled that case, but we needed to be able to pass the Surface palette to that inner code.
This commit is contained in:
parent
85b832d02e
commit
4b61397acd
2 changed files with 51 additions and 30 deletions
|
@ -226,23 +226,23 @@ void ManagedSurface::copyFrom(const Surface &surf) {
|
|||
memset(_palette, 0, sizeof(_palette));
|
||||
}
|
||||
|
||||
void ManagedSurface::blitFrom(const Surface &src) {
|
||||
blitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Point(0, 0));
|
||||
void ManagedSurface::blitFrom(const Surface &src, const byte *srcPalette) {
|
||||
blitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Point(0, 0), srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::blitFrom(const Surface &src, const Common::Point &destPos) {
|
||||
blitFrom(src, Common::Rect(0, 0, src.w, src.h), destPos);
|
||||
void ManagedSurface::blitFrom(const Surface &src, const Common::Point &destPos, const byte *srcPalette) {
|
||||
blitFrom(src, Common::Rect(0, 0, src.w, src.h), destPos, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::blitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Point &destPos) {
|
||||
const Common::Point &destPos, const byte *srcPalette) {
|
||||
blitFromInner(src, srcRect, Common::Rect(destPos.x, destPos.y, destPos.x + srcRect.width(),
|
||||
destPos.y + srcRect.height()), nullptr);
|
||||
destPos.y + srcRect.height()), srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::blitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Rect &destRect) {
|
||||
blitFromInner(src, srcRect, destRect, nullptr);
|
||||
const Common::Rect &destRect, const byte *srcPalette) {
|
||||
blitFromInner(src, srcRect, destRect, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::blitFrom(const ManagedSurface &src) {
|
||||
|
@ -429,40 +429,44 @@ void ManagedSurface::blitFromInner(const Surface &src, const Common::Rect &srcRe
|
|||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, uint32 transColor, bool flipped,
|
||||
uint32 overrideColor, uint32 srcAlpha) {
|
||||
uint32 overrideColor, uint32 srcAlpha, const byte *srcPalette) {
|
||||
transBlitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Rect(0, 0, this->w, this->h),
|
||||
transColor, flipped, overrideColor, srcAlpha);
|
||||
transColor, flipped, overrideColor, srcAlpha, nullptr, false, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha) {
|
||||
uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha, const byte *srcPalette) {
|
||||
transBlitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Rect(destPos.x, destPos.y,
|
||||
destPos.x + src.w, destPos.y + src.h), transColor, flipped, overrideColor, srcAlpha);
|
||||
destPos.x + src.w, destPos.y + src.h), transColor, flipped, overrideColor, srcAlpha, nullptr, false, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
const ManagedSurface &mask) {
|
||||
const ManagedSurface &mask, const byte *srcPalette) {
|
||||
transBlitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Rect(destPos.x, destPos.y,
|
||||
destPos.x + src.w, destPos.y + src.h), 0, false, 0, 0xff, &mask._innerSurface, true);
|
||||
destPos.x + src.w, destPos.y + src.h), 0, false, 0, 0xff, &mask._innerSurface, true, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
const Surface &mask) {
|
||||
const Surface &mask, const byte *srcPalette) {
|
||||
transBlitFrom(src, Common::Rect(0, 0, src.w, src.h), Common::Rect(destPos.x, destPos.y,
|
||||
destPos.x + src.w, destPos.y + src.h), 0, false, 0, 0xff, &mask, true);
|
||||
destPos.x + src.w, destPos.y + src.h), 0, false, 0, 0xff, &mask, true, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Point &destPos, uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha) {
|
||||
const Common::Point &destPos, uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha, const byte *srcPalette) {
|
||||
transBlitFrom(src, srcRect, Common::Rect(destPos.x, destPos.y,
|
||||
destPos.x + srcRect.width(), destPos.y + srcRect.height()), transColor, flipped, overrideColor, srcAlpha);
|
||||
destPos.x + srcRect.width(), destPos.y + srcRect.height()), transColor, flipped, overrideColor, srcAlpha, nullptr, false, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const byte *srcPalette) {
|
||||
transBlitFrom(src, srcRect, destRect, 0, false, 0, 0xff, nullptr, false, srcPalette);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Rect &destRect, uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha,
|
||||
const Surface *mask, bool maskOnly) {
|
||||
const Surface *mask, bool maskOnly, const byte *srcPalette) {
|
||||
transBlitFromInner(src, srcRect, destRect, transColor, flipped, overrideColor, srcAlpha,
|
||||
nullptr, nullptr, mask, maskOnly);
|
||||
srcPalette, nullptr, mask, maskOnly);
|
||||
}
|
||||
|
||||
void ManagedSurface::transBlitFrom(const ManagedSurface &src, uint32 transColor, bool flipped,
|
||||
|
|
|
@ -303,24 +303,24 @@ public:
|
|||
/**
|
||||
* Copy another surface into this one.
|
||||
*/
|
||||
void blitFrom(const Surface &src);
|
||||
void blitFrom(const Surface &src, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one at a given destination position.
|
||||
*/
|
||||
void blitFrom(const Surface &src, const Common::Point &destPos);
|
||||
void blitFrom(const Surface &src, const Common::Point &destPos, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one at a given destination position.
|
||||
*/
|
||||
void blitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Point &destPos);
|
||||
const Common::Point &destPos, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one at a given destination area and perform the potential scaling.
|
||||
*/
|
||||
void blitFrom(const Surface &src, const Common::Rect &srcRect,
|
||||
const Common::Rect &destRect);
|
||||
const Common::Rect &destRect, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one at a given destination area and perform the potential scaling.
|
||||
|
@ -353,9 +353,10 @@ public:
|
|||
* @param overrideColor Optional color to use instead of non-transparent pixels from
|
||||
* the source surface.
|
||||
* @param srcAlpha Optional additional transparency applied to @p src.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, uint32 transColor = 0, bool flipped = false,
|
||||
uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
|
||||
uint32 overrideColor = 0, uint32 srcAlpha = 0xff, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
@ -367,9 +368,10 @@ public:
|
|||
* @param overrideColor Optional color to use instead of non-transparent pixels from
|
||||
* the source surface.
|
||||
* @param srcAlpha Optional additional transparency applied to @p src.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
uint32 transColor = 0, bool flipped = false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
|
||||
uint32 transColor = 0, bool flipped = false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
@ -377,9 +379,10 @@ public:
|
|||
* @param src Source surface.
|
||||
* @param destPos Destination position to draw the surface.
|
||||
* @param mask Mask definition.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
const ManagedSurface &mask);
|
||||
const ManagedSurface &mask, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
@ -387,9 +390,10 @@ public:
|
|||
* @param src Source surface.
|
||||
* @param destPos Destination position to draw the surface.
|
||||
* @param mask Mask definition.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Point &destPos,
|
||||
const Surface &mask);
|
||||
const Surface &mask, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
@ -402,9 +406,21 @@ public:
|
|||
* @param overrideColor Optional color to use instead of non-transparent pixels from
|
||||
* the source surface.
|
||||
* @param srcAlpha Optional additional transparency applied to @p src.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos,
|
||||
uint32 transColor = 0, bool flipped = false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
|
||||
uint32 transColor = 0, bool flipped = false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
*
|
||||
* @param src Source surface.
|
||||
* @param srcRect Subsection of the source surface to draw.
|
||||
* @param destRect Destination area to draw the surface in. This can be sized differently
|
||||
* then @p srcRect, allowing for arbitrary scaling of the image.
|
||||
* @param srcPalette Palette for the CLUT8 @p src surface.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const byte *srcPalette);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
@ -420,10 +436,11 @@ public:
|
|||
* @param srcAlpha Optional additional transparency applied to @p src.
|
||||
* @param mask Optional parameter with mask definition.
|
||||
* @param maskOnly Optional parameter for using mask over @p transColor.
|
||||
* @param srcPalette Optional palette if the @p src surface uses a CLUT8 pixel format.
|
||||
*/
|
||||
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect,
|
||||
uint32 transColor = 0, bool flipped = false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
|
||||
const Surface *mask = nullptr, bool maskOnly = false);
|
||||
const Surface *mask = nullptr, bool maskOnly = false, const byte *srcPalette = nullptr);
|
||||
|
||||
/**
|
||||
* Copy another surface into this one, ignoring pixels of a designated transparent color.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue