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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 // Protect against any unintentional bloat. | 1120 // Protect against any unintentional bloat. |
1121 size_t approxUsed = SkPictureUtils::ApproximateBytesUsed(empty.get()); | 1121 size_t approxUsed = SkPictureUtils::ApproximateBytesUsed(empty.get()); |
1122 REPORTER_ASSERT(reporter, approxUsed <= 432); | 1122 REPORTER_ASSERT(reporter, approxUsed <= 432); |
1123 | 1123 |
1124 // Sanity check of nested SkPictures. | 1124 // Sanity check of nested SkPictures. |
1125 SkPictureRecorder r2; | 1125 SkPictureRecorder r2; |
1126 r2.beginRecording(0, 0); | 1126 r2.beginRecording(0, 0); |
1127 r2.getRecordingCanvas()->drawPicture(empty.get()); | 1127 r2.getRecordingCanvas()->drawPicture(empty.get()); |
1128 SkAutoTUnref<SkPicture> nested(r2.endRecording()); | 1128 SkAutoTUnref<SkPicture> nested(r2.endRecording()); |
1129 | 1129 |
1130 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(nested.get())
> | 1130 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(nested.get())
>= |
1131 SkPictureUtils::ApproximateBytesUsed(empty.get()))
; | 1131 SkPictureUtils::ApproximateBytesUsed(empty.get()))
; |
1132 } | 1132 } |
1133 | 1133 |
1134 DEF_TEST(Picture, reporter) { | 1134 DEF_TEST(Picture, reporter) { |
1135 #ifdef SK_DEBUG | 1135 #ifdef SK_DEBUG |
1136 test_deleting_empty_picture(); | 1136 test_deleting_empty_picture(); |
1137 test_serializing_empty_picture(); | 1137 test_serializing_empty_picture(); |
1138 #else | 1138 #else |
1139 test_bad_bitmap(); | 1139 test_bad_bitmap(); |
1140 #endif | 1140 #endif |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 DEF_TEST(Picture_getRecordingCanvas, r) { | 1316 DEF_TEST(Picture_getRecordingCanvas, r) { |
1317 SkPictureRecorder rec; | 1317 SkPictureRecorder rec; |
1318 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); | 1318 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); |
1319 for (int i = 0; i < 3; i++) { | 1319 for (int i = 0; i < 3; i++) { |
1320 rec.beginRecording(100, 100); | 1320 rec.beginRecording(100, 100); |
1321 REPORTER_ASSERT(r, rec.getRecordingCanvas()); | 1321 REPORTER_ASSERT(r, rec.getRecordingCanvas()); |
1322 rec.endRecording()->unref(); | 1322 rec.endRecording()->unref(); |
1323 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); | 1323 REPORTER_ASSERT(r, !rec.getRecordingCanvas()); |
1324 } | 1324 } |
1325 } | 1325 } |
OLD | NEW |