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 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 // intead of a dark red. | 1858 // intead of a dark red. |
1859 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); | 1859 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); |
1860 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); | 1860 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); |
1861 } | 1861 } |
1862 | 1862 |
1863 struct CountingBBH : public SkBBoxHierarchy { | 1863 struct CountingBBH : public SkBBoxHierarchy { |
1864 mutable int searchCalls; | 1864 mutable int searchCalls; |
1865 | 1865 |
1866 CountingBBH() : searchCalls(0) {} | 1866 CountingBBH() : searchCalls(0) {} |
1867 | 1867 |
1868 virtual void search(const SkRect& query, SkTDArray<void*>* results) const { | 1868 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE { |
1869 this->searchCalls++; | 1869 this->searchCalls++; |
1870 } | 1870 } |
1871 | 1871 |
1872 // All other methods unimplemented. | 1872 // All other methods unimplemented. |
1873 virtual void insert(void* data, const SkRect& bounds, bool defer) {} | 1873 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer) SK_O
VERRIDE {} |
1874 virtual void flushDeferredInserts() {} | 1874 virtual void flushDeferredInserts() SK_OVERRIDE {} |
1875 virtual void clear() {} | 1875 virtual void clear() SK_OVERRIDE {} |
1876 virtual int getCount() const { return 0; } | 1876 virtual int getCount() const SK_OVERRIDE { return 0; } |
1877 virtual int getDepth() const { return 0; } | 1877 virtual int getDepth() const SK_OVERRIDE { return 0; } |
1878 virtual void rewindInserts() {} | |
1879 }; | 1878 }; |
1880 | 1879 |
1881 class SpoonFedBBHFactory : public SkBBHFactory { | 1880 class SpoonFedBBHFactory : public SkBBHFactory { |
1882 public: | 1881 public: |
1883 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} | 1882 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} |
1884 virtual SkBBoxHierarchy* operator()(int width, int height) const { | 1883 virtual SkBBoxHierarchy* operator()(int width, int height) const { |
1885 return SkRef(fBBH); | 1884 return SkRef(fBBH); |
1886 } | 1885 } |
1887 private: | 1886 private: |
1888 SkBBoxHierarchy* fBBH; | 1887 SkBBoxHierarchy* fBBH; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 | 1925 |
1927 // The picture shares the immutable pixels but copies the mutable ones. | 1926 // The picture shares the immutable pixels but copies the mutable ones. |
1928 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1927 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1929 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1928 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1930 | 1929 |
1931 // When the picture goes away, it's just our bitmaps holding the refs. | 1930 // When the picture goes away, it's just our bitmaps holding the refs. |
1932 pic.reset(NULL); | 1931 pic.reset(NULL); |
1933 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1932 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1934 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1933 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1935 } | 1934 } |
OLD | NEW |