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

criezy criezy at scummvm.org
Wed Mar 10 00:28:41 UTC 2021


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

Summary:
a2ed9906e4 AGS Cleanup surface creation
d0ce475e06 AGS: Fix antialiased stretch of sprite


Commit: a2ed9906e44a78a3e84dd778bac7ff053dc11ef1
    https://github.com/scummvm/scummvm/commit/a2ed9906e44a78a3e84dd778bac7ff053dc11ef1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-10T00:28:29Z

Commit Message:
AGS Cleanup surface creation

The main changce is that create_bitmap() now uses the current
get_color_depth(), as it is supposed to (according to the Allegro
documentation).

Also it remove cases where the surface could be created without the transparent color.

Changed paths:
    engines/ags/lib/allegro/surface.cpp
    engines/ags/lib/allegro/surface.h
    engines/ags/shared/gfx/image.cpp


diff --git a/engines/ags/lib/allegro/surface.cpp b/engines/ags/lib/allegro/surface.cpp
index fc5cc14ebf..183bc15177 100644
--- a/engines/ags/lib/allegro/surface.cpp
+++ b/engines/ags/lib/allegro/surface.cpp
@@ -288,7 +288,7 @@ public:
 /*-------------------------------------------------------------------*/
 
 BITMAP *create_bitmap(int width, int height) {
-	return new Surface(width, height);
+	return create_bitmap_ex(get_color_depth(), width, height);
 }
 
 BITMAP *create_bitmap_ex(int color_depth, int width, int height) {
diff --git a/engines/ags/lib/allegro/surface.h b/engines/ags/lib/allegro/surface.h
index 57cee82fd4..ba387cf0f7 100644
--- a/engines/ags/lib/allegro/surface.h
+++ b/engines/ags/lib/allegro/surface.h
@@ -62,7 +62,7 @@ public:
 	}
 
 	uint getTransparentColor() const {
-		return format.RGBToColor(255, 0, 255);
+		return _owner->getTransparentColor();
 	}
 
 	int getpixel(int x, int y) const;
@@ -260,12 +260,6 @@ private:
  */
 class Surface : public Graphics::ManagedSurface, public BITMAP {
 public:
-	Surface() : Graphics::ManagedSurface(), BITMAP(this) {
-	}
-	Surface(const Graphics::ManagedSurface &surf) : Graphics::ManagedSurface(surf), BITMAP(this) {
-	}
-	Surface(int width, int height) : Graphics::ManagedSurface(width, height), BITMAP(this) {
-	}
 	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
diff --git a/engines/ags/shared/gfx/image.cpp b/engines/ags/shared/gfx/image.cpp
index f1ad387fac..dac1b15887 100644
--- a/engines/ags/shared/gfx/image.cpp
+++ b/engines/ags/shared/gfx/image.cpp
@@ -43,8 +43,7 @@ BITMAP *decodeImage(const char *filename, color *pal) {
 		const Graphics::Surface *src = decoder.getSurface();
 
 		// Copy the decoded surface
-		Surface *dest = new Surface();
-		dest->create(src->w, src->h, src->format);
+		Surface *dest = new Surface(src->w, src->h, src->format);
 		dest->blitFrom(*src);
 
 		// Copy the palette


Commit: d0ce475e06761eeaa9815241e5aed59855c555d4
    https://github.com/scummvm/scummvm/commit/d0ce475e06761eeaa9815241e5aed59855c555d4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-10T00:28:29Z

Commit Message:
AGS: Fix antialiased stretch of sprite

This fixes missing actors in some games, such as Blackwell
Deception (on the boat deck where the actors are scaled to
90% or their original size).

The issue was that Allegro has defines to indicate which color
depth are available, and we removed those. But they are used
in the antialiasing code.

Changed paths:
    engines/ags/lib/aastr-0.1.1/aautil.cpp
    engines/ags/lib/allegro/alconfig.h
    engines/ags/lib/allegro/color.h
    engines/ags/lib/allegro/gfx.cpp
    engines/ags/lib/allegro/gfx.h


diff --git a/engines/ags/lib/aastr-0.1.1/aautil.cpp b/engines/ags/lib/aastr-0.1.1/aautil.cpp
index 89ed12033d..75cf50a36d 100644
--- a/engines/ags/lib/aastr-0.1.1/aautil.cpp
+++ b/engines/ags/lib/aastr-0.1.1/aautil.cpp
@@ -37,6 +37,7 @@
 
 #include "ags/lib/aastr-0.1.1/aautil.h"
 #include "ags/globals.h"
+#include "ags/lib/allegro/color.h"
 
 namespace AGS3 {
 
diff --git a/engines/ags/lib/allegro/alconfig.h b/engines/ags/lib/allegro/alconfig.h
index 7e390ee09c..099f040993 100644
--- a/engines/ags/lib/allegro/alconfig.h
+++ b/engines/ags/lib/allegro/alconfig.h
@@ -25,6 +25,11 @@
 
 namespace AGS3 {
 
+/* which color depths to include? */
+#define ALLEGRO_COLOR8
+#define ALLEGRO_COLOR16
+#define ALLEGRO_COLOR24
+#define ALLEGRO_COLOR32
 
 #ifndef INLINE
 #define INLINE
diff --git a/engines/ags/lib/allegro/color.h b/engines/ags/lib/allegro/color.h
index 8c3c74f924..4912a51871 100644
--- a/engines/ags/lib/allegro/color.h
+++ b/engines/ags/lib/allegro/color.h
@@ -139,6 +139,9 @@ extern int getb15(int c);
 extern int getr16(int c);
 extern int getg16(int c);
 extern int getb16(int c);
+extern int getr24(int c);
+extern int getg24(int c);
+extern int getb24(int c);
 extern int getr32(int c);
 extern int getg32(int c);
 extern int getb32(int c);
diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index afa58460eb..b497fac2aa 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -216,6 +216,24 @@ void bmp_write8(byte *addr, int color) {
 	*addr = color;
 }
 
+void bmp_write15(byte *addr, int color) {
+	*((uint16 *)addr) = color;
+}
+
+void bmp_write16(byte *addr, int color) {
+	*((uint16 *)addr) = color;
+}
+
+void bmp_write24(byte *addr, int color) {
+	*addr = (color & 0xff);
+	*(addr+1) = ((color >> 8) & 0xff);
+	*(addr+2) = ((color >> 16) & 0xff);
+}
+
+void bmp_write32(byte *addr, int color) {
+	*((uint32 *)addr) = color;
+}
+
 void memory_putpixel(BITMAP *bmp, int x, int y, int color) {
 	putpixel(bmp, x, y, color);
 }
diff --git a/engines/ags/lib/allegro/gfx.h b/engines/ags/lib/allegro/gfx.h
index 9929e44919..14b8e18351 100644
--- a/engines/ags/lib/allegro/gfx.h
+++ b/engines/ags/lib/allegro/gfx.h
@@ -213,6 +213,10 @@ extern void bmp_select(BITMAP *bmp);
 extern byte *bmp_write_line(BITMAP *bmp, int line);
 extern void bmp_unwrite_line(BITMAP *bmp);
 extern void bmp_write8(byte *addr, int color);
+extern void bmp_write15(byte *addr, int color);
+extern void bmp_write16(byte *addr, int color);
+extern void bmp_write24(byte *addr, int color);
+extern void bmp_write32(byte *addr, int color);
 extern void memory_putpixel(BITMAP *bmp, int x, int y, int color);
 extern void putpixel(BITMAP *bmp, int x, int y, int color);
 extern void _putpixel(BITMAP *bmp, int x, int y, int color);




More information about the Scummvm-git-logs mailing list