aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/conicpaths.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-01-05 10:01:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-05 10:01:25 -0800
commit40c85e41b8be96f47f03a34bb2938696037afad4 (patch)
tree8bbf87e64661d0434a948dd3d7dd7a6a921eff82 /gm/conicpaths.cpp
parentf1cdead599715dbae30278bffa4528bd1664f61f (diff)
Revert of Revert of enable conics gm (patchset #1 id:1 of https://codereview.chromium.org/811863006/)
Reason for revert: maybe this wasn't the cause of the chromeos crash? Original issue's description: > Revert of enable conics gm (patchset #3 id:40001 of https://codereview.chromium.org/835593002/) > > Reason for revert: > did I break the build? > > Original issue's description: > > enable conics gm > > > > BUG=skia: > > TBR= > > > > Committed: https://skia.googlesource.com/skia/+/03119ba4f815bc2c2774a9349ca8278ab1695072 > > TBR=egdaniel@google.com > NOTREECHECKS=true > NOTRY=true > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/ede901c7a2e21a44552b8c1436d9521ce33f4de5 TBR=egdaniel@google.com,reed@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/836773002
Diffstat (limited to 'gm/conicpaths.cpp')
-rw-r--r--gm/conicpaths.cpp61
1 files changed, 21 insertions, 40 deletions
diff --git a/gm/conicpaths.cpp b/gm/conicpaths.cpp
index 96242faf5f..d04cd26359 100644
--- a/gm/conicpaths.cpp
+++ b/gm/conicpaths.cpp
@@ -17,14 +17,14 @@ protected:
}
SkISize onISize() SK_OVERRIDE {
- return SkISize::Make(950, 1000);
+ return SkISize::Make(920, 960);
}
void onOnceBeforeDraw() SK_OVERRIDE {
{
const SkScalar w = SkScalarSqrt(2)/2;
SkPath* conicCirlce = &fPaths.push_back();
- conicCirlce->moveTo(0, -0);
+ conicCirlce->moveTo(0, 0);
conicCirlce->conicTo(0, 50, 50, 50, w);
conicCirlce->rConicTo(50, 0, 50, -50, w);
conicCirlce->rConicTo(0, -50, -50, -50, w);
@@ -33,43 +33,43 @@ protected:
}
{
SkPath* hyperbola = &fPaths.push_back();
- hyperbola->moveTo(0, -0);
+ hyperbola->moveTo(0, 0);
hyperbola->conicTo(0, 100, 100, 100, 2);
}
{
SkPath* thinHyperbola = &fPaths.push_back();
- thinHyperbola->moveTo(0, -0);
+ thinHyperbola->moveTo(0, 0);
thinHyperbola->conicTo(100, 100, 5, 0, 2);
}
{
SkPath* veryThinHyperbola = &fPaths.push_back();
- veryThinHyperbola->moveTo(0, -0);
+ veryThinHyperbola->moveTo(0, 0);
veryThinHyperbola->conicTo(100, 100, 1, 0, 2);
}
{
SkPath* closedHyperbola = &fPaths.push_back();
- closedHyperbola->moveTo(0, -0);
+ closedHyperbola->moveTo(0, 0);
closedHyperbola->conicTo(100, 100, 0, 0, 2);
}
{
// using 1 as weight defaults to using quadTo
SkPath* nearParabola = &fPaths.push_back();
- nearParabola->moveTo(0, -0);
+ nearParabola->moveTo(0, 0);
nearParabola->conicTo(0, 100, 100, 100, 0.999f);
}
{
SkPath* thinEllipse = &fPaths.push_back();
- thinEllipse->moveTo(0, -0);
+ thinEllipse->moveTo(0, 0);
thinEllipse->conicTo(100, 100, 5, 0, SK_ScalarHalf);
}
{
SkPath* veryThinEllipse = &fPaths.push_back();
- veryThinEllipse->moveTo(0, -0);
+ veryThinEllipse->moveTo(0, 0);
veryThinEllipse->conicTo(100, 100, 1, 0, SK_ScalarHalf);
}
{
SkPath* closedEllipse = &fPaths.push_back();
- closedEllipse->moveTo(0, -0);
+ closedEllipse->moveTo(0, 0);
closedEllipse->conicTo(100, 100, 0, 0, SK_ScalarHalf);
}
}
@@ -77,58 +77,39 @@ protected:
void onDraw(SkCanvas* canvas) SK_OVERRIDE {
const SkAlpha kAlphaValue[] = { 0xFF, 0x40 };
- SkScalar maxH = 0;
const SkScalar margin = 15;
canvas->translate(margin, margin);
- canvas->save();
- SkScalar x = margin;
- int counter = 0;
+ SkPaint paint;
for (int p = 0; p < fPaths.count(); ++p) {
+ canvas->save();
for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) {
+ paint.setARGB(kAlphaValue[a], 0, 0, 0);
for (int aa = 0; aa < 2; ++aa) {
+ paint.setAntiAlias(SkToBool(aa));
for (int fh = 0; fh < 2; ++fh) {
+ paint.setStyle(fh ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
const SkRect& bounds = fPaths[p].getBounds();
-
- SkPaint paint;
- paint.setARGB(kAlphaValue[a], 0, 0, 0);
- paint.setAntiAlias(SkToBool(aa));
- if (fh == 1) {
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(0);
- } else if (fh == 0) {
- paint.setStyle(SkPaint::kFill_Style);
- }
canvas->save();
canvas->translate(-bounds.fLeft, -bounds.fTop);
canvas->drawPath(fPaths[p], paint);
canvas->restore();
- maxH = SkMaxScalar(maxH, bounds.height());
-
- SkScalar dx = bounds.width() + margin;
- x += dx;
- canvas->translate(dx, 0);
-
- if (++counter == 8) {
- counter = 0;
-
- canvas->restore();
- canvas->translate(0, maxH + margin);
- canvas->save();
- maxH = 0;
- x = margin;
- }
+ canvas->translate(110, 0);
}
}
}
+ canvas->restore();
+ canvas->translate(0, 110);
}
canvas->restore();
}
uint32_t onGetFlags() const SK_OVERRIDE {
- return kSkipPDF_Flag;
+ // tiling w/ non-antialias paths can cause off-by-1-pixels differences which are
+ // unavoidable (chopping in floats -vs- stepping in scan-converter).
+ return kSkipTiled_Flag;
}
private: