From dcf77bde783b196da92fdb03637944385005f404 Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Sun, 26 Jan 2014 08:39:02 +0100
Subject: [PATCH] Bitmap: Add option to always use render pipeline to blit text

A hack that might solve issues some users are having on
AMD SI cards with fglrx.
---
 src/bitmap.cpp | 5 +++++
 src/config.cpp | 2 ++
 src/config.h   | 1 +
 3 files changed, 8 insertions(+)

diff --git a/src/bitmap.cpp b/src/bitmap.cpp
index e72ab01..9cba9c6 100644
--- a/src/bitmap.cpp
+++ b/src/bitmap.cpp
@@ -832,6 +832,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 
 	bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0;
 
+	// Hack for broken fglrx on SI cards: always use
+	// render pipeline to blit text
+	if (shState->config().forceBitmapBlit)
+		fastBlit = false;
+
 	if (fastBlit)
 	{
 		if (squeeze == 1.0)
diff --git a/src/config.cpp b/src/config.cpp
index 7e3091f..83abd9e 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -46,6 +46,7 @@ Config::Config()
       fixedFramerate(0),
       frameSkip(true),
       solidFonts(false),
+      forceBitmapBlit(false),
       gameFolder("."),
       anyAltToggleFS(false),
       allowSymlinks(false),
@@ -67,6 +68,7 @@ void Config::read(int argc, char *argv[])
 	PO_DESC(fixedFramerate, int) \
 	PO_DESC(frameSkip, bool) \
 	PO_DESC(solidFonts, bool) \
+	PO_DESC(forceBitmapBlit, bool) \
 	PO_DESC(gameFolder, std::string) \
 	PO_DESC(anyAltToggleFS, bool) \
 	PO_DESC(allowSymlinks, bool) \
diff --git a/src/config.h b/src/config.h
index 411ce51..29df78a 100644
--- a/src/config.h
+++ b/src/config.h
@@ -43,6 +43,7 @@ struct Config
 	bool frameSkip;
 
 	bool solidFonts;
+	bool forceBitmapBlit;
 
 	std::string gameFolder;
 	bool anyAltToggleFS;