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

Side by Side Diff: platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_CreateSkiaPicture.cpp

Issue 1258123004: android/apps: Add CanvasProof App; (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-04 (Friday) 13:29:02 EDT 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 #include "org_skia_canvasproof_CreateSkiaPicture.h"
9 #include "JavaInputStream.h"
10 #include "SkPicture.h"
11 #include "SkPictureRecorder.h"
12
13 /*
14 * Class: org_skia_canvasproof_CreateSkiaPicture
15 * Method: delete
16 * Signature: (J)V
17 */
18 JNIEXPORT void JNICALL Java_org_skia_canvasproof_CreateSkiaPicture_deleteImpl(
19 JNIEnv* env, jclass clazz, jlong ptr) {
20 SkSafeUnref(reinterpret_cast<SkPicture*>(ptr));
21 }
22
23 /*
24 * Class: org_skia_canvasproof_CreateSkiaPicture
25 * Method: createImpl
26 * Signature: (Ljava/io/InputStream;[B)J
27 */
28 JNIEXPORT jlong JNICALL Java_org_skia_canvasproof_CreateSkiaPicture_createImpl
29 (JNIEnv* env, jclass clazz, jobject inputStream, jbyteArray buffer) {
30 JavaInputStream stream(env, buffer, inputStream);
31 #if 0
32 SkAutoTUnref<SkPicture> p(SkPicture::CreateFromStream(&stream));
33 if (!p) { return 0; }
34 SkPictureRecorder recorder;
35 SkRect bounds = p->cullRect();
36 SkRTreeFactory bbh;
37 recorder.beginRecording(bounds, &bbh)->drawPicture(p);
38 return reinterpret_cast<long>(recorder.endRecordingAsPicture());
39 #else
40 return reinterpret_cast<long>(SkPicture::CreateFromStream(&stream));
41 #endif
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698