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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SK_ColorYELLOW, | 48 SK_ColorYELLOW, |
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.setFilterLevel(SkPaint::kLow_FilterLevel); | 58 blurPaint.setFilterQuality(kLow_SkFilterQuality); |
59 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 59 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
60 SkBlurMask::ConvertRadiusToS
igma(kBlurRadius)); | 60 SkBlurMask::ConvertRadiusToS
igma(kBlurRadius)); |
61 blurPaint.setMaskFilter(mf)->unref(); | 61 blurPaint.setMaskFilter(mf)->unref(); |
62 | 62 |
63 canvas->clear(SK_ColorBLACK); | 63 canvas->clear(SK_ColorBLACK); |
64 canvas->save(); | 64 canvas->save(); |
65 canvas->translate(kBoxSize, kBoxSize); | 65 canvas->translate(kBoxSize, kBoxSize); |
66 canvas->drawRect(clipRect, hairlinePaint); | 66 canvas->drawRect(clipRect, hairlinePaint); |
67 canvas->clipRect(clipRect); | 67 canvas->clipRect(clipRect); |
68 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { | 68 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { |
69 blurPaint.setColor(colors[i]); | 69 blurPaint.setColor(colors[i]); |
70 canvas->drawRect(blurRects[i], blurPaint); | 70 canvas->drawRect(blurRects[i], blurPaint); |
71 canvas->drawRect(blurRects[i], hairlinePaint); | 71 canvas->drawRect(blurRects[i], hairlinePaint); |
72 } | 72 } |
73 canvas->restore(); | 73 canvas->restore(); |
74 } | 74 } |
75 | 75 |
76 private: | 76 private: |
77 static const int kWidth = 300; | 77 static const int kWidth = 300; |
78 static const int kHeight = 300; | 78 static const int kHeight = 300; |
79 | 79 |
80 typedef GM INHERITED; | 80 typedef GM INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 DEF_GM( return new BlurQuickRejectGM(); ) | 83 DEF_GM( return new BlurQuickRejectGM(); ) |
OLD | NEW |