Merge "Revert "Add a way to override Xfermode DO NOT MERGE"" into lmp-mr1-dev
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index dbd580d..9061679 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -997,15 +997,4 @@
int indexOffset, int indexCount, Paint paint) {
// TODO: Implement
}
-
- @Override
- public void setOverrideXfermode(PorterDuff.Mode xfermode) {
- int xfermodeValue = -1;
- if (xfermode != null) {
- xfermodeValue = xfermode.nativeInt;
- }
- nSetOverrideXfermode(mRenderer, xfermodeValue);
- }
-
- private static native void nSetOverrideXfermode(long renderer, int xfermode);
}
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index fe64aba..b023ebd 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -172,12 +172,6 @@
return Caches::getInstance().maxTextureSize;
}
-static void android_view_GLES20Canvas_setOverrideXfermode(JNIEnv* env, jobject clazz,
- jlong rendererPtr, int xfermode) {
- DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
- renderer->setOverrideXfermode(xfermode);
-}
-
// ----------------------------------------------------------------------------
// State
// ----------------------------------------------------------------------------
@@ -970,8 +964,6 @@
{ "nGetMaximumTextureWidth", "()I", (void*) android_view_GLES20Canvas_getMaxTextureWidth },
{ "nGetMaximumTextureHeight", "()I", (void*) android_view_GLES20Canvas_getMaxTextureHeight },
- { "nSetOverrideXfermode", "(JI)V", (void*) android_view_GLES20Canvas_setOverrideXfermode },
-
#endif
};
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 499608e..b0580d5 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -250,15 +250,6 @@
public void insertInorderBarrier() {}
/**
- * Set a transfer mode that overrides any transfer modes
- * in paints used for drawing. Pass null to disable this
- * override. Only implemented in GLES20Canvas.
- *
- * @hide
- */
- public void setOverrideXfermode(@Nullable PorterDuff.Mode xfermode) {}
-
- /**
* Return true if the device that the current layer draws into is opaque
* (i.e. does not support per-pixel alpha).
*
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 3ec5e40..c2cb76e 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -39,7 +39,6 @@
, mTranslateY(0.0f)
, mDeferredBarrierType(kBarrier_None)
, mHighContrastText(false)
- , mOverrideXfermode(-1)
, mRestoreSaveCount(-1) {
}
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index f93a798..2cc2be3 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -20,7 +20,6 @@
#include <SkMatrix.h>
#include <SkPaint.h>
#include <SkPath.h>
-#include <SkPorterDuff.h>
#include <cutils/compiler.h>
#include "DisplayListLogBuffer.h"
@@ -162,15 +161,6 @@
void setHighContrastText(bool highContrastText) {
mHighContrastText = highContrastText;
}
-
- void setOverrideXfermode(int xfermode) {
- if (xfermode != -1) {
- SkPorterDuff::Mode porterDuffMode = static_cast<SkPorterDuff::Mode>(xfermode);
- xfermode = SkPorterDuff::ToXfermodeMode(porterDuffMode);
- }
- mOverrideXfermode = xfermode;
- };
-
private:
enum DeferredBarrierType {
kBarrier_None,
@@ -230,26 +220,18 @@
inline const SkPaint* refPaint(const SkPaint* paint) {
if (!paint) return NULL;
- const SkPaint* paintCopy;
-
- if (mOverrideXfermode != -1) {
- SkPaint* overriddenPaint = copyPaint(paint);
- overriddenPaint->setXfermodeMode(static_cast<SkXfermode::Mode>(mOverrideXfermode));
- paintCopy = overriddenPaint;
- } else {
- paintCopy = mPaintMap.valueFor(paint);
- if (paintCopy == NULL
- || paintCopy->getGenerationID() != paint->getGenerationID()
- // We can't compare shader pointers because that will always
- // change as we do partial copying via wrapping. However, if the
- // shader changes the paint generationID will have changed and
- // so we don't hit this comparison anyway
- || !(paint->getShader() && paintCopy->getShader()
- && paint->getShader()->getGenerationID() == paintCopy->getShader()->getGenerationID())) {
- paintCopy = copyPaint(paint);
- // replaceValueFor() performs an add if the entry doesn't exist
- mPaintMap.replaceValueFor(paint, paintCopy);
- }
+ const SkPaint* paintCopy = mPaintMap.valueFor(paint);
+ if (paintCopy == NULL
+ || paintCopy->getGenerationID() != paint->getGenerationID()
+ // We can't compare shader pointers because that will always
+ // change as we do partial copying via wrapping. However, if the
+ // shader changes the paint generationID will have changed and
+ // so we don't hit this comparison anyway
+ || !(paint->getShader() && paintCopy->getShader()
+ && paint->getShader()->getGenerationID() == paintCopy->getShader()->getGenerationID())) {
+ paintCopy = copyPaint(paint);
+ // replaceValueFor() performs an add if the entry doesn't exist
+ mPaintMap.replaceValueFor(paint, paintCopy);
}
return paintCopy;
@@ -322,9 +304,6 @@
DeferredBarrierType mDeferredBarrierType;
bool mHighContrastText;
- // -1 if unset, or SkXfermode::Mode value if set
- int mOverrideXfermode;
-
int mRestoreSaveCount;
friend class RenderNode;