| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} | 437 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} |
| 438 virtual ~DummyImageFilter() SK_OVERRIDE {} | 438 virtual ~DummyImageFilter() SK_OVERRIDE {} |
| 439 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 439 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
| 440 SkBitmap* result, SkIPoint* offset) const { | 440 SkBitmap* result, SkIPoint* offset) const { |
| 441 fVisited = true; | 441 fVisited = true; |
| 442 offset->fX = offset->fY = 0; | 442 offset->fX = offset->fY = 0; |
| 443 *result = src; | 443 *result = src; |
| 444 return true; | 444 return true; |
| 445 } | 445 } |
| 446 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) | 446 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
| 447 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
| 448 explicit DummyImageFilter(SkReadBuffer& buffer) : SkImageFilter(0, NULL) { | |
| 449 fVisited = buffer.readBool(); | |
| 450 } | |
| 451 #endif | |
| 452 bool visited() const { return fVisited; } | 447 bool visited() const { return fVisited; } |
| 453 | 448 |
| 454 private: | 449 private: |
| 455 mutable bool fVisited; | 450 mutable bool fVisited; |
| 456 }; | 451 }; |
| 457 | 452 |
| 458 SkFlattenable* DummyImageFilter::CreateProc(SkReadBuffer& buffer) { | 453 SkFlattenable* DummyImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 459 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); | 454 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); |
| 460 bool visited = buffer.readBool(); | 455 bool visited = buffer.readBool(); |
| 461 return SkNEW_ARGS(DummyImageFilter, (visited)); | 456 return SkNEW_ARGS(DummyImageFilter, (visited)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 473 | 468 |
| 474 // Filter just created; should be unvisited. | 469 // Filter just created; should be unvisited. |
| 475 REPORTER_ASSERT(reporter, !filter->visited()); | 470 REPORTER_ASSERT(reporter, !filter->visited()); |
| 476 SkPaint paint; | 471 SkPaint paint; |
| 477 paint.setImageFilter(filter.get()); | 472 paint.setImageFilter(filter.get()); |
| 478 canvas.drawRect(SkRect::MakeWH(100, 100), paint); | 473 canvas.drawRect(SkRect::MakeWH(100, 100), paint); |
| 479 | 474 |
| 480 // Filter was used in rendering; should be visited. | 475 // Filter was used in rendering; should be visited. |
| 481 REPORTER_ASSERT(reporter, filter->visited()); | 476 REPORTER_ASSERT(reporter, filter->visited()); |
| 482 } | 477 } |
| OLD | NEW |