diff options
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 26 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 2 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 20 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.h | 1 |
4 files changed, 21 insertions, 28 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 044627c..6ec0955 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4100,21 +4100,23 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final int left = mLeft; final int top = mTop; - if ((mGroupFlags & FLAG_CLIP_CHILDREN) != FLAG_CLIP_CHILDREN || - dirty.intersect(0, 0, mRight - left, mBottom - top) || - (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) { - mPrivateFlags &= ~DRAWING_CACHE_VALID; - - location[CHILD_LEFT_INDEX] = left; - location[CHILD_TOP_INDEX] = top; - - if (mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; - mLocalDirtyRect.union(dirty); + if ((mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN) { + if (!dirty.intersect(0, 0, mRight - left, mBottom - top)) { + dirty.setEmpty(); } + } + mPrivateFlags &= ~DRAWING_CACHE_VALID; + + location[CHILD_LEFT_INDEX] = left; + location[CHILD_TOP_INDEX] = top; - return mParent; + if (mLayerType != LAYER_TYPE_NONE) { + mPrivateFlags |= INVALIDATED; + mLocalDirtyRect.union(dirty); } + + return mParent; + } else { mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 6959b84..ad850da 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -870,6 +870,8 @@ public final class ViewRootImpl implements ViewParent, if (dirty == null) { invalidate(); return null; + } else if (dirty.isEmpty()) { + return null; } if (mCurScrollY != 0 || mTranslator != null) { diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index c92bead..9a90bfd 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1149,7 +1149,6 @@ void OpenGLRenderer::setupDrawColor(int color) { void OpenGLRenderer::setupDrawColor(int color, int alpha) { mColorA = alpha / 255.0f; - mColorA *= mSnapshot->alpha; // Second divide of a by 255 is an optimization, allowing us to simply multiply // the rgb values by a instead of also dividing by 255 const float a = mColorA / 255.0f; @@ -1181,15 +1180,6 @@ void OpenGLRenderer::setupDrawColor(float r, float g, float b, float a) { mSetShaderColor = mDescription.setColor(r, g, b, a); } -void OpenGLRenderer::setupDrawAlpha8Color(float r, float g, float b, float a) { - mColorA = a; - mColorR = r; - mColorG = g; - mColorB = b; - mColorSet = true; - mSetShaderColor = mDescription.setAlpha8Color(r, g, b, a); -} - void OpenGLRenderer::setupDrawShader() { if (mShader) { mShader->describe(mDescription, mCaches.extensions); @@ -1771,7 +1761,7 @@ void OpenGLRenderer::drawAARect(float left, float top, float right, float bottom setupDraw(); setupDrawNoTexture(); setupDrawAALine(); - setupDrawColor(color); + setupDrawColor(color, ((color >> 24) & 0xFF) * mSnapshot->alpha); setupDrawColorFilter(); setupDrawShader(); setupDrawBlending(true, mode); @@ -2267,7 +2257,7 @@ status_t OpenGLRenderer::drawRect(float left, float top, float right, float bott status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count, const float* positions, SkPaint* paint) { if (text == NULL || count == 0 || mSnapshot->isIgnored() || - (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) { + (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) { return DrawGlInfo::kStatusDone; } @@ -2340,7 +2330,7 @@ status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, float x, float y, SkPaint* paint, float length) { if (text == NULL || count == 0 || mSnapshot->isIgnored() || - (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) { + (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) { return DrawGlInfo::kStatusDone; } @@ -2393,7 +2383,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, const float sx = oldX - shadow->left + mShadowDx; const float sy = oldY - shadow->top + mShadowDy; - const int shadowAlpha = ((mShadowColor >> 24) & 0xFF); + const int shadowAlpha = ((mShadowColor >> 24) & 0xFF) * mSnapshot->alpha; int shadowColor = mShadowColor; if (mShader) { shadowColor = 0xffffffff; @@ -2792,7 +2782,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot setupDraw(); setupDrawNoTexture(); - setupDrawColor(color); + setupDrawColor(color, ((color >> 24) & 0xFF) * mSnapshot->alpha); setupDrawShader(); setupDrawColorFilter(); setupDrawBlending(mode); diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index b342f50..7aac87c 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -537,7 +537,6 @@ private: void setupDrawColor(int color, int alpha); void setupDrawColor(float r, float g, float b, float a); void setupDrawAlpha8Color(int color, int alpha); - void setupDrawAlpha8Color(float r, float g, float b, float a); void setupDrawShader(); void setupDrawColorFilter(); void setupDrawBlending(SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode, |
