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

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

Issue 183023002: [Android] Modify CreateJavaBitmap to accept SkBitmap::Config and export the API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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') | no next file » | 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 316dbb90bf500915ab59990d77504c2c87b15bfe..78a0973f9b0645378b839d52137fdf3b7ac5eaa6 100644
--- a/ui/gfx/android/java_bitmap.cc
+++ b/ui/gfx/android/java_bitmap.cc
@@ -41,14 +41,6 @@ bool JavaBitmap::RegisterJavaBitmap(JNIEnv* env) {
return RegisterNativesImpl(env);
}
-static ScopedJavaLocalRef<jobject> CreateJavaBitmap(int width,
- int height,
- int bitmap_config) {
-
- return Java_BitmapHelper_createBitmap(
- AttachCurrentThread(), width, height, bitmap_config);
-}
-
static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) {
switch (bitmap_config) {
case SkBitmap::kA8_Config:
@@ -66,14 +58,21 @@ static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) {
}
}
+ScopedJavaLocalRef<jobject> CreateJavaBitmap(int width,
+ int height,
+ SkBitmap::Config bitmap_config) {
+ int java_bitmap_config = SkBitmapConfigToBitmapFormat(bitmap_config);
+ return Java_BitmapHelper_createBitmap(
+ AttachCurrentThread(), width, height, java_bitmap_config);
+}
+
ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap) {
DCHECK(skbitmap);
- SkBitmap::Config config = skbitmap->getConfig();
- DCHECK((config == SkBitmap::kRGB_565_Config) ||
- (config == SkBitmap::kARGB_8888_Config));
- int java_bitmap_config = SkBitmapConfigToBitmapFormat(config);
+ SkBitmap::Config bitmap_config = skbitmap->getConfig();
+ DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) ||
+ (bitmap_config == SkBitmap::kARGB_8888_Config));
ScopedJavaLocalRef<jobject> jbitmap = CreateJavaBitmap(
- skbitmap->width(), skbitmap->height(), java_bitmap_config);
+ skbitmap->width(), skbitmap->height(), bitmap_config);
SkAutoLockPixels src_lock(*skbitmap);
JavaBitmap dst_lock(jbitmap.obj());
void* src_pixels = skbitmap->getPixels();
« no previous file with comments | « ui/gfx/android/java_bitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698