diff options
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index b0328f5..c015077 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -193,6 +193,11 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto syncState(); + // Functors break the tiling extension in pretty spectacular ways + // This ensures we don't use tiling when a functor is going to be + // invoked during the frame + mSuppressTiling = mCaches.hasRegisteredFunctors(); + mTilingSnapshot = mSnapshot; startTiling(mTilingSnapshot, true); @@ -221,17 +226,19 @@ void OpenGLRenderer::syncState() { } void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque) { - Rect* clip = mTilingSnapshot->clipRect; - if (s->flags & Snapshot::kFlagIsFboLayer) { - clip = s->clipRect; - } + if (!mSuppressTiling) { + Rect* clip = mTilingSnapshot->clipRect; + if (s->flags & Snapshot::kFlagIsFboLayer) { + clip = s->clipRect; + } - mCaches.startTiling(clip->left, s->height - clip->bottom, - clip->right - clip->left, clip->bottom - clip->top, opaque); + mCaches.startTiling(clip->left, s->height - clip->bottom, + clip->right - clip->left, clip->bottom - clip->top, opaque); + } } void OpenGLRenderer::endTiling() { - mCaches.endTiling(); + if (!mSuppressTiling) mCaches.endTiling(); } void OpenGLRenderer::finish() { @@ -2640,20 +2647,21 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, setupDrawShaderUniforms(pureTranslate); setupDrawTextGammaUniforms(); - const Rect* clip = pureTranslate ? mSnapshot->clipRect : &mSnapshot->getLocalClip(); + const Rect* clip = pureTranslate ? mSnapshot->clipRect : + (mSnapshot->hasPerspectiveTransform() ? NULL : &mSnapshot->getLocalClip()); Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f); const bool hasActiveLayer = hasLayer(); bool status; - if (paint->getTextAlign() != SkPaint::kLeft_Align) { + if (CC_UNLIKELY(paint->getTextAlign() != SkPaint::kLeft_Align)) { SkPaint paintCopy(*paint); paintCopy.setTextAlign(SkPaint::kLeft_Align); status = fontRenderer.renderPosText(&paintCopy, clip, text, 0, bytesCount, count, x, y, - positions, hasActiveLayer ? &bounds : NULL); + positions, hasActiveLayer ? &bounds : NULL); } else { status = fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y, - positions, hasActiveLayer ? &bounds : NULL); + positions, hasActiveLayer ? &bounds : NULL); } if (status && hasActiveLayer) { |