| 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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 | 1112 |
| 1113 recorder.beginRecording(0, 0); | 1113 recorder.beginRecording(0, 0); |
| 1114 SkAutoTUnref<SkPicture> empty(recorder.endRecording()); | 1114 SkAutoTUnref<SkPicture> empty(recorder.endRecording()); |
| 1115 | 1115 |
| 1116 // Sanity check to make sure we aren't under-measuring. | 1116 // Sanity check to make sure we aren't under-measuring. |
| 1117 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
>= | 1117 REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get())
>= |
| 1118 sizeof(SkPicture) + sizeof(SkRecord)); | 1118 sizeof(SkPicture) + sizeof(SkRecord)); |
| 1119 | 1119 |
| 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 <= 136); | 1122 REPORTER_ASSERT(reporter, approxUsed <= 416); |
| 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 } |
| (...skipping 183 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 |