Loading libs/hwui/Patch.cpp +15 −9 Original line number Diff line number Diff line Loading @@ -118,7 +118,10 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, const uint32_t yStretchCount = (mYCount + 1) >> 1; float stretchX = 0.0f; float stretchY = 0.0; float stretchY = 0.0f; float rescaleX = 1.0f; float rescaleY = 1.0f; const float meshWidth = right - left; Loading @@ -129,8 +132,9 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } const float xStretchTex = stretchSize; const float fixed = bitmapWidth - stretchSize; const float xStretch = right - left - fixed; const float xStretch = fmaxf(right - left - fixed, 0.0f); stretchX = xStretch / xStretchTex; rescaleX = fminf(fmaxf(right - left, 0.0f) / fixed, 1.0f); } if (yStretchCount > 0) { Loading @@ -140,8 +144,9 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } const float yStretchTex = stretchSize; const float fixed = bitmapHeight - stretchSize; const float yStretch = bottom - top - fixed; const float yStretch = fmaxf(bottom - top - fixed, 0.0f); stretchY = yStretch / yStretchTex; rescaleY = fminf(fmaxf(bottom - top, 0.0f) / fixed, 1.0f); } TextureVertex* vertex = mVertices; Loading @@ -160,7 +165,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, if (i & 1) { y2 = y1 + floorf(segment * stretchY + 0.5f); } else { y2 = y1 + segment; y2 = y1 + segment * rescaleY; } float vOffset = y1 == y2 ? 0.0f : 0.5 - (0.5 * segment / (y2 - y1)); Loading @@ -172,7 +177,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, y1 += i * EXPLODE_GAP; y2 += i * EXPLODE_GAP; #endif generateRow(vertex, y1, y2, v1, v2, stretchX, right - left, generateRow(vertex, y1, y2, v1, v2, stretchX, rescaleX, right - left, bitmapWidth, quadCount); #if DEBUG_EXPLODE_PATCHES y2 -= i * EXPLODE_GAP; Loading @@ -191,7 +196,8 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, y1 += mYCount * EXPLODE_GAP; y2 += mYCount * EXPLODE_GAP; #endif generateRow(vertex, y1, y2, v1, 1.0f, stretchX, right - left, bitmapWidth, quadCount); generateRow(vertex, y1, y2, v1, 1.0f, stretchX, rescaleX, right - left, bitmapWidth, quadCount); } if (verticesCount > 0) { Loading @@ -212,7 +218,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, float v2, float stretchX, float width, float bitmapWidth, uint32_t& quadCount) { float stretchX, float rescaleX, float width, float bitmapWidth, uint32_t& quadCount) { float previousStepX = 0.0f; float x1 = 0.0f; Loading @@ -227,7 +233,7 @@ void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, fl if (i & 1) { x2 = x1 + floorf(segment * stretchX + 0.5f); } else { x2 = x1 + segment; x2 = x1 + segment * rescaleX; } float uOffset = x1 == x2 ? 0.0f : 0.5 - (0.5 * segment / (x2 - x1)); Loading Loading @@ -272,7 +278,7 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f if (y2 < 0.0f) y2 = 0.0f; // Skip degenerate and transparent (empty) quads if ((mColorKey >> oldQuadCount) & 0x1) { if (((mColorKey >> oldQuadCount) & 0x1) || x1 >= x2 || y1 >= y2) { #if DEBUG_PATCHES_EMPTY_VERTICES PATCH_LOGD(" quad %d (empty)", oldQuadCount); PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.4f, %.4f", x1, y1, u1, v1); Loading libs/hwui/Patch.h +2 −2 Original line number Diff line number Diff line Loading @@ -75,8 +75,8 @@ private: void copy(const int32_t* yDivs); void generateRow(TextureVertex*& vertex, float y1, float y2, float v1, float v2, float stretchX, float width, float bitmapWidth, uint32_t& quadCount); float v1, float v2, float stretchX, float rescaleX, float width, float bitmapWidth, uint32_t& quadCount); void generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, Loading Loading
libs/hwui/Patch.cpp +15 −9 Original line number Diff line number Diff line Loading @@ -118,7 +118,10 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, const uint32_t yStretchCount = (mYCount + 1) >> 1; float stretchX = 0.0f; float stretchY = 0.0; float stretchY = 0.0f; float rescaleX = 1.0f; float rescaleY = 1.0f; const float meshWidth = right - left; Loading @@ -129,8 +132,9 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } const float xStretchTex = stretchSize; const float fixed = bitmapWidth - stretchSize; const float xStretch = right - left - fixed; const float xStretch = fmaxf(right - left - fixed, 0.0f); stretchX = xStretch / xStretchTex; rescaleX = fminf(fmaxf(right - left, 0.0f) / fixed, 1.0f); } if (yStretchCount > 0) { Loading @@ -140,8 +144,9 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } const float yStretchTex = stretchSize; const float fixed = bitmapHeight - stretchSize; const float yStretch = bottom - top - fixed; const float yStretch = fmaxf(bottom - top - fixed, 0.0f); stretchY = yStretch / yStretchTex; rescaleY = fminf(fmaxf(bottom - top, 0.0f) / fixed, 1.0f); } TextureVertex* vertex = mVertices; Loading @@ -160,7 +165,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, if (i & 1) { y2 = y1 + floorf(segment * stretchY + 0.5f); } else { y2 = y1 + segment; y2 = y1 + segment * rescaleY; } float vOffset = y1 == y2 ? 0.0f : 0.5 - (0.5 * segment / (y2 - y1)); Loading @@ -172,7 +177,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, y1 += i * EXPLODE_GAP; y2 += i * EXPLODE_GAP; #endif generateRow(vertex, y1, y2, v1, v2, stretchX, right - left, generateRow(vertex, y1, y2, v1, v2, stretchX, rescaleX, right - left, bitmapWidth, quadCount); #if DEBUG_EXPLODE_PATCHES y2 -= i * EXPLODE_GAP; Loading @@ -191,7 +196,8 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, y1 += mYCount * EXPLODE_GAP; y2 += mYCount * EXPLODE_GAP; #endif generateRow(vertex, y1, y2, v1, 1.0f, stretchX, right - left, bitmapWidth, quadCount); generateRow(vertex, y1, y2, v1, 1.0f, stretchX, rescaleX, right - left, bitmapWidth, quadCount); } if (verticesCount > 0) { Loading @@ -212,7 +218,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight, } void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, float v2, float stretchX, float width, float bitmapWidth, uint32_t& quadCount) { float stretchX, float rescaleX, float width, float bitmapWidth, uint32_t& quadCount) { float previousStepX = 0.0f; float x1 = 0.0f; Loading @@ -227,7 +233,7 @@ void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, fl if (i & 1) { x2 = x1 + floorf(segment * stretchX + 0.5f); } else { x2 = x1 + segment; x2 = x1 + segment * rescaleX; } float uOffset = x1 == x2 ? 0.0f : 0.5 - (0.5 * segment / (x2 - x1)); Loading Loading @@ -272,7 +278,7 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f if (y2 < 0.0f) y2 = 0.0f; // Skip degenerate and transparent (empty) quads if ((mColorKey >> oldQuadCount) & 0x1) { if (((mColorKey >> oldQuadCount) & 0x1) || x1 >= x2 || y1 >= y2) { #if DEBUG_PATCHES_EMPTY_VERTICES PATCH_LOGD(" quad %d (empty)", oldQuadCount); PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.4f, %.4f", x1, y1, u1, v1); Loading
libs/hwui/Patch.h +2 −2 Original line number Diff line number Diff line Loading @@ -75,8 +75,8 @@ private: void copy(const int32_t* yDivs); void generateRow(TextureVertex*& vertex, float y1, float y2, float v1, float v2, float stretchX, float width, float bitmapWidth, uint32_t& quadCount); float v1, float v2, float stretchX, float rescaleX, float width, float bitmapWidth, uint32_t& quadCount); void generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, Loading