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

Unified Diff: android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload error, re-uploading. Created 7 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 | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | android_webview/native/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java
diff --git a/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java b/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..d4e79c82254e6fd7d9471c49156913afbf9f2f78
--- /dev/null
+++ b/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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.android_webview;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Picture;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Provides auxiliary methods related to Picture objects and native SkPictures.
+ */
+@JNINamespace("android_webview")
+public class JavaBrowserViewRendererHelper {
+
+ /**
+ * Provides a Bitmap object with a given width and height used for auxiliary rasterization.
+ */
+ @CalledByNative
+ private static Bitmap createBitmap(int width, int height) {
+ return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ }
+
+ /**
+ * Draws a provided bitmap into a canvas.
+ * Used for convenience from the native side and other static helper methods.
+ */
+ @CalledByNative
+ private static void drawBitmapIntoCanvas(Bitmap bitmap, Canvas canvas) {
+ canvas.drawBitmap(bitmap, 0, 0, null);
+ }
+
+ /**
+ * Creates a new Picture that records drawing a provided bitmap.
+ * Will return an empty Picture if the Bitmap is null.
+ */
+ @CalledByNative
+ private static Picture recordBitmapIntoPicture(Bitmap bitmap) {
+ Picture picture = new Picture();
+ if (bitmap != null) {
+ Canvas recordingCanvas = picture.beginRecording(bitmap.getWidth(), bitmap.getHeight());
+ drawBitmapIntoCanvas(bitmap, recordingCanvas);
+ picture.endRecording();
+ }
+ return picture;
+ }
+
+ // Should never be instantiated.
+ private JavaBrowserViewRendererHelper() {
+ }
+}
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | android_webview/native/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698