OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 TestSubstitute(reporter); | 291 TestSubstitute(reporter); |
292 | 292 |
293 test_issue1083(); | 293 test_issue1083(); |
294 } | 294 } |
295 | 295 |
296 namespace { | 296 namespace { |
297 | 297 |
298 class DummyImageFilter : public SkImageFilter { | 298 class DummyImageFilter : public SkImageFilter { |
299 public: | 299 public: |
300 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} | 300 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} |
301 ~DummyImageFilter() SK_OVERRIDE {} | 301 ~DummyImageFilter() override {} |
302 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 302 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
303 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 303 SkBitmap* result, SkIPoint* offset) const overrid
e { |
304 fVisited = true; | 304 fVisited = true; |
305 offset->fX = offset->fY = 0; | 305 offset->fX = offset->fY = 0; |
306 *result = src; | 306 *result = src; |
307 return true; | 307 return true; |
308 } | 308 } |
309 SK_TO_STRING_OVERRIDE() | 309 SK_TO_STRING_OVERRIDE() |
310 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) | 310 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
311 bool visited() const { return fVisited; } | 311 bool visited() const { return fVisited; } |
312 | 312 |
313 private: | 313 private: |
(...skipping 27 matching lines...) Expand all Loading... |
341 // Filter just created; should be unvisited. | 341 // Filter just created; should be unvisited. |
342 REPORTER_ASSERT(reporter, !filter->visited()); | 342 REPORTER_ASSERT(reporter, !filter->visited()); |
343 SkPaint paint; | 343 SkPaint paint; |
344 paint.setImageFilter(filter.get()); | 344 paint.setImageFilter(filter.get()); |
345 canvas->drawRect(SkRect::MakeWH(100, 100), paint); | 345 canvas->drawRect(SkRect::MakeWH(100, 100), paint); |
346 doc->close(); | 346 doc->close(); |
347 | 347 |
348 // Filter was used in rendering; should be visited. | 348 // Filter was used in rendering; should be visited. |
349 REPORTER_ASSERT(reporter, filter->visited()); | 349 REPORTER_ASSERT(reporter, filter->visited()); |
350 } | 350 } |
OLD | NEW |