Re: [Mesa-dev] patch: fix glxusexfont

2014-06-23 Thread Brian Paul

On 06/22/2014 10:57 AM, Daniel Manjarres wrote:

Author: Daniel Manjarres 
Date:   Sun Jun 22 09:47:58 2014 -0700

 glx: Fix glxUseXFont for glxWindow and glxPixmaps

 The current implementation of glxUseXFont requires creating
 a temporary pixmap and graphics context, which requires a real
 old-school X11 Window, not a glxDrawable. This patch changes
 things so that glxUseXFont will also accept a glxWindow or
 glxPixmap, and lookup the underlying X11 Drawable. Without
 this patch glxUseXFont generates a giant stream of Xerrors
 bout bad drawables and bad graphics contexts.

 Bugzilla:
https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D54372&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=itD%2Fq69MXejLYrMzB3dNz461S4I332LKiDT23UoMsA4%3D%0A&s=6ea3005f27f76e237646e9e443df7f3cc671ec21f60b7f3d5218281a5957df54


diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index 316c585..8735386 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -221,6 +221,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font,
int first, int count, int lis
 XGCValues values;
 unsigned long valuemask;
 XFontStruct *fs;
+   __GLXDRIdrawable *glxdraw;

 GLint swapbytes, lsbfirst, rowlength;
 GLint skiprows, skippixels, alignment;
@@ -233,6 +234,10 @@ DRI_glXUseXFont(struct glx_context *CC, Font font,
int first, int count, int lis
 dpy = CC->currentDpy;
 win = CC->currentDrawable;

+   glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
+   if(glxdraw)
+  win = glxdraw->xDrawable;
+
 fs = XQueryFont(dpy, font);
 if (!fs) {
__glXSetError(CC, GL_INVALID_VALUE);




Looks OK to me.  Though, you could put the preceeding win = 
CC->currentDrawable; into an else clause.


Reviewed-by: Brian Paul 


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] patch: fix glxusexfont

2014-06-22 Thread Daniel Manjarres

Author: Daniel Manjarres 
Date:   Sun Jun 22 09:47:58 2014 -0700

glx: Fix glxUseXFont for glxWindow and glxPixmaps

The current implementation of glxUseXFont requires creating
a temporary pixmap and graphics context, which requires a real
old-school X11 Window, not a glxDrawable. This patch changes
things so that glxUseXFont will also accept a glxWindow or
glxPixmap, and lookup the underlying X11 Drawable. Without
this patch glxUseXFont generates a giant stream of Xerrors
bout bad drawables and bad graphics contexts.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54372

diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index 316c585..8735386 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -221,6 +221,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
first, int count, int lis

XGCValues values;
unsigned long valuemask;
XFontStruct *fs;
+   __GLXDRIdrawable *glxdraw;

GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
@@ -233,6 +234,10 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
first, int count, int lis

dpy = CC->currentDpy;
win = CC->currentDrawable;

+   glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
+   if(glxdraw)
+  win = glxdraw->xDrawable;
+
fs = XQueryFont(dpy, font);
if (!fs) {
   __glXSetError(CC, GL_INVALID_VALUE);
>From 2db1da2a1a1413ef6d7b89b873f2a045045f4103 Mon Sep 17 00:00:00 2001
From: Daniel Manjarres 
Date: Sun, 22 Jun 2014 09:47:58 -0700
Subject: [PATCH] glx: Fix glxUseXFont for glxWindow and glxPixmaps

The current implementation of glxUseXFont requires creating
a temporary pixmap and graphics context, which requires a real
old-school X11 Window, not a glxDrawable. This patch changes
things so that glxUseXFont will also accept a glxWindow or
glxPixmap, and lookup the underlying X11 Drawable. Without
this patch glxUseXFont generates a giant stream of Xerrors
bout bad drawables and bad graphics contexts.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54372
---
 src/glx/xfont.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index 316c585..8735386 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -221,6 +221,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
XGCValues values;
unsigned long valuemask;
XFontStruct *fs;
+   __GLXDRIdrawable *glxdraw;
 
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
@@ -233,6 +234,10 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
dpy = CC->currentDpy;
win = CC->currentDrawable;
 
+   glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
+   if(glxdraw)
+	   win = glxdraw->xDrawable;
+
fs = XQueryFont(dpy, font);
if (!fs) {
   __glXSetError(CC, GL_INVALID_VALUE);
-- 
1.8.4.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev