summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-02-28 12:26:34 -0800
committerChris Craik <ccraik@google.com>2014-02-28 12:26:34 -0800
commit67862524056ee2e73a94395139bb8bd0ec1ef38a (patch)
tree20273dae825bf5256ca8703038f7357825d090c2
parent9f6a372ca08c657447ef4b8dc6c80a89202247f8 (diff)
downloadframeworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.zip
frameworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.tar.gz
frameworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.tar.bz2
Fix use of Skia deprecated methods
Change-Id: Ib89c20fc94bcce29b7490d6f55c73492735befda
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/android/graphics/MaskFilter.cpp13
-rw-r--r--core/jni/android/graphics/Shader.cpp2
-rw-r--r--libs/hwui/DisplayListOp.h2
-rw-r--r--libs/hwui/OpenGLRenderer.cpp19
5 files changed, 22 insertions, 15 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index cf69d9e..a09c314 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -164,6 +164,7 @@ LOCAL_C_INCLUDES += \
$(TOP)/frameworks/av/include \
$(TOP)/system/media/camera/include \
external/skia/src/core \
+ external/skia/src/effects \
external/skia/src/images \
external/sqlite/dist \
external/sqlite/android \
diff --git a/core/jni/android/graphics/MaskFilter.cpp b/core/jni/android/graphics/MaskFilter.cpp
index f331af7..756bb6b 100644
--- a/core/jni/android/graphics/MaskFilter.cpp
+++ b/core/jni/android/graphics/MaskFilter.cpp
@@ -1,5 +1,6 @@
#include "GraphicsJNI.h"
#include "SkMaskFilter.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkTableMaskFilter.h"
@@ -19,8 +20,9 @@ public:
}
static jlong createBlur(JNIEnv* env, jobject, jfloat radius, jint blurStyle) {
- SkMaskFilter* filter = SkBlurMaskFilter::Create(SkFloatToScalar(radius),
- (SkBlurMaskFilter::BlurStyle)blurStyle);
+ SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkFloatToScalar(radius));
+ SkMaskFilter* filter = SkBlurMaskFilter::Create(sigma,
+ (SkBlurMaskFilter::BlurStyle)blurStyle);
ThrowIAE_IfNull(env, filter);
return reinterpret_cast<jlong>(filter);
}
@@ -34,10 +36,9 @@ public:
direction[i] = SkFloatToScalar(values[i]);
}
- SkMaskFilter* filter = SkBlurMaskFilter::CreateEmboss(direction,
- SkFloatToScalar(ambient),
- SkFloatToScalar(specular),
- SkFloatToScalar(radius));
+ SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkFloatToScalar(radius));
+ SkMaskFilter* filter = SkBlurMaskFilter::CreateEmboss(sigma,
+ direction, SkFloatToScalar(ambient), SkFloatToScalar(specular));
ThrowIAE_IfNull(env, filter);
return reinterpret_cast<jlong>(filter);
}
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 3047440..1fe6358 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -520,7 +520,7 @@ static jlong ComposeShader_postCreate1(JNIEnv* env, jobject o, jlong shaderHandl
SkiaShader* shaderB = reinterpret_cast<SkiaShader *>(shaderBHandle);
SkXfermode* mode = reinterpret_cast<SkXfermode *>(modeHandle);
SkXfermode::Mode skiaMode;
- if (!SkXfermode::IsMode(mode, &skiaMode)) {
+ if (!SkXfermode::AsMode(mode, &skiaMode)) {
// TODO: Support other modes
skiaMode = SkXfermode::kSrcOver_Mode;
}
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index b5a66f6..65eda29 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -788,7 +788,7 @@ public:
deferInfo.mergeable = state.mMatrix.isSimple() && state.mMatrix.positiveScale() &&
!state.mClipSideFlags &&
OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode &&
- (mBitmap->getConfig() != SkBitmap::kA8_Config);
+ (mBitmap->config() != SkBitmap::kA8_Config);
}
const SkBitmap* bitmap() { return mBitmap; }
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 1c59c30..b620b80 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -52,7 +52,12 @@ namespace uirenderer {
#define ALPHA_THRESHOLD 0
-#define FILTER(paint) (!paint || paint->isFilterBitmap() ? GL_LINEAR : GL_NEAREST)
+static GLenum getFilter(const SkPaint* paint) {
+ if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) {
+ return GL_LINEAR;
+ }
+ return GL_NEAREST;
+}
///////////////////////////////////////////////////////////////////////////////
// Globals
@@ -1973,7 +1978,7 @@ void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, co
texture->setFilter(GL_NEAREST, true);
} else {
- texture->setFilter(FILTER(paint), true);
+ texture->setFilter(getFilter(paint), true);
}
// No need to check for a UV mapper on the texture object, only ARGB_8888
@@ -1998,7 +2003,7 @@ status_t OpenGLRenderer::drawBitmaps(const SkBitmap* bitmap, AssetAtlas::Entry*
const AutoTexture autoCleanup(texture);
texture->setWrap(GL_CLAMP_TO_EDGE, true);
- texture->setFilter(pureTranslate ? GL_NEAREST : FILTER(paint), true);
+ texture->setFilter(pureTranslate ? GL_NEAREST : getFilter(paint), true);
const float x = (int) floorf(bounds.left + 0.5f);
const float y = (int) floorf(bounds.top + 0.5f);
@@ -2174,7 +2179,7 @@ status_t OpenGLRenderer::drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, i
const AutoTexture autoCleanup(texture);
texture->setWrap(GL_CLAMP_TO_EDGE, true);
- texture->setFilter(FILTER(paint), true);
+ texture->setFilter(getFilter(paint), true);
int alpha;
SkXfermode::Mode mode;
@@ -2259,10 +2264,10 @@ status_t OpenGLRenderer::drawBitmap(const SkBitmap* bitmap,
dstLeft = x;
dstTop = y;
- texture->setFilter(scaled ? FILTER(paint) : GL_NEAREST, true);
+ texture->setFilter(scaled ? getFilter(paint) : GL_NEAREST, true);
ignoreTransform = true;
} else {
- texture->setFilter(FILTER(paint), true);
+ texture->setFilter(getFilter(paint), true);
}
if (CC_UNLIKELY(useScaleTransform)) {
@@ -3382,7 +3387,7 @@ void OpenGLRenderer::drawTextureRect(float left, float top, float right, float b
paint, texture->blend, vertices, texCoords,
GL_TRIANGLE_STRIP, gMeshCount, false, true);
} else {
- texture->setFilter(FILTER(paint), true);
+ texture->setFilter(getFilter(paint), true);
drawTextureMesh(left, top, right, bottom, texture->id, paint,
texture->blend, vertices, texCoords, GL_TRIANGLE_STRIP, gMeshCount);
}