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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 }; | 49 }; |
50 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(blurRects)); | 50 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(blurRects)); |
51 | 51 |
52 SkPaint hairlinePaint; | 52 SkPaint hairlinePaint; |
53 hairlinePaint.setStyle(SkPaint::kStroke_Style); | 53 hairlinePaint.setStyle(SkPaint::kStroke_Style); |
54 hairlinePaint.setColor(SK_ColorWHITE); | 54 hairlinePaint.setColor(SK_ColorWHITE); |
55 hairlinePaint.setStrokeWidth(0); | 55 hairlinePaint.setStrokeWidth(0); |
56 | 56 |
57 SkPaint blurPaint; | 57 SkPaint blurPaint; |
58 blurPaint.setFilterQuality(kLow_SkFilterQuality); | 58 blurPaint.setFilterQuality(kLow_SkFilterQuality); |
59 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 59 blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, |
60 SkBlurMask::ConvertRadiusToS
igma(kBlurRadius)); | 60 SkBlurMask::ConvertRadiusToS
igma(kBlurRadius))); |
61 blurPaint.setMaskFilter(mf)->unref(); | |
62 | 61 |
63 canvas->clear(SK_ColorBLACK); | 62 canvas->clear(SK_ColorBLACK); |
64 canvas->save(); | 63 canvas->save(); |
65 canvas->translate(kBoxSize, kBoxSize); | 64 canvas->translate(kBoxSize, kBoxSize); |
66 canvas->drawRect(clipRect, hairlinePaint); | 65 canvas->drawRect(clipRect, hairlinePaint); |
67 canvas->clipRect(clipRect); | 66 canvas->clipRect(clipRect); |
68 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { | 67 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { |
69 blurPaint.setColor(colors[i]); | 68 blurPaint.setColor(colors[i]); |
70 canvas->drawRect(blurRects[i], blurPaint); | 69 canvas->drawRect(blurRects[i], blurPaint); |
71 canvas->drawRect(blurRects[i], hairlinePaint); | 70 canvas->drawRect(blurRects[i], hairlinePaint); |
72 } | 71 } |
73 canvas->restore(); | 72 canvas->restore(); |
74 } | 73 } |
75 | 74 |
76 private: | 75 private: |
77 static const int kWidth = 300; | 76 static const int kWidth = 300; |
78 static const int kHeight = 300; | 77 static const int kHeight = 300; |
79 | 78 |
80 typedef GM INHERITED; | 79 typedef GM INHERITED; |
81 }; | 80 }; |
82 | 81 |
83 DEF_GM( return new BlurQuickRejectGM(); ) | 82 DEF_GM( return new BlurQuickRejectGM(); ) |
OLD | NEW |