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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 test_issue1083(); | 311 test_issue1083(); |
312 } | 312 } |
313 | 313 |
314 namespace { | 314 namespace { |
315 | 315 |
316 class DummyImageFilter : public SkImageFilter { | 316 class DummyImageFilter : public SkImageFilter { |
317 public: | 317 public: |
318 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} | 318 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi
sited) {} |
319 ~DummyImageFilter() SK_OVERRIDE {} | 319 ~DummyImageFilter() SK_OVERRIDE {} |
320 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 320 virtual bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
321 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 321 SkAutoTUnref<const SkImage>& result, |
| 322 SkIPoint* offset) const SK_OVERRIDE { |
322 fVisited = true; | 323 fVisited = true; |
323 offset->fX = offset->fY = 0; | 324 offset->fX = offset->fY = 0; |
324 *result = src; | 325 result.reset(SkRef(src)); |
325 return true; | 326 return true; |
326 } | 327 } |
327 SK_TO_STRING_OVERRIDE() | 328 SK_TO_STRING_OVERRIDE() |
328 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) | 329 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
329 bool visited() const { return fVisited; } | 330 bool visited() const { return fVisited; } |
330 | 331 |
331 private: | 332 private: |
332 mutable bool fVisited; | 333 mutable bool fVisited; |
333 }; | 334 }; |
334 | 335 |
(...skipping 24 matching lines...) Expand all Loading... |
359 // Filter just created; should be unvisited. | 360 // Filter just created; should be unvisited. |
360 REPORTER_ASSERT(reporter, !filter->visited()); | 361 REPORTER_ASSERT(reporter, !filter->visited()); |
361 SkPaint paint; | 362 SkPaint paint; |
362 paint.setImageFilter(filter.get()); | 363 paint.setImageFilter(filter.get()); |
363 canvas->drawRect(SkRect::MakeWH(100, 100), paint); | 364 canvas->drawRect(SkRect::MakeWH(100, 100), paint); |
364 doc->close(); | 365 doc->close(); |
365 | 366 |
366 // Filter was used in rendering; should be visited. | 367 // Filter was used in rendering; should be visited. |
367 REPORTER_ASSERT(reporter, filter->visited()); | 368 REPORTER_ASSERT(reporter, filter->visited()); |
368 } | 369 } |
OLD | NEW |