summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-08-22 11:15:37 -0700
committerJohn Reck <jreck@google.com>2014-08-22 11:15:37 -0700
commit01edef10b9724fa5607d7918addc31a3b0c991dc (patch)
tree93bce27d472d1d52b5629aca1a93c1adf68bf001 /core
parent91d065bcbfa0223d2fc2be8f3bba70a77fcb9355 (diff)
downloadframeworks_base-01edef10b9724fa5607d7918addc31a3b0c991dc.zip
frameworks_base-01edef10b9724fa5607d7918addc31a3b0c991dc.tar.gz
frameworks_base-01edef10b9724fa5607d7918addc31a3b0c991dc.tar.bz2
Revert immutable Shader change
Bug: 16733996 Change-Id: I51686aaf8f6ae8d0e390e298ad70f98f81c5f555
Diffstat (limited to 'core')
-rw-r--r--core/jni/android/graphics/Shader.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index fbb243a..e02aa5e 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -54,26 +54,19 @@ static void Shader_destructor(JNIEnv* env, jobject o, jlong shaderHandle, jlong
{
SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
SkSafeUnref(shader);
- SkShader* shaderWithLM = reinterpret_cast<SkShader*>(shaderWithLMHandle);
- SkSafeUnref(shaderWithLM);
}
-static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle,
- jlong oldLocalMatrixShaderHandle, jlong matrixHandle)
+static void Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, jlong matrixHandle)
{
- // The old shader with local matrix is no longer needed, so unref it.
- SkSafeUnref(reinterpret_cast<SkShader*>(oldLocalMatrixShaderHandle));
-
SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
if (shader) {
- if (NULL == matrix) {
- matrix = &SkMatrix::I();
+ if (matrix) {
+ shader->setLocalMatrix(*matrix);
+ } else {
+ shader->resetLocalMatrix();
}
- SkShader* newShader = SkShader::CreateLocalMatrixShader(shader, *matrix);
- shader = newShader;
}
- return reinterpret_cast<jlong>(shader);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -243,8 +236,8 @@ static JNINativeMethod gColorMethods[] = {
};
static JNINativeMethod gShaderMethods[] = {
- { "nativeDestructor", "(JJ)V", (void*)Shader_destructor },
- { "nativeSetLocalMatrix", "(JJJ)J", (void*)Shader_setLocalMatrix }
+ { "nativeDestructor", "(J)V", (void*)Shader_destructor },
+ { "nativeSetLocalMatrix", "(JJ)V", (void*)Shader_setLocalMatrix }
};
static JNINativeMethod gBitmapShaderMethods[] = {