Fix getConfig function for hw bitmaps

Test: HardwareBitmapTests#testGetConfig
bug:30999911
Change-Id: I93a1c9fc88567ada2462a7a3b6cef8f796844e15
This commit is contained in:
sergeyv
2016-12-13 16:06:00 -08:00
parent 61341618c5
commit 19b4b01916
3 changed files with 8 additions and 0 deletions

View File

@@ -712,6 +712,9 @@ static jint Bitmap_rowBytes(JNIEnv* env, jobject, jlong bitmapHandle) {
static jint Bitmap_config(JNIEnv* env, jobject, jlong bitmapHandle) {
LocalScopedBitmap bitmap(bitmapHandle);
if (bitmap->bitmap().isHardware()) {
return GraphicsJNI::hardwareLegacyBitmapConfig();
}
return GraphicsJNI::colorTypeToLegacyBitmapConfig(bitmap->info().colorType());
}

View File

@@ -366,6 +366,10 @@ bool GraphicsJNI::isHardwareConfig(JNIEnv* env, jobject jconfig) {
return c == kHardware_LegacyBitmapConfig;
}
jint GraphicsJNI::hardwareLegacyBitmapConfig() {
return kHardware_LegacyBitmapConfig;
}
android::Canvas* GraphicsJNI::getNativeCanvas(JNIEnv* env, jobject canvas) {
SkASSERT(env);
SkASSERT(canvas);

View File

@@ -69,6 +69,7 @@ public:
static SkColorType getNativeBitmapColorType(JNIEnv*, jobject jconfig);
static bool isHardwareConfig(JNIEnv* env, jobject jconfig);
static jint hardwareLegacyBitmapConfig();
static jobject createRegion(JNIEnv* env, SkRegion* region);