WINTERMUTE: Do not optimize out alpha blits on rotation

This fixes defect #10684: 1-pixel width sprite becomes a big rectangle
if rotation is applied.

Case was originally reproduced with FoxTail game for WME, then reduced
to testcase
https://github.com/tobiatesan/wme_testsuite/tree/master/time_test/packages
This commit is contained in:
lolbot-iichan 2019-06-27 10:59:35 +03:00 committed by Filippos Karapetis
parent 1f0f4c9642
commit fa4d310fb4
2 changed files with 6 additions and 1 deletions

View file

@ -452,7 +452,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect,
// But no checking is in place for that yet.
// Optimize by not doing alpha-blits if we lack alpha
if (_alphaType == Graphics::ALPHA_OPAQUE && !transform._alphaDisable) {
// If angle is not 0, then transparent regions are added near the corners
if (_alphaType == Graphics::ALPHA_OPAQUE && transform._angle == 0) {
transform._alphaDisable = true;
}

View file

@ -117,6 +117,8 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const {
if (_owner) {
if (_transform._alphaDisable) {
src.setAlphaMode(Graphics::ALPHA_OPAQUE);
} else if (_transform._angle) {
src.setAlphaMode(Graphics::ALPHA_FULL);
} else {
src.setAlphaMode(_owner->getAlphaType());
}
@ -149,6 +151,8 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect
if (_owner) {
if (_transform._alphaDisable) {
src.setAlphaMode(Graphics::ALPHA_OPAQUE);
} else if (_transform._angle) {
src.setAlphaMode(Graphics::ALPHA_FULL);
} else {
src.setAlphaMode(_owner->getAlphaType());
}