From 8f59f98eacd93f8a8ed1fa9719ba4bad6e21ddab Mon Sep 17 00:00:00 2001
From: Jjgod Jiang <gzjjgod@gmail.com>
Date: Thu, 19 Nov 2009 09:59:21 +0800
Subject: [PATCH] Setting blend mode before filling rects to fix transparency

---
 src/MacVim/MMCoreTextView.m |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m
index 2c10271..7d97489 100644
--- a/src/MacVim/MMCoreTextView.m
+++ b/src/MacVim/MMCoreTextView.m
@@ -1076,6 +1076,8 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
     CGRect clipRect = { {x, y}, {clipWidth, cellSize.height} };
     CGContextClipToRect(context, clipRect);
 
+    CGContextSetBlendMode(context, kCGBlendModeCopy);
+
     if (!(flags & DRAW_TRANSP)) {
         // Draw the background of the text.  Note that if we ignore the
         // DRAW_TRANSP flag and always draw the background, then the insert
@@ -1211,6 +1213,8 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
 
     CGContextSetRGBFillColor(context, RED(color), GREEN(color), BLUE(color),
                              ALPHA(color));
+
+    CGContextSetBlendMode(context, kCGBlendModeCopy);
     CGContextFillRect(context, *(CGRect*)&rect);
 }
 
@@ -1223,6 +1227,7 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
     float b = [defaultBackgroundColor blueComponent];
     float a = [defaultBackgroundColor alphaComponent];
 
+    CGContextSetBlendMode(context, kCGBlendModeCopy);
     CGContextSetRGBFillColor(context, r, g, b, a);
     CGContextFillRect(context, *(CGRect*)&rect);
 }
-- 
1.6.4

