Chromium Code Reviews| 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 10eb53a3188bfc8700239f1e482b7bd76a375b2e..1b76559d877adf86df869d95d638028a51f8c98f 100644 |
| --- a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
| +++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java |
| @@ -16,6 +16,12 @@ import org.chromium.base.JNINamespace; |
| */ |
| @JNINamespace("gfx") |
| public class BitmapHelper { |
| + private static final int BITMAP_CONFIG_NO_CONFIG = 0; |
|
bulach
2014/02/17 10:33:58
please, use the "shared enum" mechanism, it's much
sivag
2014/02/18 16:06:22
Done.
|
| + private static final int BITMAP_CONFIG_ALPHA_8 = 1; |
| + private static final int BITMAP_CONFIG_ARGB_4444 = 2; |
| + private static final int BITMAP_CONFIG_ARGB_8888 = 3; |
| + private static final int BITMAP_CONFIG_RGB_565 = 4; |
| + |
| @CalledByNative |
| private static Bitmap createBitmap(int width, |
| int height, |
| @@ -75,4 +81,26 @@ public class BitmapHelper { |
| return inSampleSize; |
| } |
| + |
| + /** |
| + * Provides a matching integer constant for the Bitmap.Config value passed. |
| + * |
| + * @param Bitmap Configuration value. |
| + * @return Matching integer constant for the Bitmap.Config value passed. |
| + */ |
| + @CalledByNative |
| + private static int bitmapConfig(Bitmap.Config bitmap_config) { |
| + switch (bitmap_config) { |
| + case ALPHA_8: |
| + return BITMAP_CONFIG_ALPHA_8; |
| + case ARGB_4444: |
| + return BITMAP_CONFIG_ARGB_4444; |
| + case ARGB_8888: |
| + return BITMAP_CONFIG_ARGB_8888; |
| + case RGB_565: |
| + return BITMAP_CONFIG_RGB_565; |
| + default: |
| + return BITMAP_CONFIG_NO_CONFIG; |
| + } |
| + } |
| } |