[Scummvm-cvs-logs] scummvm master -> b06cfaed9c2f890551d357fbc88fd7359b7f9158

dreammaster dreammaster at scummvm.org
Mon Aug 3 01:05:50 CEST 2015


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:
b06cfaed9c SHERLOCK: RT: Fix transparency when dragging lab items with cursor


Commit: b06cfaed9c2f890551d357fbc88fd7359b7f9158
    https://github.com/scummvm/scummvm/commit/b06cfaed9c2f890551d357fbc88fd7359b7f9158
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-02T19:04:48-04:00

Commit Message:
SHERLOCK: RT: Fix transparency when dragging lab items with cursor

Changed paths:
    engines/sherlock/events.cpp
    engines/sherlock/surface.h



diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index fb09a31..204db8b 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -27,6 +27,7 @@
 #include "graphics/cursorman.h"
 #include "sherlock/sherlock.h"
 #include "sherlock/events.h"
+#include "sherlock/surface.h"
 
 namespace Sherlock {
 
@@ -120,9 +121,8 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
 	r.moveTo(0, 0);
 
 	// Form a single surface containing both frames
-	Graphics::Surface s;
-	s.create(r.width(), r.height(), Graphics::PixelFormat::createFormatCLUT8());
-	s.fillRect(r, TRANSPARENCY);
+	Surface s(r.width(), r.height());
+	s.fill(TRANSPARENCY);
 
 	// Draw the passed image
 	Common::Point drawPos;
@@ -130,11 +130,11 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
 		drawPos.x = -cursorPt.x;
 	if (cursorPt.y < 0)
 		drawPos.y = -cursorPt.y;
-	s.copyRectToSurface(surface, drawPos.x, drawPos.y, Common::Rect(0, 0, surface.w, surface.h));
+	s.blitFrom(surface, Common::Point(drawPos.x, drawPos.y));
 
 	// Draw the cursor image
 	drawPos = Common::Point(MAX(cursorPt.x, (int16)0), MAX(cursorPt.y, (int16)0));
-	s.copyRectToSurface(cursorImg, drawPos.x, drawPos.y, Common::Rect(0, 0, cursorImg.w, cursorImg.h));
+	s.transBlitFrom(cursorImg, Common::Point(drawPos.x, drawPos.y));
 
 	// Set up hotspot position for cursor, adjusting for cursor image's position within the surface
 	Common::Point hotspot;
@@ -142,7 +142,7 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
 		hotspot = Common::Point(8, 8);
 	hotspot += drawPos;
 	// Set the cursor
-	setCursor(s, hotspot.x, hotspot.y);
+	setCursor(s.getRawSurface(), hotspot.x, hotspot.y);
 }
 
 void Events::animateCursorIfNeeded() {
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index dd1a199..385fb17 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -50,11 +50,6 @@ private:
 	void blitFrom(const Graphics::Surface &src);
 
 	/**
-	 * Draws a surface at a given position within this surface
-	 */
-	void blitFrom(const Graphics::Surface &src, const Common::Point &pt);
-
-	/**
 	 * Draws a sub-section of a surface at a given position within this surface
 	 */
 	void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds);
@@ -113,6 +108,11 @@ public:
 	void blitFrom(const ImageFrame &src, const Common::Point &pt, const Common::Rect &srcBounds);
 
 	/**
+	 * Draws a surface at a given position within this surface
+	 */
+	void blitFrom(const Graphics::Surface &src, const Common::Point &pt);
+
+	/**
 	 * Draws an image frame at a given position within this surface with transparency
 	 */
 	void transBlitFrom(const ImageFrame &src, const Common::Point &pt,
@@ -174,6 +174,7 @@ public:
 	inline byte *getPixels() { return (byte *)_surface.getPixels(); }
 	inline byte *getBasePtr(int x, int y) { return (byte *)_surface.getBasePtr(x, y); }
 	inline const byte *getBasePtr(int x, int y) const { return (const byte *)_surface.getBasePtr(x, y); }
+	inline Graphics::Surface &getRawSurface() { return _surface; }
 	inline void hLine(int x, int y, int x2, uint32 color) { _surface.hLine(x, y, x2, color); }
 	inline void vLine(int x, int y, int y2, uint32 color) { _surface.vLine(x, y, y2, color); }
 };






More information about the Scummvm-git-logs mailing list