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

Side by Side Diff: platform_tools/android/apps/canvasproof/src/main/java/org/skia/canvasproof/CreateSkiaPicture.java

Issue 1258123004: android/apps: Add CanvasProof App; (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments from tom & derek Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 /*
8 AJAR=$ANDROID_SDK_ROOT/platforms/android-19/android.jar
9 CLASS=CreateSkiaPicture
10 SRC=platform_tools/android/apps/canvasproof/src/main
11 javac -classpath $AJAR $SRC/java/org/skia/canvasproof/$CLASS.java
12 javah -classpath $AJAR:$SRC/java -d $SRC/jni org.skia.canvasproof.$CLASS
13 */
14
15 package org.skia.canvasproof;
16
17 import android.util.Log;
18 import java.io.IOException;
19 import java.io.InputStream;
20 import java.lang.UnsatisfiedLinkError;
21
22 public class CreateSkiaPicture {
23 private static final String TAG = "CreateSkiaPicture";
24
25 public static void init() {
26 try {
27 System.loadLibrary("skia_android");
28 System.loadLibrary("canvasproof");
29 } catch (java.lang.Error e) {
30 Log.v(TAG, "System.loadLibrary error", e);
31 }
32 }
33
34 public static long create(InputStream inputStream) throws IOException {
35 byte[] buffer = new byte[16 * (1 << 10)]; // 16 KByte
36 long p = 0;
37 try {
38 p = CreateSkiaPicture.createImpl(inputStream, buffer);
39 } catch (UnsatisfiedLinkError e) {
40 Log.e(TAG, "UnsatisfiedLinkError createImpl");
41 }
42 inputStream.close();
43 return p;
44 }
45
46 public static void delete(long ptr) {
47 try {
48 if (ptr != 0) {
49 CreateSkiaPicture.deleteImpl(ptr);
50 }
51 } catch (UnsatisfiedLinkError e) {
52 Log.e(TAG, "UnsatisfiedLinkError deleteImpl");
53 }
54
55 }
56 public static native void deleteImpl(long ptr);
djsollen 2015/09/01 13:13:29 does this need to be public?
hal.canary 2015/09/16 18:31:34 nope. fixed.
57 private static native long createImpl(InputStream s, byte[] b);
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698