| 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 | 9 |
| 10 #include "SkPictureImageFilter.h" | 10 #include "SkPictureImageFilter.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 canvas->drawPaint(paint); | 47 canvas->drawPaint(paint); |
| 48 canvas->restore(); | 48 canvas->restore(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 51 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 52 canvas->clear(0x00000000); | 52 canvas->clear(0x00000000); |
| 53 { | 53 { |
| 54 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); | 54 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); |
| 55 SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0); | 55 SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0); |
| 56 SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); | 56 SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); |
| 57 SkAutoTUnref<SkImageFilter> pictureSource(new SkPictureImageFilter(&
fPicture)); | 57 SkAutoTUnref<SkImageFilter> pictureSource(SkPictureImageFilter::Crea
te(&fPicture)); |
| 58 SkAutoTUnref<SkImageFilter> pictureSourceSrcRect(new SkPictureImageF
ilter(&fPicture, srcRect)); | 58 SkAutoTUnref<SkImageFilter> pictureSourceSrcRect(SkPictureImageFilte
r::Create(&fPicture, srcRect)); |
| 59 SkAutoTUnref<SkImageFilter> pictureSourceEmptyRect(new SkPictureImag
eFilter(&fPicture, emptyRect)); | 59 SkAutoTUnref<SkImageFilter> pictureSourceEmptyRect(SkPictureImageFil
ter::Create(&fPicture, emptyRect)); |
| 60 | 60 |
| 61 // Draw the picture unscaled. | 61 // Draw the picture unscaled. |
| 62 fillRectFiltered(canvas, bounds, pictureSource); | 62 fillRectFiltered(canvas, bounds, pictureSource); |
| 63 canvas->translate(SkIntToScalar(100), 0); | 63 canvas->translate(SkIntToScalar(100), 0); |
| 64 | 64 |
| 65 // Draw an unscaled subset of the source picture. | 65 // Draw an unscaled subset of the source picture. |
| 66 fillRectFiltered(canvas, bounds, pictureSourceSrcRect); | 66 fillRectFiltered(canvas, bounds, pictureSourceSrcRect); |
| 67 canvas->translate(SkIntToScalar(100), 0); | 67 canvas->translate(SkIntToScalar(100), 0); |
| 68 | 68 |
| 69 // Draw the picture to an empty rect (should draw nothing). | 69 // Draw the picture to an empty rect (should draw nothing). |
| (...skipping 12 matching lines...) Expand all Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 SkPicture fPicture; | 85 SkPicture fPicture; |
| 86 typedef GM INHERITED; | 86 typedef GM INHERITED; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
| 90 | 90 |
| 91 DEF_GM( return new PictureImageFilterGM; ) | 91 DEF_GM( return new PictureImageFilterGM; ) |
| OLD | NEW |