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 "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 p.setStyle(SkPaint::kFill_Style); | 136 p.setStyle(SkPaint::kFill_Style); |
137 } | 137 } |
138 | 138 |
139 p.setColor(0x660000FF); | 139 p.setColor(0x660000FF); |
140 canvas->drawRect(r, p); | 140 canvas->drawRect(r, p); |
141 | 141 |
142 if (clipR) { | 142 if (clipR) { |
143 canvas->save(); | 143 canvas->save(); |
144 canvas->clipRect(*clipR); | 144 canvas->clipRect(*clipR); |
145 } | 145 } |
146 p.setImageFilter(imgf); | 146 if (imgf) { |
| 147 p.setImageFilter(imgf)->unref(); |
| 148 } |
147 p.setColor(0x66FF0000); | 149 p.setColor(0x66FF0000); |
148 canvas->drawRect(r, p); | 150 canvas->drawRect(r, p); |
149 | 151 |
150 if (clipR) { | 152 if (clipR) { |
151 canvas->restore(); | 153 canvas->restore(); |
152 } | 154 } |
153 } | 155 } |
154 | 156 |
155 void onDraw(SkCanvas* canvas) override { | 157 void onDraw(SkCanvas* canvas) override { |
156 const SkRect r = SkRect::MakeWH(10, 10); | 158 const SkRect r = SkRect::MakeWH(10, 10); |
(...skipping 22 matching lines...) Expand all Loading... |
179 this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, NULL), &
clipR); | 181 this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, NULL), &
clipR); |
180 | 182 |
181 canvas->translate(20, 0); | 183 canvas->translate(20, 0); |
182 this->doDraw(canvas, r, SkOffsetImageFilter::Create(10, 0, NULL, &cr2),
NULL); | 184 this->doDraw(canvas, r, SkOffsetImageFilter::Create(10, 0, NULL, &cr2),
NULL); |
183 } | 185 } |
184 | 186 |
185 private: | 187 private: |
186 typedef skiagm::GM INHERITED; | 188 typedef skiagm::GM INHERITED; |
187 }; | 189 }; |
188 DEF_GM( return new SimpleOffsetImageFilterGM; ) | 190 DEF_GM( return new SimpleOffsetImageFilterGM; ) |
OLD | NEW |