Index: ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
diff --git a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
index a936fe77b58f27469be022bd46e1d0df9acceb06..ac9cdd25628261d2b410cb98d08189e6feebc9c8 100644 |
--- a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
+++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
@@ -19,11 +19,8 @@ public class BitmapHelper { |
@CalledByNative |
private static Bitmap createBitmap(int width, |
int height, |
- boolean is565Config) { |
- if (is565Config) { |
- return Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); |
- } |
- return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); |
+ Bitmap.Config bitmapConfig) { |
bulach
2014/02/28 13:19:25
this will require an extra JNI call, how about pas
sivag
2014/03/04 12:36:04
Done.
|
+ return Bitmap.createBitmap(width, height, bitmapConfig); |
} |
/** |
@@ -83,7 +80,7 @@ public class BitmapHelper { |
* @return Matching integer constant for the Bitmap.Config value passed. |
*/ |
@CalledByNative |
- private static int bitmapConfig(Bitmap.Config bitmapConfig) { |
+ private static int getConfigEnumValue(Bitmap.Config bitmapConfig) { |
switch (bitmapConfig) { |
case ALPHA_8: |
return BitmapFormat.FORMAT_ALPHA_8; |
@@ -97,4 +94,26 @@ public class BitmapHelper { |
return BitmapFormat.FORMAT_NO_CONFIG; |
} |
} |
+ |
+ /** |
+ * Provides a matching Bitmap.Config for the enum config value passed. |
+ * |
+ * @param matchingenumConfig The Bitmap Configuration enum value. |
+ * @return Matching Bitmap.Config for the enum value passed. |
+ */ |
+ @CalledByNative |
bulach
2014/02/28 13:19:25
see above, I think this method can be kept private
sivag
2014/03/04 12:36:04
Done.
|
+ private static Bitmap.Config getJavabitmapConfig(int matchingenumConfig) { |
+ switch (matchingenumConfig) { |
+ case BitmapFormat.FORMAT_ALPHA_8: |
+ return Bitmap.Config.ALPHA_8; |
+ case BitmapFormat.FORMAT_ARGB_4444: |
+ return Bitmap.Config.ARGB_4444; |
+ case BitmapFormat.FORMAT_RGB_565: |
+ return Bitmap.Config.RGB_565; |
+ case BitmapFormat.FORMAT_ARGB_8888: |
+ default: |
+ return Bitmap.Config.ARGB_8888; |
+ } |
+ } |
+ |
} |