| 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 virtual SkIPoint onGetSize() SK_OVERRIDE { | 37 virtual SkIPoint onGetSize() SK_OVERRIDE { |
| 38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()), | 38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()), |
| 39 SkScalarCeilToInt(fRRect.rect().height())); | 39 SkScalarCeilToInt(fRRect.rect().height())); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 42 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
| 43 SkLayerDrawLooper* looper = new SkLayerDrawLooper; | 43 SkLayerDrawLooper* looper = new SkLayerDrawLooper; |
| 44 { | 44 { |
| 45 SkLayerDrawLooper::LayerInfo info; | 45 SkLayerDrawLooper::LayerInfo info; |
| 46 info.fFlagsMask = 0; | |
| 47 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit | 46 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit |
| 48 | SkLayerDrawLooper::kColorFilter_Bit; | 47 | SkLayerDrawLooper::kColorFilter_Bit; |
| 49 info.fColorMode = SkXfermode::kSrc_Mode; | 48 info.fColorMode = SkXfermode::kSrc_Mode; |
| 50 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); | 49 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); |
| 51 info.fPostTranslate = false; | 50 info.fPostTranslate = false; |
| 52 SkPaint* paint = looper->addLayerOnTop(info); | 51 SkPaint* paint = looper->addLayerOnTop(info); |
| 53 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create( | 52 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create( |
| 54 SkBlurMaskFilter::kNormal_BlurStyle, | 53 SkBlurMaskFilter::kNormal_BlurStyle, |
| 55 SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf), | 54 SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf), |
| 56 SkBlurMaskFilter::kHighQuality_BlurFlag); | 55 SkBlurMaskFilter::kHighQuality_BlurFlag); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 85 typedef SkBenchmark INHERITED; | 84 typedef SkBenchmark INHERITED; |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 // Create one with dimensions/rounded corners based on the skp | 87 // Create one with dimensions/rounded corners based on the skp |
| 89 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) | 88 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) |
| 90 // Same radii, much smaller rectangle | 89 // Same radii, much smaller rectangle |
| 91 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) | 90 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) |
| 92 // Other radii options | 91 // Other radii options |
| 93 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) | 92 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) |
| 94 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) | 93 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) |
| OLD | NEW |