diff options
author | Eric Anholt <eric@anholt.net> | 2008-12-31 00:29:49 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-12-31 00:35:17 -0800 |
commit | bfebeffc0045266d354a36968336337e099a9f27 (patch) | |
tree | 7a74bd532f4c64c15a1cc79d309a248917b82c4f /src/mesa/drivers/dri/intel/intel_pixel.c | |
parent | e1a92175542c6645c23cc78f2a4fcd36dd0235e6 (diff) |
intel: Share passthrough transform setup between glBitmap and glDrawPixels.
The DrawPixels path was missing glViewport care, so blender's toolbar icons
would go to the wrong places.
Bug #19118.
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_pixel.c')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 91027d37e7..cf2f32d384 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -29,6 +29,7 @@ #include "main/state.h" #include "main/context.h" #include "main/enable.h" +#include "main/matrix.h" #include "swrast/swrast.h" #include "shader/arbprogram.h" #include "shader/program.h" @@ -171,6 +172,40 @@ intel_check_blit_format(struct intel_region * region, return GL_FALSE; } +void +intel_meta_set_passthrough_transform(struct intel_context *intel) +{ + GLcontext *ctx = &intel->ctx; + + intel->meta.saved_vp_x = ctx->Viewport.X; + intel->meta.saved_vp_y = ctx->Viewport.Y; + intel->meta.saved_vp_width = ctx->Viewport.Width; + intel->meta.saved_vp_height = ctx->Viewport.Height; + + _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); +} + +void +intel_meta_restore_transform(struct intel_context *intel) +{ + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PopMatrix(); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PopMatrix(); + + _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y, + intel->meta.saved_vp_width, intel->meta.saved_vp_height); +} + /** * Set up a vertex program to pass through the position and first texcoord * for pixel path. |