diff options
-rw-r--r-- | generic/Text.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/generic/Text.c b/generic/Text.c index 1217ee5..9e321a1 100644 --- a/generic/Text.c +++ b/generic/Text.c @@ -961,9 +961,9 @@ Draw(ZnItem item) } else { dest_im_width = (unsigned int) (item->item_bounding_box.corner.x - - item->item_bounding_box.orig.x); + item->item_bounding_box.orig.x + 1); dest_im_height = (unsigned int) (item->item_bounding_box.corner.y - - item->item_bounding_box.orig.y); + item->item_bounding_box.orig.y + 1); drw = Tk_GetPixmap(wi->dpy, wi->draw_buffer, MAX(dest_im_width, text->max_width), @@ -973,11 +973,10 @@ Draw(ZnItem item) XFillRectangle(wi->dpy, drw, gc, 0, 0, MAX(dest_im_width, text->max_width), MAX(dest_im_height, text->height)); - dest_im = XCreateImage(wi->dpy, Tk_Visual(wi->win), 1, - XYPixmap, 0, NULL, dest_im_width, dest_im_height, - 8, 0); - dest_im->data = ZnMalloc(dest_im->bytes_per_line * dest_im->height); - memset(dest_im->data, 0, dest_im->bytes_per_line * dest_im->height); + dest_im = XGetImage(wi->dpy, drw, 0, 0, + MAX(dest_im_width, text->max_width), + MAX(dest_im_height, text->height), + 1, ZPixmap); values.foreground = 1; @@ -1037,7 +1036,7 @@ Draw(ZnItem item) if (dest_im != NULL) { src_im = XGetImage(wi->dpy, drw, 0, 0, text->max_width, text->height, - 1, XYPixmap); + 1, ZPixmap); box[0].x = origin.x; box[0].y = origin.y; @@ -1107,6 +1106,7 @@ Render(ZnItem item) int underline_thickness, underline_pos=0, overstrike_pos=0; int sel_first_line=-1, sel_last_line=-1, cursor_line=-1; int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0; + ZnGLContextEntry *ce; if (!text->text_info) { return; @@ -1140,7 +1140,7 @@ Render(ZnItem item) ComputeSelection(item, &sel_first_line, &sel_last_line, &sel_start_offset, &sel_stop_offset); - ZnGLMakeCurrent(wi->dpy, wi); + ce = ZnGLMakeCurrent(wi->dpy, wi); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPushMatrix(); @@ -1266,6 +1266,7 @@ Render(ZnItem item) glPopMatrix(); glDisable(GL_TEXTURE_2D); + ZnGLReleaseContext(ce); #ifdef GL_LIST glEndList(); } |