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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 TestImages(reporter); | 459 TestImages(reporter); |
460 } | 460 } |
461 | 461 |
462 namespace { | 462 namespace { |
463 | 463 |
464 class DummyImageFilter : public SkImageFilter { | 464 class DummyImageFilter : public SkImageFilter { |
465 public: | 465 public: |
466 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} | 466 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} |
467 ~DummyImageFilter() SK_OVERRIDE {} | 467 ~DummyImageFilter() SK_OVERRIDE {} |
468 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 468 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
469 SkBitmap* result, SkIPoint* offset) const { | 469 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { |
470 fVisited = true; | 470 fVisited = true; |
471 offset->fX = offset->fY = 0; | 471 offset->fX = offset->fY = 0; |
472 *result = src; | 472 *result = src; |
473 return true; | 473 return true; |
474 } | 474 } |
475 SK_TO_STRING_OVERRIDE() | 475 SK_TO_STRING_OVERRIDE() |
476 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) | 476 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
477 bool visited() const { return fVisited; } | 477 bool visited() const { return fVisited; } |
478 | 478 |
479 private: | 479 private: |
(...skipping 25 matching lines...) Expand all Loading... |
505 | 505 |
506 // Filter just created; should be unvisited. | 506 // Filter just created; should be unvisited. |
507 REPORTER_ASSERT(reporter, !filter->visited()); | 507 REPORTER_ASSERT(reporter, !filter->visited()); |
508 SkPaint paint; | 508 SkPaint paint; |
509 paint.setImageFilter(filter.get()); | 509 paint.setImageFilter(filter.get()); |
510 canvas.drawRect(SkRect::MakeWH(100, 100), paint); | 510 canvas.drawRect(SkRect::MakeWH(100, 100), paint); |
511 | 511 |
512 // Filter was used in rendering; should be visited. | 512 // Filter was used in rendering; should be visited. |
513 REPORTER_ASSERT(reporter, filter->visited()); | 513 REPORTER_ASSERT(reporter, filter->visited()); |
514 } | 514 } |
OLD | NEW |