fix fractured fiddles

Latest run of Ravi's bot found a couple
of new fiddle failures. Fix them.

Yay, tools!

Docs-Preview: https://skia.org/?cl=83944
Bug: skia:6898
Change-Id: I98ecef6b034363dfea88bcc9c710fb3017fc1c21
Reviewed-on: https://skia-review.googlesource.com/83944
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2017-12-12 11:22:38 -05:00 committed by Skia Commit-Bot
parent 929253d398
commit ca3ebcd724
3 changed files with 55 additions and 17 deletions

View File

@ -4874,13 +4874,14 @@ void draw(SkCanvas* canvas) {
}
const int xDivs[] = { center.fLeft, center.fRight };
const int yDivs[] = { center.fTop, center.fBottom };
SkCanvas::Lattice::Flags flags[3][3];
memset(flags, 0, sizeof(flags));
flags[1][1] = SkCanvas::Lattice::kTransparent_Flags;
SkCanvas::Lattice lattice = { xDivs, yDivs, flags[0], SK_ARRAY_COUNT(xDivs),
SK_ARRAY_COUNT(yDivs), nullptr };
SkCanvas::Lattice::RectType fillTypes[3][3];
memset(fillTypes, 0, sizeof(fillTypes));
fillTypes[1][1] = SkCanvas::Lattice::kTransparent;
SkColor dummy[9]; // temporary pending bug fix
SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),
SK_ARRAY_COUNT(yDivs), nullptr, dummy };
for (auto dest: { 20, 30, 40, 60, 90 } ) {
canvas->drawBitmapLattice(bitmap, lattice , SkRect::MakeWH(dest, 110 - dest), nullptr);
canvas->drawBitmapLattice(bitmap, lattice, SkRect::MakeWH(dest, 110 - dest), nullptr);
canvas->translate(dest + 4, 0);
}
}
@ -4949,11 +4950,12 @@ void draw(SkCanvas* canvas) {
}
const int xDivs[] = { center.fLeft, center.fRight };
const int yDivs[] = { center.fTop, center.fBottom };
SkCanvas::Lattice::Flags flags[3][3];
memset(flags, 0, sizeof(flags));
flags[1][1] = SkCanvas::Lattice::kTransparent_Flags;
SkCanvas::Lattice lattice = { xDivs, yDivs, flags[0], SK_ARRAY_COUNT(xDivs),
SK_ARRAY_COUNT(yDivs), nullptr };
SkCanvas::Lattice::RectType fillTypes[3][3];
memset(fillTypes, 0, sizeof(fillTypes));
fillTypes[1][1] = SkCanvas::Lattice::kTransparent;
SkColor dummy[9]; // temporary pending bug fix
SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),
SK_ARRAY_COUNT(yDivs), nullptr, dummy };
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
SkImage* imagePtr = image.get();
for (auto dest: { 20, 30, 40, 60, 90 } ) {

View File

@ -64,6 +64,20 @@ All structs, classes, enums, their members and methods, functions, and so on,
require descriptions. Most also require examples.
All methods and functions should include examples if practical.
It's difficult to think of a meaningful example for class destructors.
In cases like these, change the placeholder:
###$
$Code
#Example
$$
to:
$Code
#NoExample
$$
$$$#
Descriptions start with an active verb. Descriptions are complete, punctuated
sentences unless they describe parameters or return values. Parameters and
@ -71,8 +85,8 @@ returned values are described by phrases that start lower case and do not
include trailing punctuation.
Descriptions are not self-referential; they do not include the thing they
describe. Descriptions may contain upper case references to definitions
but otherwise should be free of jargon.
describe. Descriptions may contain upper case or camel case references to
definitions but otherwise should be free of jargon.
Descriptions may contain code and formulas, each bracketed by markup.
@ -88,6 +102,10 @@ an example, and any cross references.
Each method must contain either one or more examples or markup indicating
that there is no example.
After editing is complete, searching for "incomplete" should fail,
assuming "incomplete" is not the perfect word to use in a description or
example!
##
Generate fiddle.json from all examples, including the ones you just wrote.
@ -132,6 +150,24 @@ $ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
to write the updated SkXXX.h to the current directory.
Once adding the file is complete, add the file to status.json in the
Completed section. You may add it to the InProgress section during
development, or leave status.json unchanged.
If the new file has been added to status.json, you can run
any of the above commands with -a docs/status.json in place of
-b docs or -i includes.
Complete rebuilding of all bookmaker output looks like:
#Code
./out/skia/bookmaker.exe -a docs/status.json -e fiddle.json
~/go/bin/fiddlecli.exe --input fiddle.json --output fiddleout.json
./out/skia/bookmaker.exe -a docs/status.json -f fiddleout.json -r site/user/api -c
./out/skia/bookmaker.exe -a docs/status.json -x
./out/skia/bookmaker.exe -a docs/status.json -p
##
#Subtopic Bugs
Bookmaker bugs are tracked

View File

@ -4086,10 +4086,10 @@
"name": "SkCanvas::drawBitmap"
},
"SkCanvas_drawBitmapLattice": {
"code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n const int xDivs[] = { center.fLeft, center.fRight };\n const int yDivs[] = { center.fTop, center.fBottom };\n SkCanvas::Lattice::Flags flags[3][3];\n memset(flags, 0, sizeof(flags)); \n flags[1][1] = SkCanvas::Lattice::kTransparent_Flags;\n SkCanvas::Lattice lattice = { xDivs, yDivs, flags[0], SK_ARRAY_COUNT(xDivs),\n SK_ARRAY_COUNT(yDivs), nullptr };\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawBitmapLattice(bitmap, lattice , SkRect::MakeWH(dest, 110 - dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
"code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n const int xDivs[] = { center.fLeft, center.fRight };\n const int yDivs[] = { center.fTop, center.fBottom };\n SkCanvas::Lattice::RectType fillTypes[3][3];\n memset(fillTypes, 0, sizeof(fillTypes));\n fillTypes[1][1] = SkCanvas::Lattice::kTransparent;\n SkColor dummy[9]; // temporary pending bug fix\n SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),\n SK_ARRAY_COUNT(yDivs), nullptr, dummy };\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawBitmapLattice(bitmap, lattice, SkRect::MakeWH(dest, 110 - dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
"width": 256,
"height": 128,
"hash": "773134f4fe127f9c9caa110c24c988dc",
"hash": "7a02b16a4cc8158d88858a76907c9d89",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawBitmapLattice"
},
@ -4198,10 +4198,10 @@
"name": "SkCanvas::drawImage"
},
"SkCanvas_drawImageLattice": {
"code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n const int xDivs[] = { center.fLeft, center.fRight };\n const int yDivs[] = { center.fTop, center.fBottom };\n SkCanvas::Lattice::Flags flags[3][3];\n memset(flags, 0, sizeof(flags)); \n flags[1][1] = SkCanvas::Lattice::kTransparent_Flags;\n SkCanvas::Lattice lattice = { xDivs, yDivs, flags[0], SK_ARRAY_COUNT(xDivs),\n SK_ARRAY_COUNT(yDivs), nullptr };\n sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);\n SkImage* imagePtr = image.get();\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawImageNine(imagePtr, center, SkRect::MakeWH(dest, dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
"code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n const int xDivs[] = { center.fLeft, center.fRight };\n const int yDivs[] = { center.fTop, center.fBottom };\n SkCanvas::Lattice::RectType fillTypes[3][3];\n memset(fillTypes, 0, sizeof(fillTypes)); \n fillTypes[1][1] = SkCanvas::Lattice::kTransparent;\n SkColor dummy[9]; // temporary pending bug fix\n SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),\n SK_ARRAY_COUNT(yDivs), nullptr, dummy };\n sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);\n SkImage* imagePtr = image.get();\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawImageNine(imagePtr, center, SkRect::MakeWH(dest, dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
"width": 256,
"height": 128,
"hash": "c52ee1d4c69363c6b109539c1da3ce83",
"hash": "75f43f11c6bd58175071b8b54ebec676",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawImageLattice"
},