| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 // intead of a dark red. | 1801 // intead of a dark red. |
| 1802 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); | 1802 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); |
| 1803 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); | 1803 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 struct CountingBBH : public SkBBoxHierarchy { | 1806 struct CountingBBH : public SkBBoxHierarchy { |
| 1807 mutable int searchCalls; | 1807 mutable int searchCalls; |
| 1808 | 1808 |
| 1809 CountingBBH() : searchCalls(0) {} | 1809 CountingBBH() : searchCalls(0) {} |
| 1810 | 1810 |
| 1811 virtual void search(const SkIRect& query, SkTDArray<void*>* results) const { | 1811 virtual void search(const SkRect& query, SkTDArray<void*>* results) const { |
| 1812 this->searchCalls++; | 1812 this->searchCalls++; |
| 1813 } | 1813 } |
| 1814 | 1814 |
| 1815 // All other methods unimplemented. | 1815 // All other methods unimplemented. |
| 1816 virtual void insert(void* data, const SkIRect& bounds, bool defer) {} | 1816 virtual void insert(void* data, const SkRect& bounds, bool defer) {} |
| 1817 virtual void flushDeferredInserts() {} | 1817 virtual void flushDeferredInserts() {} |
| 1818 virtual void clear() {} | 1818 virtual void clear() {} |
| 1819 virtual int getCount() const { return 0; } | 1819 virtual int getCount() const { return 0; } |
| 1820 virtual int getDepth() const { return 0; } | 1820 virtual int getDepth() const { return 0; } |
| 1821 virtual void rewindInserts() {} | 1821 virtual void rewindInserts() {} |
| 1822 }; | 1822 }; |
| 1823 | 1823 |
| 1824 class SpoonFedBBHFactory : public SkBBHFactory { | 1824 class SpoonFedBBHFactory : public SkBBHFactory { |
| 1825 public: | 1825 public: |
| 1826 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} | 1826 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1841 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); | 1841 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
| 1842 | 1842 |
| 1843 SkCanvas big(640, 480), small(300, 200); | 1843 SkCanvas big(640, 480), small(300, 200); |
| 1844 | 1844 |
| 1845 picture->draw(&big); | 1845 picture->draw(&big); |
| 1846 REPORTER_ASSERT(r, bbh.searchCalls == 0); | 1846 REPORTER_ASSERT(r, bbh.searchCalls == 0); |
| 1847 | 1847 |
| 1848 picture->draw(&small); | 1848 picture->draw(&small); |
| 1849 REPORTER_ASSERT(r, bbh.searchCalls == 1); | 1849 REPORTER_ASSERT(r, bbh.searchCalls == 1); |
| 1850 } | 1850 } |
| OLD | NEW |