OLD | NEW |
---|---|
(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 | |
tomhudson
2015/08/24 20:10:25
What's up with the #if 0'd code?
hal.canary
2015/08/31 21:16:56
This is a test we should perform: does using a BBH
| |
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 } | |
OLD | NEW |