2014年6月22日 星期日

Skia debugger

Skia is 2D graphics library, they provide a debugger to provide step-by-step drawing command.

Sync skia

https://sites.google.com/site/skiadocs/developer-documentation/contributing-code/downloading

Build skia

https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/linux
https://sites.google.com/site/skiadocs/developer-documentation/skia-debugger


git log to find out the match commit whose PICTURE_VERSION match android/chromium skia
PICTURE_VERSION = 10 --> 2cf444f7040614b43af67e368f3aa636ebeaa45a

# sync to specific revision
# edit .gclient
modify "safesync_url": "rev",

# create file rev and copy sha2 hash to this file
# sync
$ gclient sync
$ ./gyp_skia
# then you can build debugger & tools

Generate .skp file which is used for skia debugger

   SkPicture *pict = new SkPicture;
   SkCanvas *picCanvas = pict->beginRecording(width, height, 0);
   // do your skia drawing ...
   pict->endRecording();
   SkString path(".skp file path");
   SkFILEWStream stream(path.c_str());
   pict->serialize(&stream);
   delete pict;

Note

Make sure SkPicture.h PICTURE_VERSION is match Skia debugger