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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.android_webview;
6
7 import android.graphics.Bitmap;
8 import android.graphics.Canvas;
9 import android.graphics.Color;
10 import android.graphics.Picture;
11
12 import org.chromium.base.CalledByNative;
13 import org.chromium.base.JNINamespace;
14
15 /**
16 * Provides auxiliary methods related to Picture objects and native SkPictures.
17 */
18 @JNINamespace("android_webview")
19 public class JavaBrowserViewRendererHelper {
20
21 /**
22 * Provides a Bitmap object with a given width and height used for auxiliary rasterization.
23 */
24 @CalledByNative
25 private static Bitmap createBitmap(int width, int height) {
26 return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
27 }
28
29 /**
30 * Draws a provided bitmap into a canvas.
31 * Used for convenience from the native side and other static helper methods .
32 */
33 @CalledByNative
34 private static void drawBitmapIntoCanvas(Bitmap bitmap, Canvas canvas) {
35 canvas.drawBitmap(bitmap, 0, 0, null);
36 }
37
38 /**
39 * Creates a new Picture that records drawing a provided bitmap.
40 * Will return an empty Picture if the Bitmap is null.
41 */
42 @CalledByNative
43 private static Picture recordBitmapIntoPicture(Bitmap bitmap) {
44 Picture picture = new Picture();
45 if (bitmap != null) {
46 Canvas recordingCanvas = picture.beginRecording(bitmap.getWidth(), b itmap.getHeight());
47 drawBitmapIntoCanvas(bitmap, recordingCanvas);
48 picture.endRecording();
49 }
50 return picture;
51 }
52
53 // Should never be instantiated.
54 private JavaBrowserViewRendererHelper() {
55 }
56 }
OLDNEW
« 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