diff options
-rw-r--r-- | docs/SkCanvas_Reference.bmh | 12 | ||||
-rw-r--r-- | docs/SkPaint_Reference.bmh | 10 | ||||
-rw-r--r-- | site/user/api/SkCanvas_Reference.md | 4 | ||||
-rw-r--r-- | site/user/api/SkPaint_Reference.md | 6 | ||||
-rw-r--r-- | site/user/api/catalog.htm | 91 | ||||
-rw-r--r-- | tools/bookmaker/bookmaker.cpp | 5 |
6 files changed, 74 insertions, 54 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh index c026ffe649..57125d7fb0 100644 --- a/docs/SkCanvas_Reference.bmh +++ b/docs/SkCanvas_Reference.bmh @@ -1509,6 +1509,12 @@ Rectangles are blurred by Image_Filter when restore() draws Layer to main Canvas. ## #Height 128 +#Function +###$ +#include "SkBlurImageFilter.h" +$$$# +## + void draw(SkCanvas* canvas) { SkPaint paint, blur; blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr)); @@ -1558,6 +1564,12 @@ The red rectangle is clipped; it does not fully fit on Layer. Image_Filter blurs past edge of Layer so red rectangle is blurred on all sides. ## #Height 128 +#Function +###$ +#include "SkBlurImageFilter.h" +$$$# +## + void draw(SkCanvas* canvas) { SkPaint paint, blur; blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr)); diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index 99873ee72b..21521af798 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -3226,6 +3226,11 @@ Mask_Filter. #Example #ToDo explain why the two draws are so different ## + #Function + ###$ + #include "SkBlurImageFilter.h" + $$$# + ## void draw(SkCanvas* canvas) { SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); @@ -3252,6 +3257,11 @@ Mask_Filter. #Return Image_Filter if previously set, nullptr otherwise ## #Example + #Function + ###$ + #include "SkBlurImageFilter.h" + $$$# + ## void draw(SkCanvas* canvas) { SkPaint paint; SkDebugf("nullptr %c= image filter\n", paint.getImageFilter() ? '!' : '='); diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md index b2b0f9362f..5c391e0245 100644 --- a/site/user/api/SkCanvas_Reference.md +++ b/site/user/api/SkCanvas_Reference.md @@ -2100,7 +2100,7 @@ depth of saved stack ### Example -<div><fiddle-embed name="1a025d6018f64140af2dc36acad59008"><div>Rectangles are blurred by <a href='undocumented#Image_Filter'>Image Filter</a> when <a href='#SkCanvas_restore'>restore</a> draws <a href='#Layer'>Layer</a> to main +<div><fiddle-embed name="42318b18d403e17e07a541652da91ee2"><div>Rectangles are blurred by <a href='undocumented#Image_Filter'>Image Filter</a> when <a href='#SkCanvas_restore'>restore</a> draws <a href='#Layer'>Layer</a> to main <a href='#Canvas'>Canvas</a>. </div></fiddle-embed></div> @@ -2149,7 +2149,7 @@ depth of saved stack ### Example -<div><fiddle-embed name="5b59231feae0c09cb1ab6a292229d7a4"><div>Rectangles are blurred by <a href='undocumented#Image_Filter'>Image Filter</a> when <a href='#SkCanvas_restore'>restore</a> draws <a href='#Layer'>Layer</a> to main <a href='#Canvas'>Canvas</a>. +<div><fiddle-embed name="a17aec3aa4909527be039e26a7eda694"><div>Rectangles are blurred by <a href='undocumented#Image_Filter'>Image Filter</a> when <a href='#SkCanvas_restore'>restore</a> draws <a href='#Layer'>Layer</a> to main <a href='#Canvas'>Canvas</a>. The red rectangle is clipped; it does not fully fit on <a href='#Layer'>Layer</a>. <a href='undocumented#Image_Filter'>Image Filter</a> blurs past edge of <a href='#Layer'>Layer</a> so red rectangle is blurred on all sides. </div></fiddle-embed></div> diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md index a4c62dbc57..3821dc3d87 100644 --- a/site/user/api/SkPaint_Reference.md +++ b/site/user/api/SkPaint_Reference.md @@ -4034,7 +4034,7 @@ implementation. </pre> Returns <a href='undocumented#Typeface'>Typeface</a> if set, or nullptr. -Increments <a href='undocumented#Typeface'>Typeface</a> <a href='undocumented#Reference_Count'>Reference Count</a> by one. +Does not alter <a href='undocumented#Typeface'>Typeface</a> <a href='undocumented#Reference_Count'>Reference Count</a>. ### Return Value @@ -4120,7 +4120,7 @@ can operate on all channels of <a href='SkColor_Reference#Color'>Color</a>, whil ### Example -<div><fiddle-embed name="250e45c5935d54eac6aca775d1fe3475"></fiddle-embed></div> +<div><fiddle-embed name="ece04ee3d3761e3425f37c8f06f054c1"></fiddle-embed></div> <a name='SkPaint_getImageFilter'></a> ## getImageFilter @@ -4138,7 +4138,7 @@ Does not alter <a href='undocumented#Image_Filter'>Image Filter</a> <a href='und ### Example -<div><fiddle-embed name="7b8118ff57fcb84e6bc82380d155b62e"> +<div><fiddle-embed name="c11f8eaa1dd149bc18db21e23ce26904"> #### Example Output diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index 3b280a33fc..e8b4e7e70a 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -70,6 +70,13 @@ "name": "SkBitmap::colorSpace", "stdout": "gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false\\n" }, + "SkBitmap_colorType": { + "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkBitmap bitmap;\n bitmap.setInfo(SkImageInfo::MakeA8(16, 32));\n SkDebugf(\"color type: k\" \"%s\" \"_SkColorType\\n\", colors[bitmap.colorType()]);\n}", + "hash": "ceb77fab7326b57822a147b04aa0960e", + "file": "SkBitmap_Reference", + "name": "SkBitmap::colorType", + "stdout": "color type: kAlpha_8_SkColorType\\n" + }, "SkBitmap_computeByteSize": { "code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n for (int width : { 1, 1000, 1000000 } ) {\n for (int height: { 1, 1000, 1000000 } ) {\n SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);\n bitmap.setInfo(imageInfo, width * 5);\n SkDebugf(\"width: %7d height: %7d computeByteSize: %13lld\\n\", width, height,\n bitmap.computeByteSize());\n }\n }\n}", "hash": "165c8f208829fc0908e8a50da60c0076", @@ -189,6 +196,13 @@ "name": "SkBitmap::height()", "stdout": "bitmap height: 32 info height: 32\\n" }, + "SkBitmap_info": { + "code": "void draw(SkCanvas* canvas) {\n // SkBitmap source; // pre-populated with soccer ball by fiddle.skia.org\n const SkImageInfo& info = source.info();\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkDebugf(\"width: %d height: %d color: %s alpha: %s\\n\", info.width(), info.height(),\n colors[info.colorType()], alphas[info.alphaType()]);\n}\n", + "hash": "ec47c4dc23e2925ad565eaba55a91553", + "file": "SkBitmap_Reference", + "name": "SkBitmap::info()", + "stdout": "width: 56 height: 56 color: BGRA_8888 alpha: Opaque\\n" + }, "SkBitmap_installPixels": { "code": "static void releaseProc(void* addr, void* ) {\n SkDebugf(\"releaseProc called\\n\");\n delete[] (uint32_t*) addr;\n}\n\nvoid draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n void* pixels = new uint32_t[8 * 8];\n SkImageInfo info = SkImageInfo::MakeN32(8, 8, kOpaque_SkAlphaType);\n SkDebugf(\"before installPixels\\n\");\n bool installed = bitmap.installPixels(info, pixels, 16, releaseProc, nullptr);\n SkDebugf(\"install \" \"%s\" \"successful\\n\", installed ? \"\" : \"not \");\n}\n", "hash": "8c4f7bf73fffa1a812ee8e88e44e639c", @@ -1541,8 +1555,8 @@ "stdout": "SkPaint::kNormal_Hinting == paint.getHinting()\\n" }, "SkPaint_getImageFilter": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"nullptr %c= image filter\\n\", paint.getImageFilter() ? '!' : '=');\n paint.setImageFilter(SkBlurImageFilter::Make(kOuter_SkBlurStyle, 3, nullptr, nullptr));\n SkDebugf(\"nullptr %c= image filter\\n\", paint.getImageFilter() ? '!' : '=');\n}\n", - "hash": "7b8118ff57fcb84e6bc82380d155b62e", + "code": "#include \"SkBlurImageFilter.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"nullptr %c= image filter\\n\", paint.getImageFilter() ? '!' : '=');\n paint.setImageFilter(SkBlurImageFilter::Make(kOuter_SkBlurStyle, 3, nullptr, nullptr));\n SkDebugf(\"nullptr %c= image filter\\n\", paint.getImageFilter() ? '!' : '=');\n}\n", + "hash": "c11f8eaa1dd149bc18db21e23ce26904", "file": "SkPaint_Reference", "name": "SkPaint::getImageFilter", "stdout": "nullptr == image filter\\nnullptr != image filter\\n" @@ -3178,6 +3192,13 @@ "name": "SkSurface::MakeNull", "stdout": "SkSurface::MakeNull(0, 0) == nullptr\\nsurf-\\u003emakeImageSnapshot() == nullptr\\n" }, + "SkSurface_MakeRaster": { + "code": "void draw(SkCanvas* ) {\n SkImageInfo info = SkImageInfo::MakeN32Premul(3, 3);\n const size_t rowBytes = 64;\n sk_sp<SkSurface> surface(SkSurface::MakeRaster(info, rowBytes, nullptr));\n SkCanvas* canvas = surface->getCanvas();\n canvas->clear(SK_ColorWHITE);\n SkPixmap pixmap;\n if (surface->peekPixels(&pixmap)) {\n const uint32_t* colorPtr = pixmap.addr32();\n SkPMColor pmWhite = colorPtr[0];\n SkPaint paint;\n canvas->drawPoint(1, 1, paint);\n canvas->flush(); // ensure that point was drawn\n for (int y = 0; y < info.height(); ++y) {\n for (int x = 0; x < info.width(); ++x) {\n SkDebugf(\"%c\", colorPtr[x] == pmWhite ? '-' : 'x');\n }\n colorPtr += rowBytes / sizeof(colorPtr[0]);\n SkDebugf(\"\\n\");\n }\n }\n}\n", + "hash": "a803910ada4f8733f0b62456afead55f", + "file": "SkSurface_Reference", + "name": "SkSurface::MakeRaster", + "stdout": "---\\n-x-\\n---\\n" + }, "SkSurface_MakeRasterDirect": { "code": "void draw(SkCanvas* ) {\n SkImageInfo info = SkImageInfo::MakeN32Premul(3, 3);\n const size_t size = info.computeMinByteSize();\n SkAutoTMalloc<SkPMColor> storage(size);\n SkPMColor* pixels = storage.get();\n sk_sp<SkSurface> surface(SkSurface::MakeRasterDirect(info, pixels, info.minRowBytes()));\n SkCanvas* canvas = surface->getCanvas();\n canvas->clear(SK_ColorWHITE);\n SkPMColor pmWhite = pixels[0];\n SkPaint paint;\n canvas->drawPoint(1, 1, paint);\n canvas->flush(); // ensure that point was drawn\n for (int y = 0; y < info.height(); ++y) {\n for (int x = 0; x < info.width(); ++x) {\n SkDebugf(\"%c\", *pixels++ == pmWhite ? '-' : 'x');\n }\n SkDebugf(\"\\n\");\n }\n}\n", "hash": "3f5aeb870104187643197354a7f1d27a", @@ -3206,6 +3227,13 @@ "name": "SkSurface::MakeRaster_2", "stdout": "---\\n-x-\\n---\\n" }, + "SkSurface_generationID": { + "code": "void draw(SkCanvas* canvas) {\n auto surface = SkSurface::MakeRasterN32Premul(1, 1);\n for (int i = 0; i < 3; ++i) {\n SkDebugf(\"surface generationID: %d\\n\", surface->generationID());\n if (0 == i) {\n surface->getCanvas()->drawColor(SK_ColorBLACK);\n } else {\n surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);\n }\n }\n}", + "hash": "be9574c4a14f891e1abb4ec2b1e51d6c", + "file": "SkSurface_Reference", + "name": "SkSurface::generationID", + "stdout": "surface generationID: 1\\nsurface generationID: 2\\nsurface generationID: 3\\n" + }, "SkSurface_height": { "code": "void draw(SkCanvas* canvas) {\n const int width = 37;\n const int height = 1000;\n auto surf = SkSurface::MakeNull(width, height);\n auto nullCanvas = surf->getCanvas();\n SkDebugf(\"surface height=%d canvas height=%d\\n\", surf->height(),\n nullCanvas->getBaseLayerSize().fHeight);\n}", "hash": "20571cc23e3146deaa09046b64cc0aef", @@ -3213,6 +3241,13 @@ "name": "SkSurface::height()", "stdout": "surface height=1000 canvas height=1000\\n" }, + "SkSurface_notifyContentWillChange": { + "code": "void draw(SkCanvas* canvas) {\n auto surface = SkSurface::MakeRasterN32Premul(1, 1);\n for (int i = 0; i < 3; ++i) {\n SkDebugf(\"surface generationID: %d\\n\", surface->generationID());\n if (0 == i) {\n surface->getCanvas()->drawColor(SK_ColorBLACK);\n } else {\n surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);\n }\n }\n}", + "hash": "be9574c4a14f891e1abb4ec2b1e51d6c", + "file": "SkSurface_Reference", + "name": "SkSurface::notifyContentWillChange", + "stdout": "surface generationID: 1\\nsurface generationID: 2\\nsurface generationID: 3\\n" + }, "SkSurface_props": { "code": "void draw(SkCanvas* canvas) {\n const char* names[] = { \"Unknown\", \"RGB_H\", \"BGR_H\", \"RGB_V\", \"BGR_V\" };\n sk_sp<SkSurface> surf(SkSurface::MakeRasterN32Premul(64, 64));\n SkDebugf(\"surf.props(): k%s_SkPixelGeometry\\n\", names[surf->props().pixelGeometry()]);\n}", "hash": "13cf9e7b2894ae6e98c1fd719040bf01", @@ -3566,10 +3601,10 @@ "name": "Font_Metrics" }, "Paint_Image_Filter_Methods": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(2);\n SkRegion region;\n region.op( 10, 10, 50, 50, SkRegion::kUnion_Op);\n region.op( 10, 50, 90, 90, SkRegion::kUnion_Op);\n paint.setImageFilter(SkBlurImageFilter::Make(5.0f, 5.0f, nullptr));\n canvas->drawRegion(region, paint);\n paint.setImageFilter(nullptr);\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 5));\n canvas->translate(100, 100);\n canvas->drawRegion(region, paint);\n}\n", + "code": "#include \"SkBlurImageFilter.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(2);\n SkRegion region;\n region.op( 10, 10, 50, 50, SkRegion::kUnion_Op);\n region.op( 10, 50, 90, 90, SkRegion::kUnion_Op);\n paint.setImageFilter(SkBlurImageFilter::Make(5.0f, 5.0f, nullptr));\n canvas->drawRegion(region, paint);\n paint.setImageFilter(nullptr);\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 5));\n canvas->translate(100, 100);\n canvas->drawRegion(region, paint);\n}\n", "width": 256, "height": 256, - "hash": "250e45c5935d54eac6aca775d1fe3475", + "hash": "ece04ee3d3761e3425f37c8f06f054c1", "file": "SkPaint_Reference", "name": "Image_Filter_Methods" }, @@ -3845,14 +3880,6 @@ "file": "SkBitmap_Reference", "name": "SkBitmap::bounds()" }, - "SkBitmap_colorType": { - "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkBitmap bitmap;\n bitmap.setInfo(SkImageInfo::MakeA8(16, 32));\n SkDebugf(\"color type: k\" \"%s\" \"_SkColorType\\n\", colors[bitmap.colorType()]);\n}", - "width": 256, - "height": 256, - "hash": "ceb77fab7326b57822a147b04aa0960e", - "file": "SkBitmap_Reference", - "name": "SkBitmap::colorType" -}, "SkBitmap_erase": { "code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32(2, 2, kPremul_SkAlphaType));\n bitmap.erase(0x7fff7f3f, SkIRect::MakeWH(1, 1));\n bitmap.erase(0x7f7f3fff, SkIRect::MakeXYWH(0, 1, 1, 1));\n bitmap.erase(0x7f3fff7f, SkIRect::MakeXYWH(1, 0, 1, 1));\n bitmap.erase(0x7f1fbf5f, SkIRect::MakeXYWH(1, 1, 1, 1));\n canvas->scale(25, 25);\n canvas->drawBitmap(bitmap, 0, 0);\n canvas->drawBitmap(bitmap, .5f, .5f);\n}", "width": 256, @@ -3917,14 +3944,6 @@ "file": "SkBitmap_Reference", "name": "SkBitmap::getBounds_2" }, - "SkBitmap_info": { - "code": "void draw(SkCanvas* canvas) {\n // SkBitmap source; // pre-populated with soccer ball by fiddle.skia.org\n const SkImageInfo& info = source.info();\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkDebugf(\"width: %d height: %d color: %s alpha: %s\\n\", info.width(), info.height(),\n colors[info.colorType()], alphas[info.alphaType()]);\n}\n", - "width": 256, - "height": 256, - "hash": "ec47c4dc23e2925ad565eaba55a91553", - "file": "SkBitmap_Reference", - "name": "SkBitmap::info()" -}, "SkBitmap_installPixels_2": { "code": "void draw(SkCanvas* canvas) {\n SkRandom random;\n SkBitmap bitmap;\n const int width = 8;\n const int height = 8;\n uint32_t pixels[width * height];\n for (unsigned x = 0; x < width * height; ++x) {\n pixels[x] = random.nextU();\n }\n SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType);\n if (bitmap.installPixels(info, pixels, info.minRowBytes())) {\n canvas->scale(32, 32);\n canvas->drawBitmap(bitmap, 0, 0);\n }\n}\n", "width": 256, @@ -4798,10 +4817,10 @@ "name": "SkCanvas::save()" }, "SkCanvas_saveLayer": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint, blur;\n blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr));\n canvas->saveLayer(nullptr, &blur);\n SkRect rect = { 25, 25, 50, 50};\n canvas->drawRect(rect, paint);\n canvas->translate(50, 50);\n paint.setColor(SK_ColorRED);\n canvas->drawRect(rect, paint);\n canvas->restore();\n}\n", + "code": "#include \"SkBlurImageFilter.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint, blur;\n blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr));\n canvas->saveLayer(nullptr, &blur);\n SkRect rect = { 25, 25, 50, 50};\n canvas->drawRect(rect, paint);\n canvas->translate(50, 50);\n paint.setColor(SK_ColorRED);\n canvas->drawRect(rect, paint);\n canvas->restore();\n}\n", "width": 256, "height": 128, - "hash": "1a025d6018f64140af2dc36acad59008", + "hash": "42318b18d403e17e07a541652da91ee2", "file": "SkCanvas_Reference", "name": "SkCanvas::saveLayer" }, @@ -4822,10 +4841,10 @@ "name": "SkCanvas::saveLayerPreserveLCDTextRequests" }, "SkCanvas_saveLayer_2": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint, blur;\n blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr));\n canvas->saveLayer(SkRect::MakeWH(90, 90), &blur);\n SkRect rect = { 25, 25, 50, 50};\n canvas->drawRect(rect, paint);\n canvas->translate(50, 50);\n paint.setColor(SK_ColorRED);\n canvas->drawRect(rect, paint);\n canvas->restore();\n}\n", + "code": "#include \"SkBlurImageFilter.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint, blur;\n blur.setImageFilter(SkBlurImageFilter::Make(3, 3, nullptr));\n canvas->saveLayer(SkRect::MakeWH(90, 90), &blur);\n SkRect rect = { 25, 25, 50, 50};\n canvas->drawRect(rect, paint);\n canvas->translate(50, 50);\n paint.setColor(SK_ColorRED);\n canvas->drawRect(rect, paint);\n canvas->restore();\n}\n", "width": 256, "height": 128, - "hash": "5b59231feae0c09cb1ab6a292229d7a4", + "hash": "a17aec3aa4909527be039e26a7eda694", "file": "SkCanvas_Reference", "name": "SkCanvas::saveLayer_2" }, @@ -7149,14 +7168,6 @@ "file": "SkSurface_Reference", "name": "SkSurface::MakeFromBackendTextureAsRenderTarget" }, - "SkSurface_MakeRaster": { - "code": "void draw(SkCanvas* ) {\n SkImageInfo info = SkImageInfo::MakeN32Premul(3, 3);\n const size_t rowBytes = 64;\n sk_sp<SkSurface> surface(SkSurface::MakeRaster(info, rowBytes, nullptr));\n SkCanvas* canvas = surface->getCanvas();\n canvas->clear(SK_ColorWHITE);\n SkPixmap pixmap;\n if (surface->peekPixels(&pixmap)) {\n const uint32_t* colorPtr = pixmap.addr32();\n SkPMColor pmWhite = colorPtr[0];\n SkPaint paint;\n canvas->drawPoint(1, 1, paint);\n canvas->flush(); // ensure that point was drawn\n for (int y = 0; y < info.height(); ++y) {\n for (int x = 0; x < info.width(); ++x) {\n SkDebugf(\"%c\", colorPtr[x] == pmWhite ? '-' : 'x');\n }\n colorPtr += rowBytes / sizeof(colorPtr[0]);\n SkDebugf(\"\\n\");\n }\n }\n}\n", - "width": 256, - "height": 256, - "hash": "a803910ada4f8733f0b62456afead55f", - "file": "SkSurface_Reference", - "name": "SkSurface::MakeRaster" -}, "SkSurface_MakeRenderTarget": { "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n SkImageInfo info = SkImageInfo::MakeN32(256, 64, kOpaque_SkAlphaType);\n for (auto surfaceOrigin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n auto gpuSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0,\n surfaceOrigin, nullptr));\n auto surfaceCanvas = gpuSurface->getCanvas();\n surfaceCanvas->clear(SK_ColorWHITE);\n surfaceCanvas->drawString(\"GPU rocks!\", 20, 40, paint);\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n canvas->drawImage(image, 0, 0);\n canvas->translate(0, 128);\n }\n}", "width": 256, @@ -7205,14 +7216,6 @@ "file": "SkSurface_Reference", "name": "SkSurface::draw_2" }, - "SkSurface_generationID": { - "code": "void draw(SkCanvas* canvas) {\n auto surface = SkSurface::MakeRasterN32Premul(1, 1);\n for (int i = 0; i < 3; ++i) {\n SkDebugf(\"surface generationID: %d\\n\", surface->generationID());\n if (0 == i) {\n surface->getCanvas()->drawColor(SK_ColorBLACK);\n } else {\n surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);\n }\n }\n}", - "width": 256, - "height": 256, - "hash": "be9574c4a14f891e1abb4ec2b1e51d6c", - "file": "SkSurface_Reference", - "name": "SkSurface::generationID" -}, "SkSurface_getCanvas": { "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(64, 64));\n SkCanvas* surfaceCanvas = surface->getCanvas();\n surfaceCanvas->clear(SK_ColorBLUE);\n SkPaint paint;\n paint.setTextSize(40);\n surfaceCanvas->drawString(\"\\xF0\\x9F\\x98\\x81\", 12, 45, paint);\n surface->draw(canvas, 0, 0, nullptr);\n}", "width": 256, @@ -7237,14 +7240,6 @@ "file": "SkSurface_Reference", "name": "SkSurface::makeSurface" }, - "SkSurface_notifyContentWillChange": { - "code": "void draw(SkCanvas* canvas) {\n auto surface = SkSurface::MakeRasterN32Premul(1, 1);\n for (int i = 0; i < 3; ++i) {\n SkDebugf(\"surface generationID: %d\\n\", surface->generationID());\n if (0 == i) {\n surface->getCanvas()->drawColor(SK_ColorBLACK);\n } else {\n surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);\n }\n }\n}", - "width": 256, - "height": 256, - "hash": "be9574c4a14f891e1abb4ec2b1e51d6c", - "file": "SkSurface_Reference", - "name": "SkSurface::notifyContentWillChange" -}, "SkSurface_peekPixels": { "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkSurface> surf(SkSurface::MakeRasterN32Premul(64, 64));\n auto surfCanvas = surf->getCanvas();\n surfCanvas->clear(SK_ColorRED);\n SkPaint paint;\n paint.setTextSize(40);\n surfCanvas->drawString(\"&\", 16, 48, paint);\n SkPixmap pixmap;\n if (surf->peekPixels(&pixmap)) {\n SkBitmap surfBits;\n surfBits.installPixels(pixmap);\n canvas->drawBitmap(surfBits, 0, 0);\n }\n}", "width": 256, diff --git a/tools/bookmaker/bookmaker.cpp b/tools/bookmaker/bookmaker.cpp index 794e2007e8..947c0770e3 100644 --- a/tools/bookmaker/bookmaker.cpp +++ b/tools/bookmaker/bookmaker.cpp @@ -1323,6 +1323,7 @@ bool BmhParser::findDefinitions() { if (!this->skipSpace()) { return this->reportError<bool>("unexpected end"); } + lineStart = '\n' == this->peek(); bool expectEnd = true; vector<string> typeNameBuilder = this->typeName(markType, &expectEnd); if (fCloned && MarkType::kMethod != markType && MarkType::kExample != markType @@ -1448,9 +1449,11 @@ bool BmhParser::findDefinitions() { } } char nextChar = this->next(); - lineStart = nextChar == '\n'; if (' ' < nextChar) { lastChar = fChar; + lineStart = false; + } else if (nextChar == '\n') { + lineStart = true; } } if (fParent) { |