diff options
author | Brian Paul <[email protected]> | 2010-03-10 10:44:12 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-03-10 10:44:12 -0700 |
commit | f60524938e76befd9b14e9ec6506aefece94f995 (patch) | |
tree | 3ea09e16b71c13b32263882e0d18a452be0b91df /src/mesa/state_tracker | |
parent | a56da1005d30da60701e33b75d5f4f37096df060 (diff) | |
parent | b60aa251e4fb4dd32db3fe167e078bf0092cb726 (diff) |
Merge branch '7.8'
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c609435a158..5f23e8afed3 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -405,7 +405,7 @@ make_texture(struct st_context *st, /** * Draw quad with texcoords and optional color. - * Coords are window coords with y=0=bottom. + * Coords are gallium window coords with y=0=top. * \param color may be null * \param invertTex if true, flip texcoords vertically */ @@ -595,10 +595,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, pipe->set_fragment_sampler_textures(pipe, 1, &pt); } - /* Compute window coords (y=0=bottom) with pixel zoom. + /* Compute Gallium window coords (y=0=top) with pixel zoom. * Recall that these coords are transformed by the current * vertex shader and viewport transformation. */ + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) { + y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY); + invertTex = !invertTex; + } + x0 = (GLfloat) x; x1 = x + width * ctx->Pixel.ZoomX; y0 = (GLfloat) y; @@ -936,6 +941,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, GLfloat *color; enum pipe_format srcFormat, texFormat; int ptw, pth; + GLboolean invertTex = GL_FALSE; pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); @@ -1011,8 +1017,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, } } - if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - srcy = ctx->DrawBuffer->Height - srcy - height; + if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + srcy = ctx->ReadBuffer->Height - srcy - height; if (srcy < 0) { height -= -srcy; @@ -1021,6 +1027,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, if (height < 0) return; + + invertTex = !invertTex; } /* Need to use POT texture? */ @@ -1050,7 +1058,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, if (!pt) return; - + /* Make temporary texture which is a copy of the src region. + * We'll draw a quad with this texture to draw the dest image. + */ if (srcFormat == texFormat) { /* copy source framebuffer surface into mipmap/texture */ struct pipe_surface *psRead = screen->get_tex_surface(screen, @@ -1071,6 +1081,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, psRead, srcx, srcy, width, height); } + + if (0) { + /* debug */ + debug_dump_surface("copypixsrcsurf", psRead); + debug_dump_surface("copypixtemptex", psTex); + } + pipe_surface_reference(&psRead, NULL); pipe_surface_reference(&psTex, NULL); } @@ -1121,7 +1138,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, pt, driver_vp, driver_fp, - color, GL_TRUE); + color, invertTex); pipe_texture_reference(&pt, NULL); } |