Blob Blame History Raw
From d490cf0a31b1a64c604082b814cc2c3588a73a08 Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Thu, 5 Jan 2017 23:37:21 +0100
Subject: [PATCH] Fix drawing of transparent nodes without --drawalpha (fixes
 #41)

---
 Image.h           | 2 ++
 TileGenerator.cpp | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Image.h b/Image.h
index ae21ce8..1b5a6ba 100644
--- a/Image.h
+++ b/Image.h
@@ -9,6 +9,8 @@ struct Color {
 	Color() : r(0), g(0), b(0), a(0) {};
 	Color(u8 r, u8 g, u8 b) : r(r), g(g), b(b), a(255) {};
 	Color(u8 r, u8 g, u8 b, u8 a) : r(r), g(g), b(b), a(a) {};
+	inline Color noAlpha() const { return Color(r, g, b); }
+
 	u8 r, g, b, a;
 };
 
diff --git a/TileGenerator.cpp b/TileGenerator.cpp
index 0416af0..f5d9574 100644
--- a/TileGenerator.cpp
+++ b/TileGenerator.cpp
@@ -526,7 +526,7 @@ void TileGenerator::renderMapBlock(const ustring &mapBlock, const BlockPos &pos,
 							continue;
 						}
 					} else {
-						setZoomed(imageX, imageY, c);
+						setZoomed(imageX, imageY, c.noAlpha());
 						m_readPixels[z] |= (1 << x);
 					}
 					if(!(m_readInfo[z] & (1 << x))) {