| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
| 10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 ImageFilterFastBoundGM() { | 152 ImageFilterFastBoundGM() { |
| 153 this->setBGColor(0xFFCCCCCC); | 153 this->setBGColor(0xFFCCCCCC); |
| 154 } | 154 } |
| 155 | 155 |
| 156 protected: | 156 protected: |
| 157 static const int kTileWidth = 100; | 157 static const int kTileWidth = 100; |
| 158 static const int kTileHeight = 100; | 158 static const int kTileHeight = 100; |
| 159 static const int kNumVertTiles = 6; | 159 static const int kNumVertTiles = 6; |
| 160 static const int kNumXtraCols = 2; | 160 static const int kNumXtraCols = 2; |
| 161 | 161 |
| 162 SkString onShortName() SK_OVERRIDE{ return SkString("filterfastbounds"); } | 162 SkString onShortName() override{ return SkString("filterfastbounds"); } |
| 163 | 163 |
| 164 SkISize onISize() SK_OVERRIDE{ | 164 SkISize onISize() override{ |
| 165 return SkISize::Make((SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols) * kTile
Width, | 165 return SkISize::Make((SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols) * kTile
Width, |
| 166 kNumVertTiles * kTileHeight); | 166 kNumVertTiles * kTileHeight); |
| 167 } | 167 } |
| 168 | 168 |
| 169 static void draw_geom_with_paint(drawMth draw, const SkIPoint& off, | 169 static void draw_geom_with_paint(drawMth draw, const SkIPoint& off, |
| 170 SkCanvas* canvas, const SkPaint& p) { | 170 SkCanvas* canvas, const SkPaint& p) { |
| 171 SkPaint redStroked; | 171 SkPaint redStroked; |
| 172 redStroked.setColor(SK_ColorRED); | 172 redStroked.setColor(SK_ColorRED); |
| 173 redStroked.setStyle(SkPaint::kStroke_Style); | 173 redStroked.setStyle(SkPaint::kStroke_Style); |
| 174 | 174 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const SkRect& fastBound = p.computeFastBounds(bounds, &storage); | 217 const SkRect& fastBound = p.computeFastBounds(bounds, &storage); |
| 218 | 218 |
| 219 canvas->saveLayer(&fastBound, &p); | 219 canvas->saveLayer(&fastBound, &p); |
| 220 canvas->restore(); | 220 canvas->restore(); |
| 221 | 221 |
| 222 canvas->drawRect(bounds, redStroked); | 222 canvas->drawRect(bounds, redStroked); |
| 223 canvas->drawRect(fastBound, blueStroked); | 223 canvas->drawRect(fastBound, blueStroked); |
| 224 canvas->restore(); | 224 canvas->restore(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void onDraw(SkCanvas* canvas) SK_OVERRIDE{ | 227 void onDraw(SkCanvas* canvas) override{ |
| 228 | 228 |
| 229 SkPaint blackFill; | 229 SkPaint blackFill; |
| 230 | 230 |
| 231 //----------- | 231 //----------- |
| 232 // Normal paints (no source) | 232 // Normal paints (no source) |
| 233 SkTArray<SkPaint> paints; | 233 SkTArray<SkPaint> paints; |
| 234 create_paints(NULL, &paints); | 234 create_paints(NULL, &paints); |
| 235 | 235 |
| 236 //----------- | 236 //----------- |
| 237 // Paints with a PictureImageFilter as a source | 237 // Paints with a PictureImageFilter as a source |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 private: | 318 private: |
| 319 typedef GM INHERITED; | 319 typedef GM INHERITED; |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 ////////////////////////////////////////////////////////////////////////////// | 322 ////////////////////////////////////////////////////////////////////////////// |
| 323 | 323 |
| 324 DEF_GM(return SkNEW(ImageFilterFastBoundGM);) | 324 DEF_GM(return SkNEW(ImageFilterFastBoundGM);) |
| 325 | 325 |
| 326 } | 326 } |
| OLD | NEW |