diff options
author | Cary Clark <caryclark@skia.org> | 2018-07-17 08:20:27 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-17 12:47:40 +0000 |
commit | f960398f331912adceb3455cd10c65e33ce184e0 (patch) | |
tree | 710e49ef949deb0881634ea876bf6f719dc341f5 /site/user/api/catalog.htm | |
parent | 4fa31782fc55c43e0ba1566034207fa18089c0e7 (diff) |
polish picture and rrect docs
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=141263
Bug: skia:6818
Change-Id: I33a197892b3dd5788499dda9dd9e95ddab861388
Reviewed-on: https://skia-review.googlesource.com/141263
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'site/user/api/catalog.htm')
-rw-r--r-- | site/user/api/catalog.htm | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index 7ad0dc349d..aede7441de 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -2373,13 +2373,6 @@ "name": "SkPath::writeToMemory", "stdout": "path is equal to copy\\n" }, - "SkPicture_MakePlaceholder": { - "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkPicture> pict1 = SkPicture::MakePlaceholder({10, 40, 80, 110});\n sk_sp<SkPicture> pict2 = SkPicture::MakePlaceholder({10, 40, 80, 110});\n for (auto pict : { pict1, pict2 } ) {\n SkRect bounds = pict->cullRect();\n SkDebugf(\"id:%d bounds:{%g, %g, %g, %g}\\n\", pict->uniqueID(), \n bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);\n }\n}", - "hash": "32f84819483a906ede9c5525801845ef", - "file": "SkPicture_Reference", - "name": "SkPicture::MakePlaceholder", - "stdout": "id:1 bounds:{10, 40, 80, 110}\\nid:2 bounds:{10, 40, 80, 110}\\n" - }, "SkPicture_uniqueID": { "code": "void draw(SkCanvas* canvas) {\n SkPictureRecorder recorder;\n recorder.beginRecording({0, 0, 0, 0});\n sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();\n SkDebugf(\"empty picture id = %d\\n\", picture->uniqueID());\n sk_sp<SkPicture> placeholder = SkPicture::MakePlaceholder({0, 0, 0, 0});\n SkDebugf(\"placeholder id = %d\\n\", placeholder->uniqueID());\n}", "hash": "8e4257245c988c600410fe4fd7293f07", @@ -7199,6 +7192,14 @@ "file": "SkPicture_Reference", "name": "SkPicture::MakeFromStream" }, + "SkPicture_MakePlaceholder": { + "code": "class MyCanvas : public SkCanvas {\npublic:\n MyCanvas(SkCanvas* c) : canvas(c) {}\n void onDrawPicture(const SkPicture* picture, const SkMatrix* ,\n const SkPaint* ) override {\n const SkRect rect = picture->cullRect();\n SkPaint redPaint;\n redPaint.setColor(SK_ColorRED);\n canvas->drawRect(rect, redPaint);\n }\n SkCanvas* canvas;\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPictureRecorder recorder;\n SkCanvas* pictureCanvas = recorder.beginRecording({0, 0, 256, 256});\n sk_sp<SkPicture> placeholder = SkPicture::MakePlaceholder({10, 40, 80, 110});\n pictureCanvas->drawPicture(placeholder);\n sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();\n MyCanvas myCanvas(canvas);\n myCanvas.drawPicture(picture);\n}", + "width": 256, + "height": 256, + "hash": "0d2cbf82f490ffb180e0b4531afa232c", + "file": "SkPicture_Reference", + "name": "SkPicture::MakePlaceholder" +}, "SkPicture_approximateBytesUsed": { "code": "void draw(SkCanvas* canvas) {\n SkPictureRecorder recorder;\n SkCanvas* pictureCanvas = recorder.beginRecording({0, 0, 256, 256});\n SkPaint paint;\n pictureCanvas->drawRect(SkRect::MakeWH(200, 200), paint);\n paint.setColor(SK_ColorWHITE);\n pictureCanvas->drawRect(SkRect::MakeLTRB(20, 20, 180, 180), paint);\n sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();\n picture->playback(canvas);\n std::string opCount = \"approximate bytes used: \" + std::to_string(picture->approximateBytesUsed());\n canvas->drawString(opCount.c_str(), 20, 220, SkPaint());\n}", "width": 256, |