Loading core/jni/android/graphics/Bitmap.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ static int getPremulBitmapCreateFlags(bool isMutable) { static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, jint offset, jint stride, jint width, jint height, jint configHandle, jboolean isMutable) { SkColorType colorType = SkBitmapConfigToColorType(static_cast<SkBitmap::Config>(configHandle)); SkColorType colorType = GraphicsJNI::legacyBitmapConfigToColorType(configHandle); if (NULL != jColors) { size_t n = env->GetArrayLength(jColors); if (n < SkAbs32(stride) * (size_t)height) { Loading Loading @@ -350,11 +350,11 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, static jobject Bitmap_copy(JNIEnv* env, jobject, jlong srcHandle, jint dstConfigHandle, jboolean isMutable) { const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle); SkBitmap::Config dstConfig = static_cast<SkBitmap::Config>(dstConfigHandle); SkColorType dstCT = GraphicsJNI::legacyBitmapConfigToColorType(dstConfigHandle); SkBitmap result; JavaPixelAllocator allocator(env); if (!src->copyTo(&result, SkBitmapConfigToColorType(dstConfig), &allocator)) { if (!src->copyTo(&result, dstCT, &allocator)) { return NULL; } return GraphicsJNI::createBitmap(env, new SkBitmap(result), allocator.getStorageObj(), Loading Loading @@ -389,8 +389,7 @@ static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle, jint width, jint height, jint configHandle, jint allocSize, jboolean requestPremul) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle); SkColorType colorType = SkBitmapConfigToColorType(config); SkColorType colorType = GraphicsJNI::legacyBitmapConfigToColorType(configHandle); // ARGB_4444 is a deprecated format, convert automatically to 8888 if (colorType == kARGB_4444_SkColorType) { Loading Loading @@ -494,7 +493,7 @@ static jint Bitmap_rowBytes(JNIEnv* env, jobject, jlong bitmapHandle) { static jint Bitmap_config(JNIEnv* env, jobject, jlong bitmapHandle) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); return static_cast<jint>(bitmap->config()); return GraphicsJNI::colorTypeToLegacyBitmapConfig(bitmap->colorType()); } static jint Bitmap_getGenerationId(JNIEnv* env, jobject, jlong bitmapHandle) { Loading Loading @@ -810,7 +809,7 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, const SkBitmap* bm1 = reinterpret_cast<SkBitmap*>(bm1Handle); if (bm0->width() != bm1->width() || bm0->height() != bm1->height() || bm0->config() != bm1->config()) { bm0->colorType() != bm1->colorType()) { return JNI_FALSE; } Loading @@ -822,7 +821,7 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, return JNI_FALSE; } if (bm0->config() == SkBitmap::kIndex8_Config) { if (bm0->colorType() == kIndex_8_SkColorType) { SkColorTable* ct0 = bm0->getColorTable(); SkColorTable* ct1 = bm1->getColorTable(); if (NULL == ct0 || NULL == ct1) { Loading core/jni/android/graphics/Graphics.cpp +49 −4 Original line number Diff line number Diff line Loading @@ -291,6 +291,54 @@ void GraphicsJNI::point_to_jpointf(const SkPoint& r, JNIEnv* env, jobject obj) env->SetFloatField(obj, gPointF_yFieldID, SkScalarToFloat(r.fY)); } // This enum must keep these int values, to match the int values // in the java Bitmap.Config enum. enum LegacyBitmapConfig { kNo_LegacyBitmapConfig = 0, kA8_LegacyBitmapConfig = 1, kIndex8_LegacyBitmapConfig = 2, kRGB_565_LegacyBitmapConfig = 3, kARGB_4444_LegacyBitmapConfig = 4, kARGB_8888_LegacyBitmapConfig = 5, kLastEnum_LegacyBitmapConfig = kARGB_8888_LegacyBitmapConfig }; jint GraphicsJNI::colorTypeToLegacyBitmapConfig(SkColorType colorType) { switch (colorType) { case kN32_SkColorType: return kARGB_8888_LegacyBitmapConfig; case kARGB_4444_SkColorType: return kARGB_4444_LegacyBitmapConfig; case kRGB_565_SkColorType: return kRGB_565_LegacyBitmapConfig; case kIndex_8_SkColorType: return kIndex8_LegacyBitmapConfig; case kAlpha_8_SkColorType: return kA8_LegacyBitmapConfig; case kUnknown_SkColorType: default: break; } return kNo_LegacyBitmapConfig; } SkColorType GraphicsJNI::legacyBitmapConfigToColorType(jint legacyConfig) { const uint8_t gConfig2ColorType[] = { kUnknown_SkColorType, kAlpha_8_SkColorType, kIndex_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kN32_SkColorType }; if (legacyConfig < 0 || legacyConfig > kLastEnum_LegacyBitmapConfig) { legacyConfig = kNo_LegacyBitmapConfig; } return static_cast<SkColorType>(gConfig2ColorType[legacyConfig]); } SkBitmap* GraphicsJNI::getNativeBitmap(JNIEnv* env, jobject bitmap) { SkASSERT(env); SkASSERT(bitmap); Loading @@ -308,10 +356,7 @@ SkColorType GraphicsJNI::getNativeBitmapColorType(JNIEnv* env, jobject jconfig) } SkASSERT(env->IsInstanceOf(jconfig, gBitmapConfig_class)); int c = env->GetIntField(jconfig, gBitmapConfig_nativeInstanceID); if (c < 0 || c >= SkBitmap::kConfigCount) { c = kUnknown_SkColorType; } return SkBitmapConfigToColorType(static_cast<SkBitmap::Config>(c)); return legacyBitmapConfigToColorType(c); } SkCanvas* GraphicsJNI::getNativeCanvas(JNIEnv* env, jobject canvas) { Loading core/jni/android/graphics/GraphicsJNI.h +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ public: // ref to its SkRasterizer* (or NULL). static SkRasterizer* refNativeRasterizer(jlong rasterizerHandle); /* * LegacyBitmapConfig is the old enum in Skia that matched the enum int values * in Bitmap.Config. Skia no longer supports this config, but has replaced it * with SkColorType. These routines convert between the two. */ static SkColorType legacyBitmapConfigToColorType(jint legacyConfig); static jint colorTypeToLegacyBitmapConfig(SkColorType colorType); /** Return the corresponding native colorType from the java Config enum, or kUnknown_SkColorType if the java object is null. */ Loading core/jni/android/graphics/NinePatchImpl.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -38,18 +38,18 @@ #include <utils/Log.h> static bool getColor(const SkBitmap& bitmap, int x, int y, SkColor* c) { switch (bitmap.config()) { case SkBitmap::kARGB_8888_Config: switch (bitmap.colorType()) { case kN32_SkColorType: *c = SkUnPreMultiply::PMColorToColor(*bitmap.getAddr32(x, y)); break; case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: *c = SkPixel16ToPixel32(*bitmap.getAddr16(x, y)); break; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: *c = SkUnPreMultiply::PMColorToColor( SkPixel4444ToPixel32(*bitmap.getAddr16(x, y))); break; case SkBitmap::kIndex8_Config: { case kIndex_8_SkColorType: { SkColorTable* ctable = bitmap.getColorTable(); *c = SkUnPreMultiply::PMColorToColor( (*ctable)[*bitmap.getAddr8(x, y)]); Loading core/jni/android/opengl/util.cpp +30 −34 Original line number Diff line number Diff line Loading @@ -562,18 +562,18 @@ void setTracingLevel(JNIEnv *env, jclass clazz, jint level) setGLDebugLevel(level); } static int checkFormat(SkBitmap::Config config, int format, int type) static int checkFormat(SkColorType colorType, int format, int type) { switch(config) { case SkBitmap::kIndex8_Config: switch(colorType) { case kIndex_8_SkColorType: if (format == GL_PALETTE8_RGBA8_OES) return 0; case SkBitmap::kARGB_8888_Config: case SkBitmap::kA8_Config: case kN32_SkColorType: case kAlpha_8_SkColorType: if (type == GL_UNSIGNED_BYTE) return 0; case SkBitmap::kARGB_4444_Config: case SkBitmap::kRGB_565_Config: case kARGB_4444_SkColorType: case kRGB_565_SkColorType: switch (type) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_5_6_5: Loading @@ -590,36 +590,36 @@ static int checkFormat(SkBitmap::Config config, int format, int type) return -1; } static int getInternalFormat(SkBitmap::Config config) static int getInternalFormat(SkColorType colorType) { switch(config) { case SkBitmap::kA8_Config: switch(colorType) { case kAlpha_8_SkColorType: return GL_ALPHA; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: return GL_RGBA; case SkBitmap::kARGB_8888_Config: case kN32_SkColorType: return GL_RGBA; case SkBitmap::kIndex8_Config: case kIndex_8_SkColorType: return GL_PALETTE8_RGBA8_OES; case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: return GL_RGB; default: return -1; } } static int getType(SkBitmap::Config config) static int getType(SkColorType colorType) { switch(config) { case SkBitmap::kA8_Config: switch(colorType) { case kAlpha_8_SkColorType: return GL_UNSIGNED_BYTE; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: return GL_UNSIGNED_SHORT_4_4_4_4; case SkBitmap::kARGB_8888_Config: case kN32_SkColorType: return GL_UNSIGNED_BYTE; case SkBitmap::kIndex8_Config: case kIndex_8_SkColorType: return -1; // No type for compressed data. case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: return GL_UNSIGNED_SHORT_5_6_5; default: return -1; Loading @@ -631,9 +631,7 @@ static jint util_getInternalFormat(JNIEnv *env, jclass clazz, { SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); return getInternalFormat(config); return getInternalFormat(nativeBitmap->colorType()); } static jint util_getType(JNIEnv *env, jclass clazz, Loading @@ -641,9 +639,7 @@ static jint util_getType(JNIEnv *env, jclass clazz, { SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); return getType(config); return getType(nativeBitmap->colorType()); } static jint util_texImage2D(JNIEnv *env, jclass clazz, Loading @@ -653,14 +649,14 @@ static jint util_texImage2D(JNIEnv *env, jclass clazz, SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); SkColorType colorType = bitmap.colorType(); if (internalformat < 0) { internalformat = getInternalFormat(config); internalformat = getInternalFormat(colorType); } if (type < 0) { type = getType(config); type = getType(colorType); } int err = checkFormat(config, internalformat, type); int err = checkFormat(colorType, internalformat, type); if (err) return err; bitmap.lockPixels(); Loading Loading @@ -702,13 +698,13 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz, SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); SkColorType colorType = bitmap.colorType(); if (format < 0) { format = getInternalFormat(config); format = getInternalFormat(colorType); if (format == GL_PALETTE8_RGBA8_OES) return -1; // glCompressedTexSubImage2D() not supported } int err = checkFormat(config, format, type); int err = checkFormat(colorType, format, type); if (err) return err; bitmap.lockPixels(); Loading Loading
core/jni/android/graphics/Bitmap.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ static int getPremulBitmapCreateFlags(bool isMutable) { static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, jint offset, jint stride, jint width, jint height, jint configHandle, jboolean isMutable) { SkColorType colorType = SkBitmapConfigToColorType(static_cast<SkBitmap::Config>(configHandle)); SkColorType colorType = GraphicsJNI::legacyBitmapConfigToColorType(configHandle); if (NULL != jColors) { size_t n = env->GetArrayLength(jColors); if (n < SkAbs32(stride) * (size_t)height) { Loading Loading @@ -350,11 +350,11 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, static jobject Bitmap_copy(JNIEnv* env, jobject, jlong srcHandle, jint dstConfigHandle, jboolean isMutable) { const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle); SkBitmap::Config dstConfig = static_cast<SkBitmap::Config>(dstConfigHandle); SkColorType dstCT = GraphicsJNI::legacyBitmapConfigToColorType(dstConfigHandle); SkBitmap result; JavaPixelAllocator allocator(env); if (!src->copyTo(&result, SkBitmapConfigToColorType(dstConfig), &allocator)) { if (!src->copyTo(&result, dstCT, &allocator)) { return NULL; } return GraphicsJNI::createBitmap(env, new SkBitmap(result), allocator.getStorageObj(), Loading Loading @@ -389,8 +389,7 @@ static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle, jint width, jint height, jint configHandle, jint allocSize, jboolean requestPremul) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle); SkColorType colorType = SkBitmapConfigToColorType(config); SkColorType colorType = GraphicsJNI::legacyBitmapConfigToColorType(configHandle); // ARGB_4444 is a deprecated format, convert automatically to 8888 if (colorType == kARGB_4444_SkColorType) { Loading Loading @@ -494,7 +493,7 @@ static jint Bitmap_rowBytes(JNIEnv* env, jobject, jlong bitmapHandle) { static jint Bitmap_config(JNIEnv* env, jobject, jlong bitmapHandle) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); return static_cast<jint>(bitmap->config()); return GraphicsJNI::colorTypeToLegacyBitmapConfig(bitmap->colorType()); } static jint Bitmap_getGenerationId(JNIEnv* env, jobject, jlong bitmapHandle) { Loading Loading @@ -810,7 +809,7 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, const SkBitmap* bm1 = reinterpret_cast<SkBitmap*>(bm1Handle); if (bm0->width() != bm1->width() || bm0->height() != bm1->height() || bm0->config() != bm1->config()) { bm0->colorType() != bm1->colorType()) { return JNI_FALSE; } Loading @@ -822,7 +821,7 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, return JNI_FALSE; } if (bm0->config() == SkBitmap::kIndex8_Config) { if (bm0->colorType() == kIndex_8_SkColorType) { SkColorTable* ct0 = bm0->getColorTable(); SkColorTable* ct1 = bm1->getColorTable(); if (NULL == ct0 || NULL == ct1) { Loading
core/jni/android/graphics/Graphics.cpp +49 −4 Original line number Diff line number Diff line Loading @@ -291,6 +291,54 @@ void GraphicsJNI::point_to_jpointf(const SkPoint& r, JNIEnv* env, jobject obj) env->SetFloatField(obj, gPointF_yFieldID, SkScalarToFloat(r.fY)); } // This enum must keep these int values, to match the int values // in the java Bitmap.Config enum. enum LegacyBitmapConfig { kNo_LegacyBitmapConfig = 0, kA8_LegacyBitmapConfig = 1, kIndex8_LegacyBitmapConfig = 2, kRGB_565_LegacyBitmapConfig = 3, kARGB_4444_LegacyBitmapConfig = 4, kARGB_8888_LegacyBitmapConfig = 5, kLastEnum_LegacyBitmapConfig = kARGB_8888_LegacyBitmapConfig }; jint GraphicsJNI::colorTypeToLegacyBitmapConfig(SkColorType colorType) { switch (colorType) { case kN32_SkColorType: return kARGB_8888_LegacyBitmapConfig; case kARGB_4444_SkColorType: return kARGB_4444_LegacyBitmapConfig; case kRGB_565_SkColorType: return kRGB_565_LegacyBitmapConfig; case kIndex_8_SkColorType: return kIndex8_LegacyBitmapConfig; case kAlpha_8_SkColorType: return kA8_LegacyBitmapConfig; case kUnknown_SkColorType: default: break; } return kNo_LegacyBitmapConfig; } SkColorType GraphicsJNI::legacyBitmapConfigToColorType(jint legacyConfig) { const uint8_t gConfig2ColorType[] = { kUnknown_SkColorType, kAlpha_8_SkColorType, kIndex_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kN32_SkColorType }; if (legacyConfig < 0 || legacyConfig > kLastEnum_LegacyBitmapConfig) { legacyConfig = kNo_LegacyBitmapConfig; } return static_cast<SkColorType>(gConfig2ColorType[legacyConfig]); } SkBitmap* GraphicsJNI::getNativeBitmap(JNIEnv* env, jobject bitmap) { SkASSERT(env); SkASSERT(bitmap); Loading @@ -308,10 +356,7 @@ SkColorType GraphicsJNI::getNativeBitmapColorType(JNIEnv* env, jobject jconfig) } SkASSERT(env->IsInstanceOf(jconfig, gBitmapConfig_class)); int c = env->GetIntField(jconfig, gBitmapConfig_nativeInstanceID); if (c < 0 || c >= SkBitmap::kConfigCount) { c = kUnknown_SkColorType; } return SkBitmapConfigToColorType(static_cast<SkBitmap::Config>(c)); return legacyBitmapConfigToColorType(c); } SkCanvas* GraphicsJNI::getNativeCanvas(JNIEnv* env, jobject canvas) { Loading
core/jni/android/graphics/GraphicsJNI.h +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ public: // ref to its SkRasterizer* (or NULL). static SkRasterizer* refNativeRasterizer(jlong rasterizerHandle); /* * LegacyBitmapConfig is the old enum in Skia that matched the enum int values * in Bitmap.Config. Skia no longer supports this config, but has replaced it * with SkColorType. These routines convert between the two. */ static SkColorType legacyBitmapConfigToColorType(jint legacyConfig); static jint colorTypeToLegacyBitmapConfig(SkColorType colorType); /** Return the corresponding native colorType from the java Config enum, or kUnknown_SkColorType if the java object is null. */ Loading
core/jni/android/graphics/NinePatchImpl.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -38,18 +38,18 @@ #include <utils/Log.h> static bool getColor(const SkBitmap& bitmap, int x, int y, SkColor* c) { switch (bitmap.config()) { case SkBitmap::kARGB_8888_Config: switch (bitmap.colorType()) { case kN32_SkColorType: *c = SkUnPreMultiply::PMColorToColor(*bitmap.getAddr32(x, y)); break; case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: *c = SkPixel16ToPixel32(*bitmap.getAddr16(x, y)); break; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: *c = SkUnPreMultiply::PMColorToColor( SkPixel4444ToPixel32(*bitmap.getAddr16(x, y))); break; case SkBitmap::kIndex8_Config: { case kIndex_8_SkColorType: { SkColorTable* ctable = bitmap.getColorTable(); *c = SkUnPreMultiply::PMColorToColor( (*ctable)[*bitmap.getAddr8(x, y)]); Loading
core/jni/android/opengl/util.cpp +30 −34 Original line number Diff line number Diff line Loading @@ -562,18 +562,18 @@ void setTracingLevel(JNIEnv *env, jclass clazz, jint level) setGLDebugLevel(level); } static int checkFormat(SkBitmap::Config config, int format, int type) static int checkFormat(SkColorType colorType, int format, int type) { switch(config) { case SkBitmap::kIndex8_Config: switch(colorType) { case kIndex_8_SkColorType: if (format == GL_PALETTE8_RGBA8_OES) return 0; case SkBitmap::kARGB_8888_Config: case SkBitmap::kA8_Config: case kN32_SkColorType: case kAlpha_8_SkColorType: if (type == GL_UNSIGNED_BYTE) return 0; case SkBitmap::kARGB_4444_Config: case SkBitmap::kRGB_565_Config: case kARGB_4444_SkColorType: case kRGB_565_SkColorType: switch (type) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_5_6_5: Loading @@ -590,36 +590,36 @@ static int checkFormat(SkBitmap::Config config, int format, int type) return -1; } static int getInternalFormat(SkBitmap::Config config) static int getInternalFormat(SkColorType colorType) { switch(config) { case SkBitmap::kA8_Config: switch(colorType) { case kAlpha_8_SkColorType: return GL_ALPHA; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: return GL_RGBA; case SkBitmap::kARGB_8888_Config: case kN32_SkColorType: return GL_RGBA; case SkBitmap::kIndex8_Config: case kIndex_8_SkColorType: return GL_PALETTE8_RGBA8_OES; case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: return GL_RGB; default: return -1; } } static int getType(SkBitmap::Config config) static int getType(SkColorType colorType) { switch(config) { case SkBitmap::kA8_Config: switch(colorType) { case kAlpha_8_SkColorType: return GL_UNSIGNED_BYTE; case SkBitmap::kARGB_4444_Config: case kARGB_4444_SkColorType: return GL_UNSIGNED_SHORT_4_4_4_4; case SkBitmap::kARGB_8888_Config: case kN32_SkColorType: return GL_UNSIGNED_BYTE; case SkBitmap::kIndex8_Config: case kIndex_8_SkColorType: return -1; // No type for compressed data. case SkBitmap::kRGB_565_Config: case kRGB_565_SkColorType: return GL_UNSIGNED_SHORT_5_6_5; default: return -1; Loading @@ -631,9 +631,7 @@ static jint util_getInternalFormat(JNIEnv *env, jclass clazz, { SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); return getInternalFormat(config); return getInternalFormat(nativeBitmap->colorType()); } static jint util_getType(JNIEnv *env, jclass clazz, Loading @@ -641,9 +639,7 @@ static jint util_getType(JNIEnv *env, jclass clazz, { SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); return getType(config); return getType(nativeBitmap->colorType()); } static jint util_texImage2D(JNIEnv *env, jclass clazz, Loading @@ -653,14 +649,14 @@ static jint util_texImage2D(JNIEnv *env, jclass clazz, SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); SkColorType colorType = bitmap.colorType(); if (internalformat < 0) { internalformat = getInternalFormat(config); internalformat = getInternalFormat(colorType); } if (type < 0) { type = getType(config); type = getType(colorType); } int err = checkFormat(config, internalformat, type); int err = checkFormat(colorType, internalformat, type); if (err) return err; bitmap.lockPixels(); Loading Loading @@ -702,13 +698,13 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz, SkBitmap const * nativeBitmap = (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.config(); SkColorType colorType = bitmap.colorType(); if (format < 0) { format = getInternalFormat(config); format = getInternalFormat(colorType); if (format == GL_PALETTE8_RGBA8_OES) return -1; // glCompressedTexSubImage2D() not supported } int err = checkFormat(config, format, type); int err = checkFormat(colorType, format, type); if (err) return err; bitmap.lockPixels(); Loading