VIGS: Replace glRasterPos with glWindowPos
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Thu, 6 Jun 2013 06:36:23 +0000 (10:36 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Thu, 6 Jun 2013 06:36:23 +0000 (10:36 +0400)
We should always use glWindowPos instead of glRasterPos, because
values passed to glWindowPos are neither transformed by the current
modelview and projection matrices, nor by the viewport-to-window transform. This
yields more accurate results, unlike glRasterPos, which may have
rounding errors and as a result raster position may become invalid and
entire drawing operation will have no effect

hw/vigs_gl_backend.c
hw/vigs_gl_backend.h
hw/vigs_gl_backend_glx.c
hw/vigs_gl_backend_wgl.c

index 0d1bcf0..61988d7 100644 (file)
@@ -433,7 +433,7 @@ static void vigs_gl_surface_draw_pixels(struct vigs_surface *sfc,
                        width, height);
         gl_backend->PixelStorei(GL_UNPACK_SKIP_PIXELS, x);
         gl_backend->PixelStorei(GL_UNPACK_SKIP_ROWS, y);
-        gl_backend->RasterPos2f(x, ws_sfc->base.base.height - y - 1);
+        gl_backend->WindowPos2f(x, ws_sfc->base.base.height - y);
         gl_backend->DrawPixels(width,
                                height,
                                ws_sfc->tex_format,
index ee16427..99d053a 100644 (file)
@@ -70,7 +70,7 @@ struct vigs_gl_backend
     void (GLAPIENTRY *VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
     void (GLAPIENTRY *DrawArrays)(GLenum mode, GLint first, GLsizei count);
     void (GLAPIENTRY *Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-    void (GLAPIENTRY *RasterPos2f)(GLfloat x, GLfloat y);
+    void (GLAPIENTRY *WindowPos2f)(GLfloat x, GLfloat y);
     void (GLAPIENTRY *PixelZoom)(GLfloat xfactor, GLfloat yfactor);
     void (GLAPIENTRY *DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data);
     void (GLAPIENTRY *BlendFunc)(GLenum sfactor, GLenum dfactor);
index aa60dd6..4176072 100644 (file)
@@ -290,7 +290,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
     VIGS_GL_GET_PROC(VertexPointer, glVertexPointer);
     VIGS_GL_GET_PROC(DrawArrays, glDrawArrays);
     VIGS_GL_GET_PROC(Color4ub, glColor4ub);
-    VIGS_GL_GET_PROC(RasterPos2f, glRasterPos2f);
+    VIGS_GL_GET_PROC(WindowPos2f, glWindowPos2f);
     VIGS_GL_GET_PROC(PixelZoom, glPixelZoom);
     VIGS_GL_GET_PROC(DrawPixels, glDrawPixels);
     VIGS_GL_GET_PROC(BlendFunc, glBlendFunc);
index 263e150..3313757 100644 (file)
@@ -402,7 +402,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
     VIGS_GL_GET_PROC(VertexPointer, glVertexPointer);
     VIGS_GL_GET_PROC(DrawArrays, glDrawArrays);
     VIGS_GL_GET_PROC(Color4ub, glColor4ub);
-    VIGS_GL_GET_PROC(RasterPos2f, glRasterPos2f);
+    VIGS_GL_GET_PROC(WindowPos2f, glWindowPos2f);
     VIGS_GL_GET_PROC(PixelZoom, glPixelZoom);
     VIGS_GL_GET_PROC(DrawPixels, glDrawPixels);
     VIGS_GL_GET_PROC(BlendFunc, glBlendFunc);