diff options
| author | 2013-03-04 21:49:15 +0000 | |
|---|---|---|
| committer | 2013-03-04 21:49:16 +0000 | |
| commit | e7d32b19b46c65ff37001e456bedf68222599119 (patch) | |
| tree | d68f421e555d80614837b1fd83d55fef93dbceaa /libs/hwui/OpenGLRenderer.cpp | |
| parent | 4c333e177220387cf6746d47e1948bbfcc374512 (diff) | |
| parent | 19d4dd8599cb870923ab349d2ab96cacffd9c6f5 (diff) | |
Merge "Take text scale/skew into account only when rendering into a layer" into jb-mr2-dev
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 23 | 
1 files changed, 20 insertions, 3 deletions
| diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index ff6f332e6791..c81bf7a8918d 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2673,7 +2673,26 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,                  alpha, mode, oldX, oldY);      } -    fontRenderer.setFont(paint, pureTranslate ? mat4::identity() : *mSnapshot->transform); +    const bool hasActiveLayer = hasLayer(); + +    const mat4* fontTransform; +    if (CC_LIKELY(pureTranslate)) { +        fontTransform = &mat4::identity(); +    } else { +        if (CC_UNLIKELY(isPerspective)) { +            // When the below condition is true, we are rendering text with a +            // perspective transform inside a layer (either an inline layer +            // created by Canvas.saveLayer() or a hardware layer.) +            if (hasActiveLayer || getTargetFbo() != 0) { +                fontTransform = mSnapshot->transform; +            } else { +                fontTransform = &mat4::identity(); +            } +        } else { +            fontTransform = mSnapshot->transform; +        } +    } +    fontRenderer.setFont(paint, *fontTransform);      // Pick the appropriate texture filtering      bool linearFilter = !pureTranslate || fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f; @@ -2701,8 +2720,6 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,      const Rect* clip = isPerspective ? NULL : mSnapshot->clipRect;      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 (CC_UNLIKELY(paint->getTextAlign() != SkPaint::kLeft_Align)) {          SkPaint paintCopy(*paint); |