Commit 29603ae3fa88c5b9e079a6db23be2cdea95aef39

sammy 2009-07-19T15:28:59

Remove GL_BLEND tampering. It's the caller application's responsibility to enable or disable blending.

diff --git a/src/FTFont/FTBitmapFont.cpp b/src/FTFont/FTBitmapFont.cpp
index c8b8d0c..1bb774c 100644
--- a/src/FTFont/FTBitmapFont.cpp
+++ b/src/FTFont/FTBitmapFont.cpp
@@ -68,22 +68,16 @@ inline FTPoint FTBitmapFontImpl::RenderI(const T* string, const int len,
                                          FTPoint position, FTPoint spacing,
                                          int renderMode)
 {
-    // Protect GL_BLEND
-    glPushAttrib(GL_COLOR_BUFFER_BIT);
-
     // Protect glPixelStorei() calls (also in FTBitmapGlyphImpl::RenderImpl)
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 
     glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
-    glDisable(GL_BLEND);
-
     FTPoint tmp = FTFontImpl::Render(string, len,
                                      position, spacing, renderMode);
 
     glPopClientAttrib();
-    glPopAttrib();
 
     return tmp;
 }
diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index 0e25777..73a875d 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -230,15 +230,13 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
     int cacheIndex = -1;
     bool inCache = false;
 
-    // Protect blending functions, GL_BLEND and GL_TEXTURE_2D
+    // Protect blending functions and GL_TEXTURE_2D
     glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
 
     // Protect glPixelStorei() calls
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 
-    glEnable(GL_BLEND);
     glEnable(GL_TEXTURE_2D);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
 
     // Search whether the string is already in a texture we uploaded
     for(int n = 0; n < BUFFER_CACHE_SIZE; n++)
diff --git a/src/FTFont/FTOutlineFont.cpp b/src/FTFont/FTOutlineFont.cpp
index 5cad183..0b21a1f 100644
--- a/src/FTFont/FTOutlineFont.cpp
+++ b/src/FTFont/FTOutlineFont.cpp
@@ -93,15 +93,13 @@ inline FTPoint FTOutlineFontImpl::RenderI(const T* string, const int len,
                                           FTPoint position, FTPoint spacing,
                                           int renderMode)
 {
-    // Protect GL_TEXTURE_2D, glHint(), GL_LINE_SMOOTH and blending functions
+    // Protect GL_TEXTURE_2D, glHint() and GL_LINE_SMOOTH
     glPushAttrib(GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT
                   | GL_COLOR_BUFFER_BIT);
 
     glDisable(GL_TEXTURE_2D);
     glEnable(GL_LINE_SMOOTH);
     glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
 
     FTPoint tmp = FTFontImpl::Render(string, len,
                                      position, spacing, renderMode);
diff --git a/src/FTFont/FTPixmapFont.cpp b/src/FTFont/FTPixmapFont.cpp
index 01e2f4e..0c11fd5 100644
--- a/src/FTFont/FTPixmapFont.cpp
+++ b/src/FTFont/FTPixmapFont.cpp
@@ -84,16 +84,12 @@ inline FTPoint FTPixmapFontImpl::RenderI(const T* string, const int len,
                                          FTPoint position, FTPoint spacing,
                                          int renderMode)
 {
-    // Protect GL_TEXTURE_2D and GL_BLEND, glPixelTransferf(), and blending
-    // functions.
+    // Protect GL_TEXTURE_2D and glPixelTransferf()
     glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
 
     // Protect glPixelStorei() calls (made by FTPixmapGlyphImpl::RenderImpl).
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
     glDisable(GL_TEXTURE_2D);
 
     GLfloat ftglColour[4];
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index fcae355..e7ba20b 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -231,12 +231,9 @@ inline FTPoint FTTextureFontImpl::RenderI(const T* string, const int len,
                                           FTPoint position, FTPoint spacing,
                                           int renderMode)
 {
-    // Protect GL_TEXTURE_2D, GL_BLEND and blending functions
+    // Protect GL_TEXTURE_2D
     glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
 
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
-
     glEnable(GL_TEXTURE_2D);
 
     FTTextureGlyphImpl::ResetActiveTexture();