am dcbc2557: am c313b59b: am 071929b2: Merge "gl2_yuvtex: use the gralloc-provided stride." into honeycomb-mr1

* commit 'dcbc255734e506bacd36d8d9483b7f3d6d96d10b':
  gl2_yuvtex: use the gralloc-provided stride.
This commit is contained in:
Jamie Gennis 2011-03-14 15:25:14 -07:00 committed by Android Git Automerger
commit 5b92e39c14

View File

@ -186,11 +186,6 @@ const int yuvTexUsage = GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_SW_WRITE_RARELY; GraphicBuffer::USAGE_SW_WRITE_RARELY;
const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12; const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12;
const int yuvTexOffsetY = 0; const int yuvTexOffsetY = 0;
const int yuvTexStrideY = (yuvTexWidth + 0xf) & ~0xf;
const int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
const int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
const int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
const int yuvTexStrideU = yuvTexStrideV;
const bool yuvTexSameUV = false; const bool yuvTexSameUV = false;
static sp<GraphicBuffer> yuvTexBuffer; static sp<GraphicBuffer> yuvTexBuffer;
static GLuint yuvTex; static GLuint yuvTex;
@ -200,6 +195,11 @@ bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) {
int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1; int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat, yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
yuvTexUsage); yuvTexUsage);
int yuvTexStrideY = yuvTexBuffer->getStride();
int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
int yuvTexStrideU = yuvTexStrideV;
char* buf = NULL; char* buf = NULL;
status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf)); status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
if (err != 0) { if (err != 0) {