diff options
author | Mathias Agopian <mathias@google.com> | 2009-06-23 18:31:06 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-06-23 19:50:41 -0700 |
commit | e7829b8656ab4d179aa608e5715280819e5230b5 (patch) | |
tree | 921fb5019869b2c9d9290b4eb2966d78c486ef13 /opengl | |
parent | 1fed11c86a9d59d0f5282ae8ae25ceba2f802fdd (diff) | |
download | frameworks_native-e7829b8656ab4d179aa608e5715280819e5230b5.zip frameworks_native-e7829b8656ab4d179aa608e5715280819e5230b5.tar.gz frameworks_native-e7829b8656ab4d179aa608e5715280819e5230b5.tar.bz2 |
fix a bug where copybit would be rejected in landscape mode
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libagl/copybit.cpp | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/opengl/libagl/copybit.cpp b/opengl/libagl/copybit.cpp index cde8f8a..093a32d 100644 --- a/opengl/libagl/copybit.cpp +++ b/opengl/libagl/copybit.cpp @@ -163,15 +163,23 @@ static bool copybit(GLint x, GLint y, const GLint Wcr = crop_rect[2]; const GLint Hcr = crop_rect[3]; - int32_t dsdx = (Wcr << 16) / w; // dsdx = ((Wcr/w)/Wt)*Wt - int32_t dtdy = ((-Hcr) << 16) / h; // dtdy = -((Hcr/h)/Ht)*Ht - + int32_t dsdx = (Wcr << 16); // dsdx = ((Wcr/w)/Wt)*Wt + int32_t dtdy = ((-Hcr) << 16); // dtdy = -((Hcr/h)/Ht)*Ht + if (transform & COPYBIT_TRANSFORM_ROT_90) { + dsdx /= h; + dtdy /= w; + } else { + dsdx /= w; + dtdy /= h; + } if (dsdx < c->copybits.minScale || dsdx > c->copybits.maxScale || dtdy < c->copybits.minScale || dtdy > c->copybits.maxScale) { // The requested scale is out of the range the hardware // can support. LOGD_IF(DEBUG_COPYBIT, - "scale out of range dsdx=%08x, dtdy=%08x", dsdx, dtdy); + "scale out of range dsdx=%08x (Wcr=%d / w=%d), " + "dtdy=%08x (Hcr=%d / h=%d), Ucr=%d, Vcr=%d", + dsdx, Wcr, w, dtdy, Hcr, h, Ucr, Vcr); return false; } @@ -198,22 +206,30 @@ static bool copybit(GLint x, GLint y, static const int tmu = 0; texture_t& tev(c->rasterizer.state.texture[tmu]); bool srcTextureHasAlpha = hasAlpha(textureObject->surface.format); - switch (tev.env) { + if (!srcTextureHasAlpha) { + planeAlpha = fixedToByte(c->currentColorClamped.a); + } + switch (tev.env) { case GGL_REPLACE: - if (!srcTextureHasAlpha) { - planeAlpha = fixedToByte(c->currentColorClamped.a); - } break; - case GGL_MODULATE: - if (! (c->currentColorClamped.r == FIXED_ONE - && c->currentColorClamped.g == FIXED_ONE - && c->currentColorClamped.b == FIXED_ONE)) { - LOGD_IF(DEBUG_COPYBIT, "MODULATE and non white color"); + if (! (c->currentColorClamped.r == FIXED_ONE && + c->currentColorClamped.g == FIXED_ONE && + c->currentColorClamped.b == FIXED_ONE)) { + LOGD_IF(DEBUG_COPYBIT, + "MODULATE and non white color (%08x, %08x, %08x)", + c->currentColorClamped.r, + c->currentColorClamped.g, + c->currentColorClamped.b); + return false; + } + if (srcTextureHasAlpha && c->currentColorClamped.a < FIXED_ONE) { + LOGD_IF(DEBUG_COPYBIT, + "MODULATE and texture w/alpha and alpha=%08x)", + c->currentColorClamped.a); return false; } - planeAlpha = fixedToByte(c->currentColorClamped.a); break; default: @@ -223,7 +239,6 @@ static bool copybit(GLint x, GLint y, } bool blending = false; - if ((enables & GGL_ENABLE_BLENDING) && !(c->rasterizer.state.blend.src == GL_ONE && c->rasterizer.state.blend.dst == GL_ZERO)) { |