OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void onDraw(SkCanvas* canvas) override { | 59 void onDraw(SkCanvas* canvas) override { |
60 SkRect srcRect = SkRect::MakeLTRB(0, 0, | 60 SkRect srcRect = SkRect::MakeLTRB(0, 0, |
61 SkIntToScalar(kImageSize), SkIntToScal
ar(kImageSize)); | 61 SkIntToScalar(kImageSize), SkIntToScal
ar(kImageSize)); |
62 SkRect dstRect = SkRect::MakeLTRB(0.75f, 0.75f, 225.75f, 225.75f); | 62 SkRect dstRect = SkRect::MakeLTRB(0.75f, 0.75f, 225.75f, 225.75f); |
63 | 63 |
64 SkAutoTUnref<SkImageFilter> filter(SkBitmapSource::Create(fBM, srcRect,
dstRect, fFilter)); | 64 SkAutoTUnref<SkImageFilter> filter(SkBitmapSource::Create(fBM, srcRect,
dstRect, fFilter)); |
65 | 65 |
66 SkPaint p; | 66 SkPaint p; |
67 p.setImageFilter(filter); | 67 p.setImageFilter(filter); |
68 | 68 |
69 canvas->saveLayer(NULL, &p); | 69 canvas->saveLayer(nullptr, &p); |
70 canvas->restore(); | 70 canvas->restore(); |
71 } | 71 } |
72 | 72 |
73 private: | 73 private: |
74 static const int kImageSize = 503; | 74 static const int kImageSize = 503; |
75 | 75 |
76 SkString fSuffix; | 76 SkString fSuffix; |
77 SkFilterQuality fFilter; | 77 SkFilterQuality fFilter; |
78 SkBitmap fBM; | 78 SkBitmap fBM; |
79 | 79 |
80 typedef GM INHERITED; | 80 typedef GM INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 ////////////////////////////////////////////////////////////////////////////// | 83 ////////////////////////////////////////////////////////////////////////////// |
84 | 84 |
85 DEF_GM(return new BitmapSourceGM("none", kNone_SkFilterQuality);) | 85 DEF_GM(return new BitmapSourceGM("none", kNone_SkFilterQuality);) |
86 DEF_GM(return new BitmapSourceGM("low", kLow_SkFilterQuality);) | 86 DEF_GM(return new BitmapSourceGM("low", kLow_SkFilterQuality);) |
87 DEF_GM(return new BitmapSourceGM("med", kMedium_SkFilterQuality);) | 87 DEF_GM(return new BitmapSourceGM("med", kMedium_SkFilterQuality);) |
88 DEF_GM(return new BitmapSourceGM("high", kHigh_SkFilterQuality);) | 88 DEF_GM(return new BitmapSourceGM("high", kHigh_SkFilterQuality);) |
89 } | 89 } |
OLD | NEW |