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

Unified Diff: ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java

Issue 335943002: [Android] Composited selection handle rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_native_handles_final
Patch Set: Clean up paste popup interaction 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
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 5c4549cd9d8f03ebd7154a012c2e2721edf0ca01..91ebecc5815db523a907789605e770d512c0aa91 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
@@ -25,6 +25,32 @@ public class BitmapHelper {
}
/**
+ * Decode a bitmap resource.
+ *
+ * @param name The resource name of the bitmap to decode.
+ * @return The corresponding bitmap.
+ */
+ @CalledByNative
+ private static Bitmap decodeDrawableResource(String name) {
+ Resources res = Resources.getSystem();
+ return decodeDrawableResource(res.getIdentifier(name, null, null));
+ }
+
+ /**
+ * Decode a bitmap resource.
+ *
+ * @param resId The resource id of the bitmap to decode.
+ * @return The corresponding bitmap.
+ */
+ @CalledByNative
+ private static Bitmap decodeDrawableResource(int resId) {
+ final BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = false;
+ options.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ return BitmapFactory.decodeResource(Resources.getSystem(), resId, options);
+ }
+
+ /**
* Decode and sample down a bitmap resource to the requested width and height.
*
* @param name The resource name of the bitmap to decode.
@@ -34,9 +60,9 @@ public class BitmapHelper {
* that are equal to or greater than the requested width and height.
*/
@CalledByNative
- private static Bitmap decodeDrawableResource(String name,
- int reqWidth,
- int reqHeight) {
+ private static Bitmap decodeAndDownsampleDrawableResource(String name,
+ int reqWidth,
+ int reqHeight) {
Resources res = Resources.getSystem();
int resId = res.getIdentifier(name, null, null);
if (resId == 0) return null;

Powered by Google App Engine
This is Rietveld 408576698