summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-05-07 19:48:06 +0100
committerKeith Whitwell <keithw@vmware.com>2009-05-08 14:57:30 +0100
commite90beb93a89f77bffce8ab3d54457ea65868e93c (patch)
treed4711ab8e9cd8c3af23a93293b625b72559f8845 /src/mesa/state_tracker/st_cb_texture.c
parent507f4e7a7448fb246febefe8819b7b3ac70a35b4 (diff)
mesa/st: keep surface_copy arguments positive
The src/dest x,y, and w,h arguments of the pipe->surface_copy function are unsigned and the drivers aren't expecting negative (or extremly-large unsigned) values as inputs. Trim the requests at the state-tracker level before passing down.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 98f109fc65..b182106fd5 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1337,6 +1337,34 @@ st_copy_texsubimage(GLcontext *ctx,
return;
}
+ if (srcX < 0) {
+ width -= -srcX;
+ destX += -srcX;
+ srcX = 0;
+ }
+
+ if (srcY < 0) {
+ height -= -srcY;
+ destY += -srcY;
+ srcY = 0;
+ }
+
+ if (destX < 0) {
+ width -= -destX;
+ srcX += -destX;
+ destX = 0;
+ }
+
+ if (destY < 0) {
+ height -= -destY;
+ srcY += -destY;
+ destY = 0;
+ }
+
+ if (width < 0 || height < 0)
+ return;
+
+
assert(strb);
assert(strb->surface);
assert(stImage->pt);