| 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 "Benchmark.h" | 8 #include "Benchmark.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void onDraw(int loops, SkCanvas* canvas) override { | 42 void onDraw(int loops, SkCanvas* canvas) override { |
| 43 SkLayerDrawLooper::Builder looperBuilder; | 43 SkLayerDrawLooper::Builder looperBuilder; |
| 44 { | 44 { |
| 45 SkLayerDrawLooper::LayerInfo info; | 45 SkLayerDrawLooper::LayerInfo info; |
| 46 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit | 46 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit |
| 47 | SkLayerDrawLooper::kColorFilter_Bit; | 47 | SkLayerDrawLooper::kColorFilter_Bit; |
| 48 info.fColorMode = SkXfermode::kSrc_Mode; | 48 info.fColorMode = SkXfermode::kSrc_Mode; |
| 49 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); | 49 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); |
| 50 info.fPostTranslate = false; | 50 info.fPostTranslate = false; |
| 51 SkPaint* paint = looperBuilder.addLayerOnTop(info); | 51 SkPaint* paint = looperBuilder.addLayerOnTop(info); |
| 52 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create( | 52 paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, |
| 53 kNormal_SkBlurStyle, | 53 SkBlurMask::ConvertRadiu
sToSigma(0.5), |
| 54 SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf), | 54 SkBlurMaskFilter::kHighQ
uality_BlurFlag)); |
| 55 SkBlurMaskFilter::kHighQuality_BlurFlag); | |
| 56 paint->setMaskFilter(maskFilter)->unref(); | |
| 57 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, | 55 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, |
| 58 SkXfermode::kSrc
In_Mode)); | 56 SkXfermode::kSrc
In_Mode)); |
| 59 paint->setColor(SK_ColorGRAY); | 57 paint->setColor(SK_ColorGRAY); |
| 60 } | 58 } |
| 61 { | 59 { |
| 62 SkLayerDrawLooper::LayerInfo info; | 60 SkLayerDrawLooper::LayerInfo info; |
| 63 looperBuilder.addLayerOnTop(info); | 61 looperBuilder.addLayerOnTop(info); |
| 64 } | 62 } |
| 65 SkPaint dullPaint; | 63 SkPaint dullPaint; |
| 66 dullPaint.setAntiAlias(true); | 64 dullPaint.setAntiAlias(true); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 83 typedef Benchmark INHERITED; | 81 typedef Benchmark INHERITED; |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 // Create one with dimensions/rounded corners based on the skp | 84 // Create one with dimensions/rounded corners based on the skp |
| 87 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) | 85 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) |
| 88 // Same radii, much smaller rectangle | 86 // Same radii, much smaller rectangle |
| 89 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) | 87 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) |
| 90 // Other radii options | 88 // Other radii options |
| 91 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) | 89 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) |
| 92 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) | 90 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) |
| OLD | NEW |