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

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: 2015-08-17 (Monday) 14:41:02 EDT Created 5 years, 4 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 public static void init() {
25 try {
26 System.loadLibrary("skia_android");
27 System.loadLibrary("canvasproof");
28 } catch (java.lang.Error e) {
29 Log.v(TAG, "System.loadLibrary error", e);
30 }
31 }
32
33 public static long create(InputStream inputStream) throws IOException {
34 byte[] buffer = new byte[16384];
35 long p = 0;
36 try {
37 p = CreateSkiaPicture.createImpl(inputStream, buffer);
38 } catch (UnsatisfiedLinkError e) {
39 Log.e(TAG, "UnsatisfiedLinkError createImpl");
40 }
41 inputStream.close();
42 return p;
43 }
44 public static void delete(long ptr) {
djsollen 2015/08/24 12:42:56 spaces between java methods.
hal.canary 2015/08/31 21:16:55 Done.
45 try {
46 if (ptr != 0) {
47 CreateSkiaPicture.deleteImpl(ptr);
48 }
49 } catch (UnsatisfiedLinkError e) {
50 Log.e(TAG, "UnsatisfiedLinkError deleteImpl");
51 }
52
53 }
54 public static native void deleteImpl(long ptr);
55 private static native long createImpl(InputStream s, byte[] b);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698