OLD | NEW |
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 Loading... |
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, ()); ) |
OLD | NEW |