| 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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 REPORTER_ASSERT(reporter, info0.fPreMat.isIdentity()); | 1004 REPORTER_ASSERT(reporter, info0.fPreMat.isIdentity()); |
| 1005 REPORTER_ASSERT(reporter, 0 == info0.fBounds.fLeft && 0 == info0.fBounds
.fTop); | 1005 REPORTER_ASSERT(reporter, 0 == info0.fBounds.fLeft && 0 == info0.fBounds
.fTop); |
| 1006 REPORTER_ASSERT(reporter, NULL != info0.fPaint); | 1006 REPORTER_ASSERT(reporter, NULL != info0.fPaint); |
| 1007 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayers); | 1007 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayers); |
| 1008 | 1008 |
| 1009 REPORTER_ASSERT(reporter, NULL == info1.fPicture); | 1009 REPORTER_ASSERT(reporter, NULL == info1.fPicture); |
| 1010 REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.width() && | 1010 REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.width() && |
| 1011 kHeight/2.0 == info1.fBounds.height()); | 1011 kHeight/2.0 == info1.fBounds.height()); |
| 1012 REPORTER_ASSERT(reporter, info1.fLocalMat.isIdentity()); | 1012 REPORTER_ASSERT(reporter, info1.fLocalMat.isIdentity()); |
| 1013 REPORTER_ASSERT(reporter, info1.fPreMat.isIdentity()); | 1013 REPORTER_ASSERT(reporter, info1.fPreMat.isIdentity()); |
| 1014 REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.fLeft && | 1014 REPORTER_ASSERT(reporter, kWidth/2.0 == info1.fBounds.fLeft && |
| 1015 kHeight/2.0 == info1.fBounds.fTop); | 1015 kHeight/2.0 == info1.fBounds.fTop); |
| 1016 REPORTER_ASSERT(reporter, NULL == info1.fPaint); | 1016 REPORTER_ASSERT(reporter, NULL == info1.fPaint); |
| 1017 REPORTER_ASSERT(reporter, !info1.fIsNested && | 1017 REPORTER_ASSERT(reporter, !info1.fIsNested && |
| 1018 info1.fHasNestedLayers); // has a nested SL | 1018 info1.fHasNestedLayers); // has a nested SL |
| 1019 | 1019 |
| 1020 REPORTER_ASSERT(reporter, NULL == info2.fPicture); | 1020 REPORTER_ASSERT(reporter, NULL == info2.fPicture); |
| 1021 REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.width() && | 1021 REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.width() && |
| 1022 kHeight / 2 == info2.fBounds.height()); // bou
nd reduces size | 1022 kHeight / 2 == info2.fBounds.height()); // bou
nd reduces size |
| 1023 REPORTER_ASSERT(reporter, !info2.fLocalMat.isIdentity()); | 1023 REPORTER_ASSERT(reporter, !info2.fLocalMat.isIdentity()); |
| 1024 REPORTER_ASSERT(reporter, info2.fPreMat.isIdentity()); | 1024 REPORTER_ASSERT(reporter, info2.fPreMat.isIdentity()); |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 SkPictureRecorder recorder; | 1726 SkPictureRecorder recorder; |
| 1727 | 1727 |
| 1728 recorder.beginRecording(0, 0); | 1728 recorder.beginRecording(0, 0); |
| 1729 SkAutoTUnref<SkPicture> empty(recorder.endRecording()); | 1729 SkAutoTUnref<SkPicture> empty(recorder.endRecording()); |
| 1730 | 1730 |
| 1731 // Sanity check to make sure we aren't under-measuring. | 1731 // Sanity check to make sure we aren't under-measuring. |
| 1732 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
>= | 1732 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
>= |
| 1733 sizeof(SkPicture) + sizeof(SkRecord)); | 1733 sizeof(SkPicture) + sizeof(SkRecord)); |
| 1734 | 1734 |
| 1735 // Protect against any unintentional bloat. | 1735 // Protect against any unintentional bloat. |
| 1736 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
<= 144); | 1736 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
<= 128); |
| 1737 | 1737 |
| 1738 // Sanity check of nested SkPictures. | 1738 // Sanity check of nested SkPictures. |
| 1739 SkPictureRecorder r2; | 1739 SkPictureRecorder r2; |
| 1740 r2.beginRecording(0, 0); | 1740 r2.beginRecording(0, 0); |
| 1741 r2.getRecordingCanvas()->drawPicture(empty.get()); | 1741 r2.getRecordingCanvas()->drawPicture(empty.get()); |
| 1742 SkAutoTUnref<SkPicture> nested(r2.endRecording()); | 1742 SkAutoTUnref<SkPicture> nested(r2.endRecording()); |
| 1743 | 1743 |
| 1744 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(nested.get())
> | 1744 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(nested.get())
> |
| 1745 SkPictureUtils::ApproximateBytesUsed(empty.get()))
; | 1745 SkPictureUtils::ApproximateBytesUsed(empty.get()))
; |
| 1746 } | 1746 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 1913 |
| 1914 // The picture shares the immutable pixels but copies the mutable ones. | 1914 // The picture shares the immutable pixels but copies the mutable ones. |
| 1915 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1915 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
| 1916 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1916 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
| 1917 | 1917 |
| 1918 // When the picture goes away, it's just our bitmaps holding the refs. | 1918 // When the picture goes away, it's just our bitmaps holding the refs. |
| 1919 pic.reset(NULL); | 1919 pic.reset(NULL); |
| 1920 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1920 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
| 1921 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1921 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
| 1922 } | 1922 } |
| OLD | NEW |