summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-04-13 17:58:30 +0000
committerManolo Gouy <Manolo>2010-04-13 17:58:30 +0000
commit96c392763edb530b305ebc7517281d28b1862b29 (patch)
tree885d39cfbfd111511e140c6c479ea47de8ee9d2c /src
parentd36eb9b30f9eb97f0897cc3375f1b154823e3046 (diff)
gl_draw.cxx (Mac-specific): fixed use of fl_measure with non null-terminated string.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7494 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/gl_draw.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 52222b4fc..e9c34c12c 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -478,8 +478,12 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
current = (current + 1) % size_;
if (current > last) last = current;
//write str to a bitmap just big enough
+ if ( fifo[current].utf8 ) free(fifo[current].utf8);
+ fifo[current].utf8 = (char *)malloc(n + 1);
+ memcpy(fifo[current].utf8, str, n);
+ fifo[current].utf8[n] = 0;
fifo[current].width = 0, fifo[current].height = 0;
- fl_measure(str, fifo[current].width, fifo[current].height, 0);
+ fl_measure(fifo[current].utf8, fifo[current].width, fifo[current].height, 0);
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
void *base = calloc(4*fifo[current].width, fifo[current].height);
if (base == NULL) return -1;
@@ -500,10 +504,6 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
CGContextRelease(fl_gc);
fl_gc = NULL;
free(base);
- if ( fifo[current].utf8 ) free(fifo[current].utf8);
- fifo[current].utf8 = (char *)malloc(n + 1);
- memcpy(fifo[current].utf8, str, n);
- fifo[current].utf8[n] = 0;
fifo[current].fdesc = gl_fontsize;
return current;
}