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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkColorFilterImageFilter.h" | 9 #include "SkColorFilterImageFilter.h" |
10 #include "SkColorMatrixFilter.h" | 10 #include "SkColorMatrixFilter.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 canvas->clear(SK_ColorBLACK); | 49 canvas->clear(SK_ColorBLACK); |
50 SkPaint red; | 50 SkPaint red; |
51 red.setColor(SK_ColorRED); | 51 red.setColor(SK_ColorRED); |
52 red.setStyle(SkPaint::kStroke_Style); | 52 red.setStyle(SkPaint::kStroke_Style); |
53 SkPaint blue; | 53 SkPaint blue; |
54 blue.setColor(SK_ColorBLUE); | 54 blue.setColor(SK_ColorBLUE); |
55 blue.setStyle(SkPaint::kStroke_Style); | 55 blue.setStyle(SkPaint::kStroke_Style); |
56 | 56 |
57 int x = 0, y = 0; | 57 int x = 0, y = 0; |
58 for (size_t i = 0; i < 4; i++) { | 58 for (size_t i = 0; i < 4; i++) { |
59 const SkImage* image = (i & 0x01) ? fCheckerboard.get() : fBitmap.ge
t(); | 59 SkImage* image = (i & 0x01) ? fCheckerboard.get() : fBitmap.get(); |
60 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(image->width()/4), | 60 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(image->width()/4), |
61 SkIntToScalar(image->height()/4), | 61 SkIntToScalar(image->height()/4), |
62 SkIntToScalar(image->width()/(i+1)
), | 62 SkIntToScalar(image->width()/(i+1)
), |
63 SkIntToScalar(image->height()/(i+1
))); | 63 SkIntToScalar(image->height()/(i+1
))); |
64 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(i * 8), | 64 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(i * 8), |
65 SkIntToScalar(i * 4), | 65 SkIntToScalar(i * 4), |
66 SkIntToScalar(image->width() - i *
12), | 66 SkIntToScalar(image->width() - i *
12), |
67 SkIntToScalar(image->height()) - i
* 12); | 67 SkIntToScalar(image->height()) - i
* 12); |
68 SkAutoTUnref<SkImageFilter> tileInput(SkImageSource::Create(image)); | 68 SkAutoTUnref<SkImageFilter> tileInput(SkImageSource::Create(image)); |
69 SkAutoTUnref<SkImageFilter> filter( | 69 SkAutoTUnref<SkImageFilter> filter( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 private: | 111 private: |
112 sk_sp<SkImage> fBitmap, fCheckerboard; | 112 sk_sp<SkImage> fBitmap, fCheckerboard; |
113 | 113 |
114 typedef GM INHERITED; | 114 typedef GM INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
118 | 118 |
119 DEF_GM(return new TileImageFilterGM;) | 119 DEF_GM(return new TileImageFilterGM;) |
120 } | 120 } |
OLD | NEW |