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

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

Issue 10958058: JavaBitmap class JNI clean up, add new functionality (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase, correct gyp sort order Created 8 years, 3 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 | « no previous file | ui/gfx/android/java_bitmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..5e237f70fa3b617cf21e74a42a9ecb94f0dde04a
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.ui.gfx;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+@JNINamespace("ui")
+public class BitmapHelper {
+ @CalledByNative
+ public static Bitmap createBitmap(int width, int height) {
+ return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ }
+
+ @CalledByNative
+ public static Bitmap decodeDrawableResource(String name) {
+ Resources res = Resources.getSystem();
+ int resource_id = res.getIdentifier(name, null, null);
+
+ return BitmapFactory.decodeResource(res, resource_id);
+ }
+}
« no previous file with comments | « no previous file | ui/gfx/android/java_bitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698