Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2336)

Unified Diff: ui/gfx/android/java_bitmap.cc

Issue 374633002: SkBitmap::Config is deprecated, use SkColorType instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments from #4 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/android/java_bitmap.h ('k') | ui/gfx/color_analysis_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/android/java_bitmap.cc
diff --git a/ui/gfx/android/java_bitmap.cc b/ui/gfx/android/java_bitmap.cc
index 7512b4222b1a103c29bcb65ddc0eb42932d4b860..5988befeddc20976d70193d8cff338f6caee987b 100644
--- a/ui/gfx/android/java_bitmap.cc
+++ b/ui/gfx/android/java_bitmap.cc
@@ -41,17 +41,17 @@ bool JavaBitmap::RegisterJavaBitmap(JNIEnv* env) {
return RegisterNativesImpl(env);
}
-static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) {
- switch (bitmap_config) {
- case SkBitmap::kA8_Config:
+static int SkColorTypeToBitmapFormat(SkColorType color_type) {
+ switch (color_type) {
+ case kAlpha_8_SkColorType:
return BITMAP_FORMAT_ALPHA_8;
- case SkBitmap::kARGB_4444_Config:
+ case kARGB_4444_SkColorType:
return BITMAP_FORMAT_ARGB_4444;
- case SkBitmap::kARGB_8888_Config:
+ case kN32_SkColorType:
msw 2014/07/08 16:52:07 nit q: this kN32_SkColorType could be kBGRA_8888_S
reed1 2014/07/08 17:02:37 kN32_SkColorType is an exact match for the legacy
return BITMAP_FORMAT_ARGB_8888;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
return BITMAP_FORMAT_RGB_565;
- case SkBitmap::kNo_Config:
+ case kUnknown_SkColorType:
default:
NOTREACHED();
return BITMAP_FORMAT_NO_CONFIG;
@@ -60,10 +60,10 @@ static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) {
ScopedJavaLocalRef<jobject> CreateJavaBitmap(int width,
int height,
- SkBitmap::Config bitmap_config) {
+ SkColorType color_type) {
DCHECK_GT(width, 0);
DCHECK_GT(height, 0);
- int java_bitmap_config = SkBitmapConfigToBitmapFormat(bitmap_config);
+ int java_bitmap_config = SkColorTypeToBitmapFormat(color_type);
return Java_BitmapHelper_createBitmap(
AttachCurrentThread(), width, height, java_bitmap_config);
}
@@ -82,11 +82,11 @@ ScopedJavaLocalRef<jobject> CreateJavaBitmapFromAndroidResource(
ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap) {
DCHECK(skbitmap);
DCHECK(!skbitmap->isNull());
- SkBitmap::Config bitmap_config = skbitmap->config();
- DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) ||
- (bitmap_config == SkBitmap::kARGB_8888_Config));
+ SkColorType color_type = skbitmap->colorType();
+ DCHECK((color_type == kRGB_565_SkColorType) ||
+ (color_type == kN32_SkColorType));
ScopedJavaLocalRef<jobject> jbitmap = CreateJavaBitmap(
- skbitmap->width(), skbitmap->height(), bitmap_config);
+ skbitmap->width(), skbitmap->height(), color_type);
SkAutoLockPixels src_lock(*skbitmap);
JavaBitmap dst_lock(jbitmap.obj());
void* src_pixels = skbitmap->getPixels();
@@ -120,21 +120,21 @@ SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap) {
return skbitmap;
}
-SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config) {
+SkColorType ConvertToSkiaColorType(jobject bitmap_config) {
int jbitmap_config = Java_BitmapHelper_getBitmapFormatForConfig(
AttachCurrentThread(), bitmap_config);
switch (jbitmap_config) {
case BITMAP_FORMAT_ALPHA_8:
- return SkBitmap::kA8_Config;
+ return kAlpha_8_SkColorType;
case BITMAP_FORMAT_ARGB_4444:
- return SkBitmap::kARGB_4444_Config;
+ return kARGB_4444_SkColorType;
case BITMAP_FORMAT_ARGB_8888:
- return SkBitmap::kARGB_8888_Config;
+ return kN32_SkColorType;
case BITMAP_FORMAT_RGB_565:
- return SkBitmap::kRGB_565_Config;
+ return kRGB_565_SkColorType;
case BITMAP_FORMAT_NO_CONFIG:
default:
- return SkBitmap::kNo_Config;
+ return kUnknown_SkColorType;
}
}
« no previous file with comments | « ui/gfx/android/java_bitmap.h ('k') | ui/gfx/color_analysis_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698