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