diff options
author | John Reck <jreck@google.com> | 2015-04-10 13:52:57 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-04-13 09:50:42 -0700 |
commit | a771b9861d11671c780092d35c0062eeefcf37c0 (patch) | |
tree | a575dc870712330cb8ddc70b5dccd0df26806a6a /core/jni/android/opengl | |
parent | 4147877b388eb4a6f4e1ee116edfa58a018891ca (diff) | |
download | frameworks_base-a771b9861d11671c780092d35c0062eeefcf37c0.zip frameworks_base-a771b9861d11671c780092d35c0062eeefcf37c0.tar.gz frameworks_base-a771b9861d11671c780092d35c0062eeefcf37c0.tar.bz2 |
Change how Java Bitmaps are accessed in a few places
Stop assuming that a Java Bitmap has a SkBitmap* that
has some externally managed lifecycle, and instead switch
a bunch of users to accessing the bitmap by providing
their own SkBitmap* on which to set the (ref counted!)
SkPixelRef* instead
Change-Id: I0fd9e193968b41e5597784140d56b4885906864a
Diffstat (limited to 'core/jni/android/opengl')
-rw-r--r-- | core/jni/android/opengl/util.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp index 5c2d0d0..bce2b33 100644 --- a/core/jni/android/opengl/util.cpp +++ b/core/jni/android/opengl/util.cpp @@ -618,23 +618,25 @@ static int getType(SkColorType colorType) static jint util_getInternalFormat(JNIEnv *env, jclass clazz, jobject jbitmap) { - SkBitmap const * nativeBitmap = GraphicsJNI::getSkBitmap(env, jbitmap); - return getInternalFormat(nativeBitmap->colorType()); + SkBitmap nativeBitmap; + GraphicsJNI::getSkBitmap(env, jbitmap, &nativeBitmap); + return getInternalFormat(nativeBitmap.colorType()); } static jint util_getType(JNIEnv *env, jclass clazz, jobject jbitmap) { - SkBitmap const * nativeBitmap = GraphicsJNI::getSkBitmap(env, jbitmap); - return getType(nativeBitmap->colorType()); + SkBitmap nativeBitmap; + GraphicsJNI::getSkBitmap(env, jbitmap, &nativeBitmap); + return getType(nativeBitmap.colorType()); } static jint util_texImage2D(JNIEnv *env, jclass clazz, jint target, jint level, jint internalformat, jobject jbitmap, jint type, jint border) { - SkBitmap const * nativeBitmap = GraphicsJNI::getSkBitmap(env, jbitmap); - const SkBitmap& bitmap(*nativeBitmap); + SkBitmap bitmap; + GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap); SkColorType colorType = bitmap.colorType(); if (internalformat < 0) { internalformat = getInternalFormat(colorType); @@ -680,8 +682,8 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz, jint target, jint level, jint xoffset, jint yoffset, jobject jbitmap, jint format, jint type) { - SkBitmap const * nativeBitmap = GraphicsJNI::getSkBitmap(env, jbitmap); - const SkBitmap& bitmap(*nativeBitmap); + SkBitmap bitmap; + GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap); SkColorType colorType = bitmap.colorType(); if (format < 0) { format = getInternalFormat(colorType); |