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

Side by Side Diff: bench/RectoriBench.cpp

Issue 232913003: Make sure SkDrawLooper objects can only be allocated on the heap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 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 | « bench/BlurRoundRectBench.cpp ('k') | gm/blurroundrect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 } 65 }
66 66
67 private: 67 private:
68 enum { 68 enum {
69 W = 640, 69 W = 640,
70 H = 480, 70 H = 480,
71 }; 71 };
72 72
73 SkLayerDrawLooper* createLooper(SkScalar xOff, SkScalar sigma) { 73 SkLayerDrawLooper* createLooper(SkScalar xOff, SkScalar sigma) {
74 SkLayerDrawLooper* looper = new SkLayerDrawLooper; 74 SkLayerDrawLooper::Builder looperBuilder;
75 75
76 //----------------------------------------------- 76 //-----------------------------------------------
77 SkLayerDrawLooper::LayerInfo info; 77 SkLayerDrawLooper::LayerInfo info;
78 78
79 // TODO: add a color filter to better match what is seen in the wild 79 // TODO: add a color filter to better match what is seen in the wild
80 info.fPaintBits = /* SkLayerDrawLooper::kColorFilter_Bit |*/ 80 info.fPaintBits = /* SkLayerDrawLooper::kColorFilter_Bit |*/
81 SkLayerDrawLooper::kMaskFilter_Bit; 81 SkLayerDrawLooper::kMaskFilter_Bit;
82 info.fColorMode = SkXfermode::kDst_Mode; 82 info.fColorMode = SkXfermode::kDst_Mode;
83 info.fOffset.set(xOff, 0); 83 info.fOffset.set(xOff, 0);
84 info.fPostTranslate = false; 84 info.fPostTranslate = false;
85 85
86 SkPaint* paint = looper->addLayer(info); 86 SkPaint* paint = looperBuilder.addLayer(info);
87 87
88 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl urStyle, 88 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl urStyle,
89 sigma, 89 sigma,
90 SkBlurMaskFilter::kHighQuali ty_BlurFlag); 90 SkBlurMaskFilter::kHighQuali ty_BlurFlag);
91 paint->setMaskFilter(mf)->unref(); 91 paint->setMaskFilter(mf)->unref();
92 92
93 //----------------------------------------------- 93 //-----------------------------------------------
94 info.fPaintBits = 0; 94 info.fPaintBits = 0;
95 info.fOffset.set(0, 0); 95 info.fOffset.set(0, 0);
96 96
97 paint = looper->addLayer(info); 97 paint = looperBuilder.addLayer(info);
98 return looper; 98 return looperBuilder.detachLooper();
99 } 99 }
100 100
101 typedef SkBenchmark INHERITED; 101 typedef SkBenchmark INHERITED;
102 }; 102 };
103 103
104 DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); ) 104 DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); )
OLDNEW
« no previous file with comments | « bench/BlurRoundRectBench.cpp ('k') | gm/blurroundrect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698