From 63c684a8a609d39da11b4a656223cebf52ca85dc Mon Sep 17 00:00:00 2001 From: caryclark Date: Wed, 25 Feb 2015 09:04:04 -0800 Subject: fuzzer fixes Fix path bugs exposed by the path fuzzer. Changes to existing gm and samplecode files defer their calls to construct SkPath objects until the first draw instead of at test initialization. Add an experimental call to SkPath to validate the internal SkPathRef. Fix SkPath::addPoly to set the last moveto after adding a close verb. Fix stroke to handle failures when computing the unit normal. Add a unit test for the unit normal failure. R=reed@google.com Review URL: https://codereview.chromium.org/953383002 --- gm/pictureshader.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gm/pictureshader.cpp') diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp index 630ecd8f0c..3f184ec2d6 100644 --- a/gm/pictureshader.cpp +++ b/gm/pictureshader.cpp @@ -27,21 +27,23 @@ public: PictureShaderGM(SkScalar tileSize, SkScalar sceneSize) : fTileSize(tileSize) , fSceneSize(sceneSize) { + } - // Build the picture. + protected: + void onOnceBeforeDraw() SK_OVERRIDE { + // Build the picture. SkPictureRecorder recorder; - SkCanvas* pictureCanvas = recorder.beginRecording(tileSize, tileSize, NULL, 0); + SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, NULL, 0); this->drawTile(pictureCanvas); fPicture.reset(recorder.endRecording()); // Build a reference bitmap. - fBitmap.allocN32Pixels(SkScalarCeilToInt(tileSize), SkScalarCeilToInt(tileSize)); + fBitmap.allocN32Pixels(SkScalarCeilToInt(fTileSize), SkScalarCeilToInt(fTileSize)); fBitmap.eraseColor(SK_ColorTRANSPARENT); SkCanvas bitmapCanvas(fBitmap); this->drawTile(&bitmapCanvas); } -protected: SkString onShortName() SK_OVERRIDE { return SkString("pictureshader"); -- cgit v1.2.3