OSDN Git Service

Make sure the opaque bitmap is opaque. GL doesn't like being lied to.
authorRomain Guy <romainguy@google.com>
Wed, 26 Jan 2011 06:53:24 +0000 (22:53 -0800)
committerRomain Guy <romainguy@google.com>
Wed, 26 Jan 2011 06:53:24 +0000 (22:53 -0800)
Bug #3382992

The result still looks wrong but it works as designed, unfortunately.

Change-Id: I6108e199fa336cb01faaabf6c75faa3b71c2339b

core/java/android/view/ViewRoot.java
libs/hwui/OpenGLRenderer.cpp

index ca19da2..b0553c6 100644 (file)
@@ -784,6 +784,7 @@ public final class ViewRoot extends Handler implements ViewParent,
                                     Bitmap.Config.ARGB_8888);
                             mResizeBitmap.setHasAlpha(false);
                             Canvas canvas = new Canvas(mResizeBitmap);
+                            canvas.drawColor(0xff000000, PorterDuff.Mode.SRC);
                             int yoff;
                             final boolean scrolling = mScroller != null
                                     && mScroller.computeScrollOffset();
@@ -1500,7 +1501,12 @@ public final class ViewRoot extends Handler implements ViewParent,
                 mPreviousDirty.set(dirty);
                 dirty.setEmpty();
 
-                mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this, mCurrentDirty);
+                Rect currentDirty = mCurrentDirty;
+                if (animating) {
+                    currentDirty = null;
+                }
+
+                mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this, currentDirty);
             }
 
             if (animating) {
index 9f491b3..c378f46 100644 (file)
@@ -218,6 +218,9 @@ void OpenGLRenderer::releaseContext() {
 
 bool OpenGLRenderer::callDrawGLFunction(Functor *functor) {
     interrupt();
+    if (mDirtyClip) {
+        setScissorFromClip();
+    }
     status_t result = (*functor)();
     resume();
     return (result == 0) ? false : true;
@@ -1451,13 +1454,7 @@ void OpenGLRenderer::drawRect(float left, float top, float right, float bottom,
         mode = getXfermode(p->getXfermode());
     }
 
-    // Skia draws using the color's alpha channel if < 255
-    // Otherwise, it uses the paint's alpha
     int color = p->getColor();
-    if (((color >> 24) & 0xff) == 255) {
-        color |= p->getAlpha() << 24;
-    }
-
     drawColorRect(left, top, right, bottom, color, mode);
 }