Loading libs/hwui/DisplayListOp.h +16 −3 Original line number Diff line number Diff line Loading @@ -932,13 +932,22 @@ public: DrawPatchOp(SkBitmap* bitmap, Res_png_9patch* patch, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode) : DrawBoundedOp(left, top, right, bottom, 0), mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode) { mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode), mGenerationId(0), mMesh(NULL) { mEntry = Caches::getInstance().assetAtlas.getEntry(bitmap); }; virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { // NOTE: not calling the virtual method, which takes a paint return renderer.drawPatch(mBitmap, mPatch, mEntry, mLocalBounds.left, mLocalBounds.top, if (!mMesh || renderer.getCaches().patchCache.getGenerationId() != mGenerationId) { PatchCache& cache = renderer.getCaches().patchCache; mMesh = cache.get(mEntry, mBitmap->width(), mBitmap->height(), mLocalBounds.right - mLocalBounds.left, mLocalBounds.bottom - mLocalBounds.top, mPatch); mGenerationId = cache.getGenerationId(); } // We're not calling the public variant of drawPatch() here // This method won't perform the quickReject() since we've already done it at this point return renderer.drawPatch(mBitmap, mMesh, mEntry, mLocalBounds.left, mLocalBounds.top, mLocalBounds.right, mLocalBounds.bottom, mAlpha, mMode); } Loading @@ -957,8 +966,12 @@ public: private: SkBitmap* mBitmap; Res_png_9patch* mPatch; int mAlpha; SkXfermode::Mode mMode; uint32_t mGenerationId; const Patch* mMesh; AssetAtlas::Entry* mEntry; }; Loading libs/hwui/LayerRenderer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ bool LayerRenderer::copyLayer(Layer* layer, SkBitmap* bitmap) { mat4 texTransform(layer->getTexTransform()); mat4 invert; invert.translate(0.0f, 1.0f, 0.0f); invert.translate(0.0f, 1.0f); invert.scale(1.0f, -1.0f, 1.0f); layer->getTexTransform().multiply(invert); Loading libs/hwui/Matrix.h +21 −4 Original line number Diff line number Diff line Loading @@ -128,10 +128,27 @@ public: void multiply(float v); void translate(float x, float y, float z) { void translate(float x, float y) { if ((getType() & sGeometryMask) == kTypeTranslate) { data[kTranslateX] += x; data[kTranslateY] += y; } else { // Doing a translation will only affect the translate bit of the type // Save the type uint32_t type = mType; Matrix4 u; u.loadTranslate(x, y, z); u.loadTranslate(x, y, 0.0f); multiply(u); // Restore the type and fix the translate bit mType = type; if (data[kTranslateX] != 0.0f || data[kTranslateY] != 0.0f) { mType |= kTypeTranslate; } else { mType &= ~kTypeTranslate; } } } void scale(float sx, float sy, float sz) { Loading libs/hwui/OpenGLRenderer.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -1407,7 +1407,7 @@ void OpenGLRenderer::setFullScreenClip() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::translate(float dx, float dy) { currentTransform().translate(dx, dy, 0.0f); currentTransform().translate(dx, dy); } void OpenGLRenderer::rotate(float degrees) { Loading Loading @@ -2337,20 +2337,25 @@ status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, SkXfermode::Mode mode; getAlphaAndMode(paint, &alpha, &mode); return drawPatch(bitmap, patch, mCaches.assetAtlas.getEntry(bitmap), left, top, right, bottom, alpha, mode); if (quickReject(left, top, right, bottom)) { return DrawGlInfo::kStatusDone; } status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, AssetAtlas::Entry* entry = mCaches.assetAtlas.getEntry(bitmap); const Patch* mesh = mCaches.patchCache.get(entry, bitmap->width(), bitmap->height(), right - left, bottom - top, patch); return drawPatch(bitmap, mesh, entry, left, top, right, bottom, alpha, mode); } status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode) { if (quickReject(left, top, right, bottom)) { return DrawGlInfo::kStatusDone; } const Patch* mesh = mCaches.patchCache.get(entry, bitmap->width(), bitmap->height(), right - left, bottom - top, patch); if (CC_LIKELY(mesh && mesh->verticesCount > 0)) { mCaches.activeTexture(0); Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap); Loading libs/hwui/OpenGLRenderer.h +1 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,7 @@ public: float* vertices, int* colors, SkPaint* paint); virtual status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, float left, float top, float right, float bottom, SkPaint* paint); status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, AssetAtlas::Entry* entry, status_t drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode); virtual status_t drawColor(int color, SkXfermode::Mode mode); virtual status_t drawRect(float left, float top, float right, float bottom, SkPaint* paint); Loading Loading
libs/hwui/DisplayListOp.h +16 −3 Original line number Diff line number Diff line Loading @@ -932,13 +932,22 @@ public: DrawPatchOp(SkBitmap* bitmap, Res_png_9patch* patch, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode) : DrawBoundedOp(left, top, right, bottom, 0), mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode) { mBitmap(bitmap), mPatch(patch), mAlpha(alpha), mMode(mode), mGenerationId(0), mMesh(NULL) { mEntry = Caches::getInstance().assetAtlas.getEntry(bitmap); }; virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { // NOTE: not calling the virtual method, which takes a paint return renderer.drawPatch(mBitmap, mPatch, mEntry, mLocalBounds.left, mLocalBounds.top, if (!mMesh || renderer.getCaches().patchCache.getGenerationId() != mGenerationId) { PatchCache& cache = renderer.getCaches().patchCache; mMesh = cache.get(mEntry, mBitmap->width(), mBitmap->height(), mLocalBounds.right - mLocalBounds.left, mLocalBounds.bottom - mLocalBounds.top, mPatch); mGenerationId = cache.getGenerationId(); } // We're not calling the public variant of drawPatch() here // This method won't perform the quickReject() since we've already done it at this point return renderer.drawPatch(mBitmap, mMesh, mEntry, mLocalBounds.left, mLocalBounds.top, mLocalBounds.right, mLocalBounds.bottom, mAlpha, mMode); } Loading @@ -957,8 +966,12 @@ public: private: SkBitmap* mBitmap; Res_png_9patch* mPatch; int mAlpha; SkXfermode::Mode mMode; uint32_t mGenerationId; const Patch* mMesh; AssetAtlas::Entry* mEntry; }; Loading
libs/hwui/LayerRenderer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ bool LayerRenderer::copyLayer(Layer* layer, SkBitmap* bitmap) { mat4 texTransform(layer->getTexTransform()); mat4 invert; invert.translate(0.0f, 1.0f, 0.0f); invert.translate(0.0f, 1.0f); invert.scale(1.0f, -1.0f, 1.0f); layer->getTexTransform().multiply(invert); Loading
libs/hwui/Matrix.h +21 −4 Original line number Diff line number Diff line Loading @@ -128,10 +128,27 @@ public: void multiply(float v); void translate(float x, float y, float z) { void translate(float x, float y) { if ((getType() & sGeometryMask) == kTypeTranslate) { data[kTranslateX] += x; data[kTranslateY] += y; } else { // Doing a translation will only affect the translate bit of the type // Save the type uint32_t type = mType; Matrix4 u; u.loadTranslate(x, y, z); u.loadTranslate(x, y, 0.0f); multiply(u); // Restore the type and fix the translate bit mType = type; if (data[kTranslateX] != 0.0f || data[kTranslateY] != 0.0f) { mType |= kTypeTranslate; } else { mType &= ~kTypeTranslate; } } } void scale(float sx, float sy, float sz) { Loading
libs/hwui/OpenGLRenderer.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -1407,7 +1407,7 @@ void OpenGLRenderer::setFullScreenClip() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::translate(float dx, float dy) { currentTransform().translate(dx, dy, 0.0f); currentTransform().translate(dx, dy); } void OpenGLRenderer::rotate(float degrees) { Loading Loading @@ -2337,20 +2337,25 @@ status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, SkXfermode::Mode mode; getAlphaAndMode(paint, &alpha, &mode); return drawPatch(bitmap, patch, mCaches.assetAtlas.getEntry(bitmap), left, top, right, bottom, alpha, mode); if (quickReject(left, top, right, bottom)) { return DrawGlInfo::kStatusDone; } status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, AssetAtlas::Entry* entry = mCaches.assetAtlas.getEntry(bitmap); const Patch* mesh = mCaches.patchCache.get(entry, bitmap->width(), bitmap->height(), right - left, bottom - top, patch); return drawPatch(bitmap, mesh, entry, left, top, right, bottom, alpha, mode); } status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode) { if (quickReject(left, top, right, bottom)) { return DrawGlInfo::kStatusDone; } const Patch* mesh = mCaches.patchCache.get(entry, bitmap->width(), bitmap->height(), right - left, bottom - top, patch); if (CC_LIKELY(mesh && mesh->verticesCount > 0)) { mCaches.activeTexture(0); Texture* texture = entry ? entry->texture : mCaches.textureCache.get(bitmap); Loading
libs/hwui/OpenGLRenderer.h +1 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,7 @@ public: float* vertices, int* colors, SkPaint* paint); virtual status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, float left, float top, float right, float bottom, SkPaint* paint); status_t drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, AssetAtlas::Entry* entry, status_t drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode); virtual status_t drawColor(int color, SkXfermode::Mode mode); virtual status_t drawRect(float left, float top, float right, float bottom, SkPaint* paint); Loading