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

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

Powered by Google App Engine
This is Rietveld 408576698