| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" |
| 11 #include "SkColorPriv.h" |
| 12 #include "SkGradientShader.h" |
| 9 #include "SkShader.h" | 13 #include "SkShader.h" |
| 10 #include "SkColorPriv.h" | |
| 11 #include "SkBlurMaskFilter.h" | |
| 12 | |
| 13 // effects | |
| 14 #include "SkGradientShader.h" | |
| 15 | |
| 16 | 14 |
| 17 namespace skiagm { | 15 namespace skiagm { |
| 18 | 16 |
| 19 static SkBitmap make_chessbm(int w, int h) { | 17 static SkBitmap make_chessbm(int w, int h) { |
| 20 SkBitmap bm; | 18 SkBitmap bm; |
| 21 bm.setConfig(SkBitmap::kARGB_8888_Config , w, h); | 19 bm.setConfig(SkBitmap::kARGB_8888_Config , w, h); |
| 22 bm.allocPixels(); | 20 bm.allocPixels(); |
| 23 | 21 |
| 24 for (int y = 0; y < bm.height(); y++) { | 22 for (int y = 0; y < bm.height(); y++) { |
| 25 uint32_t* p = bm.getAddr32(0, y); | 23 uint32_t* p = bm.getAddr32(0, y); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // SkGpuDevice::drawPath() -> SkGpuDevice::drawWithMaskFilter() | 160 // SkGpuDevice::drawPath() -> SkGpuDevice::drawWithMaskFilter() |
| 163 SkIRect srcRect; | 161 SkIRect srcRect; |
| 164 SkPaint paint; | 162 SkPaint paint; |
| 165 SkBitmap bm; | 163 SkBitmap bm; |
| 166 | 164 |
| 167 bm = make_chessbm(5, 5); | 165 bm = make_chessbm(5, 5); |
| 168 paint.setFilterBitmap(true); | 166 paint.setFilterBitmap(true); |
| 169 | 167 |
| 170 srcRect.setXYWH(1, 1, 3, 3); | 168 srcRect.setXYWH(1, 1, 3, 3); |
| 171 SkMaskFilter* mf = SkBlurMaskFilter::Create( | 169 SkMaskFilter* mf = SkBlurMaskFilter::Create( |
| 172 5, | |
| 173 SkBlurMaskFilter::kNormal_BlurStyle, | 170 SkBlurMaskFilter::kNormal_BlurStyle, |
| 171 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)), |
| 174 SkBlurMaskFilter::kHighQuality_BlurFlag | | 172 SkBlurMaskFilter::kHighQuality_BlurFlag | |
| 175 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); | 173 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); |
| 176 paint.setMaskFilter(mf)->unref(); | 174 paint.setMaskFilter(mf)->unref(); |
| 177 canvas->drawBitmapRect(bm, &srcRect, dstRect, &paint); | 175 canvas->drawBitmapRect(bm, &srcRect, dstRect, &paint); |
| 178 } | 176 } |
| 179 } | 177 } |
| 180 | 178 |
| 181 private: | 179 private: |
| 182 typedef GM INHERITED; | 180 typedef GM INHERITED; |
| 183 }; | 181 }; |
| 184 | 182 |
| 185 ////////////////////////////////////////////////////////////////////////////// | 183 ////////////////////////////////////////////////////////////////////////////// |
| 186 | 184 |
| 187 #ifndef SK_BUILD_FOR_ANDROID | 185 #ifndef SK_BUILD_FOR_ANDROID |
| 188 static GM* MyFactory(void*) { return new DrawBitmapRectGM; } | 186 static GM* MyFactory(void*) { return new DrawBitmapRectGM; } |
| 189 static GMRegistry reg(MyFactory); | 187 static GMRegistry reg(MyFactory); |
| 190 #endif | 188 #endif |
| 191 } | 189 } |
| OLD | NEW |