のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

beginRecording

     30 void PicturePileLayerContent::serialize(SkWStream* stream)
     31 {
     32     if (!stream)
     33        return;
     34     SkPicture picture;
     35     draw(picture.beginRecording(width(), height(),
     36                                 SkPicture::kUsePathBoundsForClip_RecordingFlag));
     37     picture.endRecording();
     38     picture.serialize(stream);
     39 }
     83     static SkCanvas* beginRecording(JNIEnv* env, jobject, SkPicture* pict,
     84                                     int w, int h) {
     85         // beginRecording does not ref its return value, it just returns it.
     86         SkCanvas* canvas = pict->beginRecording(w, h);
     87         // the java side will wrap this guy in a Canvas.java, which will call
     88         // unref in its finalizer, so we have to ref it here, so that both that
     89         // Canvas.java and our picture can both be owners
     90         canvas->ref();
     91         return canvas;
     92     }
     93 
     94     static void endRecording(JNIEnv* env, jobject, SkPicture* pict) {
     95         pict->endRecording();
     96     }