Revision: 3609
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3609&view=rev
Author: mdboom
Date: 2007-07-24 12:22:53 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
Bugfixes around improvements to draw_bitmap
Modified Paths:
--------------
branches/mathtext_mgd/src/ft2font.cpp
branches/mathtext_mgd/src/mplutils.h
Modified: branches/mathtext_mgd/src/ft2font.cpp
===================================================================
--- branches/mathtext_mgd/src/ft2font.cpp 2007-07-24 16:24:03 UTC (rev 3608)
+++ branches/mathtext_mgd/src/ft2font.cpp 2007-07-24 19:22:53 UTC (rev 3609)
@@ -876,9 +876,6 @@
return Py::Int(- bbox.yMin);;
}
-#undef CLAMP
-#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
-
void
FT2Font::draw_bitmap( FT_Bitmap* bitmap,
FT_Int x,
@@ -893,9 +890,9 @@
FT_Int x2 = CLAMP(x + bitmap->width, 0, width);
FT_Int y2 = CLAMP(y + bitmap->rows, 0, height);
- for ( i = x1, p = 0; i < x2; ++i, ++p )
+ for ( i = x1, p = MAX(0, -x); i < x2; ++i, ++p )
{
- for ( j = y1, q = 0; j < y2; ++j, ++q )
+ for ( j = y1, q = MAX(0, -y); j < y2; ++j, ++q )
{
image.buffer[i + j*width] |= bitmap->buffer[p + q*bitmap->pitch];
}
Modified: branches/mathtext_mgd/src/mplutils.h
===================================================================
--- branches/mathtext_mgd/src/mplutils.h 2007-07-24 16:24:03 UTC (rev 3608)
+++ branches/mathtext_mgd/src/mplutils.h 2007-07-24 19:22:53 UTC (rev 3609)
@@ -20,6 +20,12 @@
void _VERBOSE(const std::string&);
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
class Printf
{
private :
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|