[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg-devel
Subject: [PATCH 2/3] glamor: Don't use PACK/UNPACK_SKIP_ROWS/PIXELS.
From: Eric Anholt <eric () anholt ! net>
Date: 2014-12-30 22:54:28
Message-ID: 1419980069-2092-3-git-send-email-eric () anholt ! net
[Download RAW message or body]
It's not available in GLES2 (though it's in GLES3). It's trivial to
do the math, and avoids going through more switch statements in the GL
on desktop.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
glamor/glamor_transfer.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
index 8914155..7a60c91 100644
--- a/glamor/glamor_transfer.c
+++ b/glamor/glamor_transfer.c
@@ -97,20 +97,16 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
if (x2 <= x1 || y2 <= y1)
continue;
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
-
glTexSubImage2D(GL_TEXTURE_2D, 0,
x1 - box->x1, y1 - box->y1,
x2 - x1, y2 - y1,
format, type,
- bits);
+ bits + ((y1 - dy_dst + dy_src) * byte_stride +
+ (x1 - dx_dst + dx_src) * bytes_per_pixel));
}
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
}
/*
@@ -189,14 +185,13 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
if (x2 <= x1 || y2 <= y1)
continue;
- glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
- glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
- glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
+ glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1,
+ format, type,
+ bits + ((y1 - dy_src + dy_dst) * byte_stride +
+ (x1 - dx_src + dx_dst) * bytes_per_pixel));
}
}
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_SKIP_ROWS, 0);
- glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
}
/*
--
2.1.3
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic