Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: tests/PictureTest.cpp

Issue 1118693003: add heuristic to pour small pictures into recordings, rather than ref'ing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move check into SkCanvas non-virtual Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698