| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SampleCode.h" | 7 #include "SampleCode.h" |
| 8 #include "SkBlurMask.h" | 8 #include "SkBlurMask.h" |
| 9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 SampleCode::TitleR(evt, "BigBlur"); | 22 SampleCode::TitleR(evt, "BigBlur"); |
| 23 return true; | 23 return true; |
| 24 } | 24 } |
| 25 return this->INHERITED::onQuery(evt); | 25 return this->INHERITED::onQuery(evt); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void onDrawContent(SkCanvas* canvas) { | 28 virtual void onDrawContent(SkCanvas* canvas) { |
| 29 SkPaint paint; | 29 SkPaint paint; |
| 30 canvas->save(); | 30 canvas->save(); |
| 31 paint.setColor(SK_ColorBLUE); | 31 paint.setColor(SK_ColorBLUE); |
| 32 SkMaskFilter* mf = SkBlurMaskFilter::Create( | 32 paint.setMaskFilter(SkBlurMaskFilter::Make( |
| 33 kNormal_SkBlurStyle, | 33 kNormal_SkBlurStyle, |
| 34 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)), | 34 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)), |
| 35 SkBlurMaskFilter::kHighQuality_BlurFlag); | 35 SkBlurMaskFilter::kHighQuality_BlurFlag)); |
| 36 paint.setMaskFilter(mf)->unref(); | |
| 37 canvas->translate(200, 200); | 36 canvas->translate(200, 200); |
| 38 canvas->drawCircle(100, 100, 200, paint); | 37 canvas->drawCircle(100, 100, 200, paint); |
| 39 canvas->restore(); | 38 canvas->restore(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 typedef SkView INHERITED; | 42 typedef SkView INHERITED; |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 ////////////////////////////////////////////////////////////////////////////// | 45 ////////////////////////////////////////////////////////////////////////////// |
| 47 | 46 |
| 48 static SkView* MyFactory() { return new BigBlurView; } | 47 static SkView* MyFactory() { return new BigBlurView; } |
| 49 static SkViewRegister reg(MyFactory); | 48 static SkViewRegister reg(MyFactory); |
| OLD | NEW |