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

moralrecordings code at moral.net.au
Sat Jan 11 04:41:36 UTC 2020


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:
56aa8f3448 GRAPHICS: Fix arguments order in drawRect
ff6e864392 DIRECTOR: Seperate render pass for shape fill and stroke


Commit: 56aa8f3448c168abd0dc62ed283e92f7cb29f04b
    https://github.com/scummvm/scummvm/commit/56aa8f3448c168abd0dc62ed283e92f7cb29f04b
Author: Scott Percival (code at moral.net.au)
Date: 2020-01-11T11:55:45+08:00

Commit Message:
GRAPHICS: Fix arguments order in drawRect

Changed paths:
    graphics/primitives.cpp


diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 60898aa..fd6c8fb 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -247,8 +247,8 @@ void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, in
 void drawRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
 	drawHLine(rect.left, rect.right, rect.top, color, plotProc, data);
 	drawHLine(rect.left, rect.right, rect.bottom, color, plotProc, data);
-	drawVLine(rect.top, rect.bottom, rect.left, color, plotProc, data);
-	drawVLine(rect.top, rect.bottom, rect.right, color, plotProc, data);
+	drawVLine(rect.left, rect.top, rect.bottom, color, plotProc, data);
+	drawVLine(rect.right, rect.top, rect.bottom, color, plotProc, data);
 }
 
 // http://members.chello.at/easyfilter/bresenham.html


Commit: ff6e864392cdf9089aeaeee085dcafd0440b8049
    https://github.com/scummvm/scummvm/commit/ff6e864392cdf9089aeaeee085dcafd0440b8049
Author: Scott Percival (code at moral.net.au)
Date: 2020-01-11T12:31:53+08:00

Commit Message:
DIRECTOR: Seperate render pass for shape fill and stroke

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 71bbc34..880842f 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -708,14 +708,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
 	}
 
 	// for outlined shapes, line thickness of 1 means invisible.
-	// filled shapes need at least a line thickness of 1 for MacPlot to render them
-	if (spriteType == kOutlinedRectangleSprite ||
-		spriteType == kOutlinedRoundedRectangleSprite ||
-		spriteType == kOutlinedOvalSprite ||
-		spriteType == kLineBottomTopSprite ||
-		spriteType == kLineTopBottomSprite) {
-		lineSize -= 1;
-	}
+	lineSize -= 1;
 
 	Common::Rect shapeRect = Common::Rect(sp->_startPoint.x,
 		sp->_startPoint.y,
@@ -726,42 +719,55 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
 	tmpSurface.create(shapeRect.width(), shapeRect.height(), Graphics::PixelFormat::createFormatCLUT8());
 	tmpSurface.clear(255);
 
-	// No minus one on the pattern here! MacPlotData will do that for us!
-	//Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), 1, 0, 0, 1, sp->_backColor);
-	Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), -shapeRect.left, -shapeRect.top, lineSize, backColor);
-	Common::Rect fillRect(MAX((int)shapeRect.width() - lineSize, 0), MAX((int)shapeRect.height() - lineSize, 0));
 
+	// Draw fill
+	Common::Rect fillRect((int)shapeRect.width(), (int)shapeRect.height());
+	Graphics::MacPlotData plotFill(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), -shapeRect.left, -shapeRect.top, 1, backColor);
 	switch (spriteType) {
 	case kRectangleSprite:
-		Graphics::drawFilledRect(fillRect, foreColor, Graphics::macDrawPixel, &pd);
+		Graphics::drawFilledRect(fillRect, foreColor, Graphics::macDrawPixel, &plotFill);
 		break;
 	case kRoundedRectangleSprite:
-		Graphics::drawRoundRect(fillRect, 12, foreColor, true, Graphics::macDrawPixel, &pd);
+		Graphics::drawRoundRect(fillRect, 12, foreColor, true, Graphics::macDrawPixel, &plotFill);
 		break;
 	case kOvalSprite:
-		Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, foreColor, true, Graphics::macDrawPixel, &pd);
+		Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, foreColor, true, Graphics::macDrawPixel, &plotFill);
+		break;
+	case kCastMemberSprite: 		// Face kit D3
+		Graphics::drawFilledRect(fillRect, foreColor, Graphics::macDrawPixel, &plotFill);
 		break;
+	default:
+		break;
+	}
+
+	// Draw stroke
+	Common::Rect strokeRect(MAX((int)shapeRect.width() - lineSize, 0), MAX((int)shapeRect.height() - lineSize, 0));
+	Graphics::MacPlotData plotStroke(&tmpSurface, &_vm->getPatterns(), 1, -shapeRect.left, -shapeRect.top, lineSize, backColor);
+	switch (spriteType) {
 	case kLineTopBottomSprite:
-		Graphics::drawLine(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, foreColor, Graphics::macDrawPixel, &pd);
+		Graphics::drawLine(strokeRect.left, strokeRect.top, strokeRect.right, strokeRect.bottom, foreColor, Graphics::macDrawPixel, &plotStroke);
 		break;
 	case kLineBottomTopSprite:
-		Graphics::drawLine(fillRect.left, fillRect.bottom, fillRect.right, fillRect.top, foreColor, Graphics::macDrawPixel, &pd);
+		Graphics::drawLine(strokeRect.left, strokeRect.bottom, strokeRect.right, strokeRect.top, foreColor, Graphics::macDrawPixel, &plotStroke);
 		break;
+	case kRectangleSprite:
+		// fall through
 	case kOutlinedRectangleSprite:	// this is actually a mouse-over shape? I don't think it's a real button.
-		//Graphics::drawRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
-		tmpSurface.fillRect(Common::Rect(shapeRect.width(), shapeRect.height()), (_vm->getCurrentScore()->_currentMouseDownSpriteId == spriteId ? 0 : 0xff));
+		Graphics::drawRect(strokeRect, foreColor, Graphics::macDrawPixel, &plotStroke);
+		//tmpSurface.fillRect(Common::Rect(shapeRect.width(), shapeRect.height()), (_vm->getCurrentScore()->_currentMouseDownSpriteId == spriteId ? 0 : 0xff));
 		break;
+	case kRoundedRectangleSprite:
+		// fall through
 	case kOutlinedRoundedRectangleSprite:
-		Graphics::drawRoundRect(fillRect, 12, foreColor, false, Graphics::macDrawPixel, &pd);
+		Graphics::drawRoundRect(strokeRect, 12, foreColor, false, Graphics::macDrawPixel, &plotStroke);
 		break;
+	case kOvalSprite:
+		// fall through
 	case kOutlinedOvalSprite:
-		Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, foreColor, false, Graphics::macDrawPixel, &pd);
-		break;
-	case kCastMemberSprite: 		// Face kit D3
-		Graphics::drawFilledRect(fillRect, foreColor, Graphics::macDrawPixel, &pd);
+		Graphics::drawEllipse(strokeRect.left, strokeRect.top, strokeRect.right, strokeRect.bottom, foreColor, false, Graphics::macDrawPixel, &plotStroke);
 		break;
 	default:
-		warning("Frame::renderShape(): Unhandled sprite type: %d", sp->_spriteType);
+		break;
 	}
 
 	addDrawRect(spriteId, shapeRect);




More information about the Scummvm-git-logs mailing list