Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: gm/blurcircles.cpp

Issue 276453002: New GM for testing circle blur optimization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
bsalomon 2014/05/07 14:43:02 2014
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h"
11 #include "SkCanvas.h"
12 #include "SkColorFilter.h"
13 #include "SkLayerDrawLooper.h"
14 #include "SkPaint.h"
15 #include "SkPath.h"
16 #include "SkPoint.h"
17 #include "SkRect.h"
18 #include "SkRRect.h"
19 #include "SkString.h"
20 #include "SkXfermode.h"
21
22 class BlurCirclesGM : public skiagm::GM {
23 public:
24 BlurCirclesGM()
25 : fName("blurcircles") {
26 }
27
28 protected:
29 virtual uint32_t onGetFlags() const SK_OVERRIDE {
30 return kSkipTiled_Flag;
bsalomon 2014/05/07 14:43:02 curious why this is skipped
humper 2014/05/07 17:09:42 Good question -- I copied it from another GM. I'l
mtklein 2014/05/07 17:13:59 Might want to try out/Debug/dm --match blurcircles
31 }
32
33 virtual SkString onShortName() SK_OVERRIDE {
34 return fName;
35 }
36
37 virtual SkISize onISize() SK_OVERRIDE {
38 return SkISize::Make(950, 950);
39 }
40
41 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
42 canvas->scale(1.5f, 1.5f);
43 canvas->translate(50,50);
44
45 const float blurRadii[] = { 1,5,10,20 };
46 const int circleRadii[] = { 5,10,25,50 };
47 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
48 SkAutoCanvasRestore autoRestore(canvas, true);
bsalomon 2014/05/07 14:43:02 are these lines weirdly indented or is that the ri
humper 2014/05/07 17:09:42 I did this on Windows; looks like don't have my sp
49 canvas->translate(0, SkIntToScalar(150*i));
50 for (size_t j = 0; j < SK_ARRAY_COUNT(circleRadii); ++j) {
51 SkMaskFilter* filter = SkBlurMaskFilter::Create(
52 kNormal_SkBlurStyle,
53 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ),
54 SkBlurMaskFilter::kHighQuality_BlurFlag);
55 SkPaint paint;
56 paint.setColor(SK_ColorBLACK);
57 paint.setMaskFilter(filter)->unref();
58
59 canvas->drawCircle(SkIntToScalar(50),SkIntToScalar(50),SkIntToSc alar(circleRadii[j]),paint);
60 canvas->translate(SkIntToScalar(150), 0);
61 }
62 }
63 }
64 private:
65 const SkString fName;
66
67 typedef skiagm::GM INHERITED;
68 };
69
70 DEF_GM(return new BlurCirclesGM();)
OLDNEW
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698