| 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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 , fSaveLayerCount(0) | 1158 , fSaveLayerCount(0) |
| 1159 , fRestoreCount(0){ | 1159 , fRestoreCount(0){ |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint*
paint, | 1162 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint*
paint, |
| 1163 SaveFlags flags) SK_OVERRIDE { | 1163 SaveFlags flags) SK_OVERRIDE { |
| 1164 ++fSaveLayerCount; | 1164 ++fSaveLayerCount; |
| 1165 return this->INHERITED::willSaveLayer(bounds, paint, flags); | 1165 return this->INHERITED::willSaveLayer(bounds, paint, flags); |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 virtual void willSave() SK_OVERRIDE { | 1168 void willSave() SK_OVERRIDE { |
| 1169 ++fSaveCount; | 1169 ++fSaveCount; |
| 1170 this->INHERITED::willSave(); | 1170 this->INHERITED::willSave(); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 virtual void willRestore() SK_OVERRIDE { | 1173 void willRestore() SK_OVERRIDE { |
| 1174 ++fRestoreCount; | 1174 ++fRestoreCount; |
| 1175 this->INHERITED::willRestore(); | 1175 this->INHERITED::willRestore(); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 unsigned int getSaveCount() const { return fSaveCount; } | 1178 unsigned int getSaveCount() const { return fSaveCount; } |
| 1179 unsigned int getSaveLayerCount() const { return fSaveLayerCount; } | 1179 unsigned int getSaveLayerCount() const { return fSaveLayerCount; } |
| 1180 unsigned int getRestoreCount() const { return fRestoreCount; } | 1180 unsigned int getRestoreCount() const { return fRestoreCount; } |
| 1181 | 1181 |
| 1182 private: | 1182 private: |
| 1183 unsigned int fSaveCount; | 1183 unsigned int fSaveCount; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 this->INHERITED::onClipRRect(rrect, op, edgeStyle); | 1630 this->INHERITED::onClipRRect(rrect, op, edgeStyle); |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 virtual void onClipPath(const SkPath& path, | 1633 virtual void onClipPath(const SkPath& path, |
| 1634 SkRegion::Op op, | 1634 SkRegion::Op op, |
| 1635 ClipEdgeStyle edgeStyle) SK_OVERRIDE { | 1635 ClipEdgeStyle edgeStyle) SK_OVERRIDE { |
| 1636 fClipCount += 1; | 1636 fClipCount += 1; |
| 1637 this->INHERITED::onClipPath(path, op, edgeStyle); | 1637 this->INHERITED::onClipPath(path, op, edgeStyle); |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVE
RRIDE { | 1640 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVERRIDE { |
| 1641 fClipCount += 1; | 1641 fClipCount += 1; |
| 1642 this->INHERITED::onClipRegion(deviceRgn, op); | 1642 this->INHERITED::onClipRegion(deviceRgn, op); |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 unsigned getClipCount() const { return fClipCount; } | 1645 unsigned getClipCount() const { return fClipCount; } |
| 1646 | 1646 |
| 1647 private: | 1647 private: |
| 1648 unsigned fClipCount; | 1648 unsigned fClipCount; |
| 1649 | 1649 |
| 1650 typedef SkCanvas INHERITED; | 1650 typedef SkCanvas INHERITED; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 // intead of a dark red. | 1859 // intead of a dark red. |
| 1860 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); | 1860 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); |
| 1861 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); | 1861 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 struct CountingBBH : public SkBBoxHierarchy { | 1864 struct CountingBBH : public SkBBoxHierarchy { |
| 1865 mutable int searchCalls; | 1865 mutable int searchCalls; |
| 1866 | 1866 |
| 1867 CountingBBH() : searchCalls(0) {} | 1867 CountingBBH() : searchCalls(0) {} |
| 1868 | 1868 |
| 1869 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE { | 1869 void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVER
RIDE { |
| 1870 this->searchCalls++; | 1870 this->searchCalls++; |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 virtual void insert(SkAutoTMalloc<SkRect>*, int) SK_OVERRIDE {} | 1873 void insert(SkAutoTMalloc<SkRect>*, int) SK_OVERRIDE {} |
| 1874 virtual size_t bytesUsed() const { return 0; } | 1874 virtual size_t bytesUsed() const { return 0; } |
| 1875 }; | 1875 }; |
| 1876 | 1876 |
| 1877 class SpoonFedBBHFactory : public SkBBHFactory { | 1877 class SpoonFedBBHFactory : public SkBBHFactory { |
| 1878 public: | 1878 public: |
| 1879 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} | 1879 explicit SpoonFedBBHFactory(SkBBoxHierarchy* bbh) : fBBH(bbh) {} |
| 1880 SkBBoxHierarchy* operator()(const SkRect&) const SK_OVERRIDE { | 1880 SkBBoxHierarchy* operator()(const SkRect&) const SK_OVERRIDE { |
| 1881 return SkRef(fBBH); | 1881 return SkRef(fBBH); |
| 1882 } | 1882 } |
| 1883 private: | 1883 private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 | 1927 |
| 1928 // The picture shares the immutable pixels but copies the mutable ones. | 1928 // The picture shares the immutable pixels but copies the mutable ones. |
| 1929 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1929 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
| 1930 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1930 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
| 1931 | 1931 |
| 1932 // When the picture goes away, it's just our bitmaps holding the refs. | 1932 // When the picture goes away, it's just our bitmaps holding the refs. |
| 1933 pic.reset(NULL); | 1933 pic.reset(NULL); |
| 1934 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1934 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
| 1935 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1935 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
| 1936 } | 1936 } |
| OLD | NEW |