From 51c5ca14108363fc4f3fccc0699e83488f2ba9b7 Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Tue, 15 Apr 2014 19:05:36 +0200
Subject: [PATCH] Graphics: Taint entire Bitmap in #snap_to_bitmap

---
 src/bitmap.cpp   | 5 +++++
 src/bitmap.h     | 3 +++
 src/graphics.cpp | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/src/bitmap.cpp b/src/bitmap.cpp
index 353bfa9..909e11e 100644
--- a/src/bitmap.cpp
+++ b/src/bitmap.cpp
@@ -1045,6 +1045,11 @@ void Bitmap::bindTex(ShaderBase &shader)
 	p->bindTexture(shader);
 }
 
+void Bitmap::taintArea(const IntRect &rect)
+{
+	p->addTaintedArea(rect);
+}
+
 void Bitmap::releaseResources()
 {
 	if (p->megaSurface)
diff --git a/src/bitmap.h b/src/bitmap.h
index 0ac418b..72048b1 100644
--- a/src/bitmap.h
+++ b/src/bitmap.h
@@ -116,6 +116,9 @@ public:
 	 * texture size uniform in shader */
 	void bindTex(ShaderBase &shader);
 
+	/* Adds 'rect' to tainted area */
+	void taintArea(const IntRect &rect);
+
 	sigc::signal<void> modified;
 
 private:
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 22236ff..fa769d7 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -779,6 +779,9 @@ Bitmap *Graphics::snapToBitmap()
 
 	p->compositeToBuffer(bitmap->getGLTypes().fbo);
 
+	/* Taint entire bitmap */
+	bitmap->taintArea(IntRect(0, 0, width(), height()));
+
 	return bitmap;
 }