summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics/Shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/jni/android/graphics/Shader.cpp')
-rw-r--r--core/jni/android/graphics/Shader.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index b28eb90..b09c62b 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -43,25 +43,23 @@ static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArra
static void Shader_destructor(JNIEnv* env, jobject, SkShader* shader)
{
- SkASSERT(shader != NULL);
- shader->unref();
+ shader->safeUnref();
}
static bool Shader_getLocalMatrix(JNIEnv* env, jobject, const SkShader* shader, SkMatrix* matrix)
{
- SkASSERT(shader != NULL);
- return shader->getLocalMatrix(matrix);
+ return shader ? shader->getLocalMatrix(matrix) : false;
}
static void Shader_setLocalMatrix(JNIEnv* env, jobject, SkShader* shader, const SkMatrix* matrix)
{
- SkASSERT(shader != NULL);
-
- if (NULL == matrix) {
- shader->resetLocalMatrix();
- }
- else {
- shader->setLocalMatrix(*matrix);
+ if (shader) {
+ if (NULL == matrix) {
+ shader->resetLocalMatrix();
+ }
+ else {
+ shader->setLocalMatrix(*matrix);
+ }
}
}