diff options
author | bsalomon <bsalomon@google.com> | 2014-12-15 07:11:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-15 07:11:22 -0800 |
commit | ce1c8869cf5e37753f9c8193314d93bff897d014 (patch) | |
tree | e32d5990172ab9cc40b051b2f27ebf513cac927c /gm/circles.cpp | |
parent | 7534cf1703b66a742217d870aa7b87bdbc75e760 (diff) |
Do circle anti-aliasing in normalized space to avoid precision issues with half-floats on Adreno.
Review URL: https://codereview.chromium.org/761593006
Diffstat (limited to 'gm/circles.cpp')
-rw-r--r-- | gm/circles.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gm/circles.cpp b/gm/circles.cpp index 734fcb5a0b..2c9368be92 100644 --- a/gm/circles.cpp +++ b/gm/circles.cpp @@ -157,6 +157,17 @@ protected: virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { SkLCGRandom rand; + // Draw a giant AA circle as the background. + SkISize size = this->getISize(); + SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth), + SkIntToScalar(size.fHeight)) / 2.f; + SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2), + SkIntToScalar(size.fHeight/2)); + SkPaint giantPaint; + giantPaint.setAntiAlias(true); + giantPaint.setColor(0x80808080); + canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPaint); + canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); int i; for (i = 0; i < fPaints.count(); ++i) { |