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

dreammaster dreammaster at scummvm.org
Tue Mar 2 02:36:48 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:
00472f09ad AGS: Remove deprecated assert
b8a6375067 AGS: Implement draw clipping rect handling


Commit: 00472f09ad5287488600bd611714459435fb6b4e
    https://github.com/scummvm/scummvm/commit/00472f09ad5287488600bd611714459435fb6b4e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-01T18:36:38-08:00

Commit Message:
AGS: Remove deprecated assert

Changed paths:
    engines/ags/lib/allegro/gfx.cpp


diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index f592352aaf..dffde9758d 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -146,8 +146,6 @@ void stretch_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y, int w, int
 }
 
 void draw_trans_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y) {
-	assert(sprite->format.bytesPerPixel == 4);
-
 	bmp->draw(sprite, Common::Rect(0, 0, sprite->w, sprite->h),
 		Common::Rect(x, y, x + sprite->w, y + sprite->h),
 		false, false, true, trans_blend_alpha);


Commit: b8a6375067654e7efe70114ec7a3b0b3343e0ae6
    https://github.com/scummvm/scummvm/commit/b8a6375067654e7efe70114ec7a3b0b3343e0ae6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-01T18:36:38-08:00

Commit Message:
AGS: Implement draw clipping rect handling

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


diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index dffde9758d..ccee91ef17 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -73,10 +73,6 @@ void get_clip_rect(BITMAP *bitmap, int *x1, int *y1, int *x2, int *y2) {
 		*y2 = bitmap->cb;
 }
 
-void add_clip_rect(BITMAP *bitmap, int x1, int y1, int x2, int y2) {
-	warning("TODO: add_clip_rect");
-}
-
 void acquire_bitmap(BITMAP *bitmap) {
 	// No implementation needed
 }
diff --git a/engines/ags/lib/allegro/gfx.h b/engines/ags/lib/allegro/gfx.h
index a25a893b4b..9929e44919 100644
--- a/engines/ags/lib/allegro/gfx.h
+++ b/engines/ags/lib/allegro/gfx.h
@@ -179,7 +179,6 @@ AL_FUNC(int, get_color_conversion, ());
 AL_FUNC(int, set_gfx_mode, (int card, int w, int h, int v_w, int v_h));
 
 AL_FUNC(void, set_clip_rect, (BITMAP *bitmap, int x1, int y1, int x2, int y2));
-AL_FUNC(void, add_clip_rect, (BITMAP *bitmap, int x1, int y1, int x2, int y2));
 AL_FUNC(void, get_clip_rect, (BITMAP *bitmap, int *x1, int *y1, int *x2, int *y2));
 AL_FUNC(void, clear_bitmap, (BITMAP *bitmap));
 
diff --git a/engines/ags/lib/allegro/surface.cpp b/engines/ags/lib/allegro/surface.cpp
index 9ff1f3f0dd..58ecc098f0 100644
--- a/engines/ags/lib/allegro/surface.cpp
+++ b/engines/ags/lib/allegro/surface.cpp
@@ -95,15 +95,23 @@ const int SCALE_THRESHOLD = 0x100;
 #define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
 
 void BITMAP::draw(const BITMAP *srcBitmap, const Common::Rect &srcRect,
-		const Common::Rect &destRect, bool horizFlip, bool vertFlip,
+		const Common::Rect &dstRect, bool horizFlip, bool vertFlip,
 		bool skipTrans, int srcAlpha, int tintRed, int tintGreen,
 		int tintBlue) {
 	assert(format.bytesPerPixel == 2 || format.bytesPerPixel == 4 ||
 		(format.bytesPerPixel == 1 && srcBitmap->format.bytesPerPixel == 1));
 
+	// Get source and dest surface. Note that for the destination we create
+	// a temporary sub-surface based on the allowed clipping area
 	const Graphics::ManagedSurface &src = **srcBitmap;
-	Graphics::ManagedSurface &dest = *_owner;
+	Graphics::ManagedSurface &allDest = *_owner;
+	Graphics::ManagedSurface dest(allDest, Common::Rect(cl, ct, cr, cb));
+
+	Common::Rect destRect = dstRect;
+	destRect.translate(-cl, -ct);
 	Graphics::Surface destArea = dest.getSubArea(destRect);
+
+	// Define scaling and other stuff used by the drawing loops
 	const int scaleX = SCALE_THRESHOLD * srcRect.width() / destRect.width();
 	const int scaleY = SCALE_THRESHOLD * srcRect.height() / destRect.height();
 	const int xDir = horizFlip ? -1 : 1;




More information about the Scummvm-git-logs mailing list