| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 50         canvas->drawPaint(paint); | 50         canvas->drawPaint(paint); | 
| 51         canvas->restore(); | 51         canvas->restore(); | 
| 52     } | 52     } | 
| 53 | 53 | 
| 54     void onDraw(SkCanvas* canvas) override { | 54     void onDraw(SkCanvas* canvas) override { | 
| 55         canvas->clear(SK_ColorBLACK); | 55         canvas->clear(SK_ColorBLACK); | 
| 56         { | 56         { | 
| 57             SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); | 57             SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); | 
| 58             SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0); | 58             SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0); | 
| 59             SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); | 59             SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); | 
| 60             SkAutoTUnref<SkImageFilter> pictureSource( | 60             SkAutoTUnref<SkPictureImageFilter> pictureSource( | 
| 61                 SkPictureImageFilter::Create(fPicture)); | 61                 SkPictureImageFilter::Create(fPicture)); | 
| 62             SkAutoTUnref<SkImageFilter> pictureSourceSrcRect( | 62             SkAutoTUnref<SkPictureImageFilter> pictureSourceSrcRect( | 
| 63                 SkPictureImageFilter::Create(fPicture, srcRect)); | 63                 SkPictureImageFilter::Create(fPicture, srcRect)); | 
| 64             SkAutoTUnref<SkImageFilter> pictureSourceEmptyRect( | 64             SkAutoTUnref<SkPictureImageFilter> pictureSourceEmptyRect( | 
| 65                 SkPictureImageFilter::Create(fPicture, emptyRect)); | 65                 SkPictureImageFilter::Create(fPicture, emptyRect)); | 
| 66             SkAutoTUnref<SkImageFilter> pictureSourceResampled( | 66             SkAutoTUnref<SkPictureImageFilter> pictureSourceResampled( | 
| 67                 SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cu
     llRect(), | 67                 SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cu
     llRect(), | 
| 68                     kLow_SkFilterQuality)); | 68                     kLow_SkFilterQuality)); | 
| 69             SkAutoTUnref<SkImageFilter> pictureSourcePixelated( | 69             SkAutoTUnref<SkPictureImageFilter> pictureSourcePixelated( | 
| 70                 SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cu
     llRect(), | 70                 SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cu
     llRect(), | 
| 71                     kNone_SkFilterQuality)); | 71                     kNone_SkFilterQuality)); | 
| 72 | 72 | 
| 73             canvas->save(); | 73             canvas->save(); | 
| 74             // Draw the picture unscaled. | 74             // Draw the picture unscaled. | 
| 75             fillRectFiltered(canvas, bounds, pictureSource); | 75             fillRectFiltered(canvas, bounds, pictureSource); | 
| 76             canvas->translate(SkIntToScalar(100), 0); | 76             canvas->translate(SkIntToScalar(100), 0); | 
| 77 | 77 | 
| 78             // Draw an unscaled subset of the source picture. | 78             // Draw an unscaled subset of the source picture. | 
| 79             fillRectFiltered(canvas, bounds, pictureSourceSrcRect); | 79             fillRectFiltered(canvas, bounds, pictureSourceSrcRect); | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 102     } | 102     } | 
| 103 | 103 | 
| 104 private: | 104 private: | 
| 105     SkAutoTUnref<SkPicture> fPicture; | 105     SkAutoTUnref<SkPicture> fPicture; | 
| 106     typedef GM INHERITED; | 106     typedef GM INHERITED; | 
| 107 }; | 107 }; | 
| 108 | 108 | 
| 109 /////////////////////////////////////////////////////////////////////////////// | 109 /////////////////////////////////////////////////////////////////////////////// | 
| 110 | 110 | 
| 111 DEF_GM( return new PictureImageFilterGM; ) | 111 DEF_GM( return new PictureImageFilterGM; ) | 
| OLD | NEW | 
|---|