[Scummvm-git-logs] scummvm master -> d1040441fa8beaddef249d9659884391f48748d1

criezy criezy at scummvm.org
Thu Mar 4 04:17:26 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d1040441fa AGS: Fix drawing text on 16 bit surfaces


Commit: d1040441fa8beaddef249d9659884391f48748d1
    https://github.com/scummvm/scummvm/commit/d1040441fa8beaddef249d9659884391f48748d1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-04T04:17:11Z

Commit Message:
AGS: Fix drawing text on 16 bit surfaces

The transparent color was only set on 32 bit surfaces. So
when drawing text with a TTF font on a 16 bit surface it
was blending the font color with the pink color meant to
be transparent. This resulted in the pink color getting
changed to be a bit less pink around the text, and then
when drawing that on another bitmap it was no longer
equal to the transparent color and we had pink border
on the text on screen.

Changed paths:
    engines/ags/lib/allegro/surface.h


diff --git a/engines/ags/lib/allegro/surface.h b/engines/ags/lib/allegro/surface.h
index c191f37a10..e10ecf8665 100644
--- a/engines/ags/lib/allegro/surface.h
+++ b/engines/ags/lib/allegro/surface.h
@@ -275,13 +275,13 @@ public:
 	Surface(int width, int height, const Graphics::PixelFormat &pixelFormat) :
 			Graphics::ManagedSurface(width, height, pixelFormat), BITMAP(this) {
 		// Allegro uses 255, 0, 255 RGB as the transparent color
-		if (pixelFormat.bytesPerPixel == 4)
+		if (pixelFormat.bytesPerPixel == 2 || pixelFormat.bytesPerPixel == 4)
 			setTransparentColor(pixelFormat.RGBToColor(255, 0, 255));
 	}
 	Surface(Graphics::ManagedSurface &surf, const Common::Rect &bounds) :
 			Graphics::ManagedSurface(surf, bounds), BITMAP(this) {
 		// Allegro uses 255, 0, 255 RGB as the transparent color
-		if (surf.format.bytesPerPixel == 4)
+		if (surf.format.bytesPerPixel == 2 || surf.format.bytesPerPixel == 4)
 			setTransparentColor(surf.format.RGBToColor(255, 0, 255));
 	}
 	~Surface() override {




More information about the Scummvm-git-logs mailing list