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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 490253003: Implement SkPicture::bytesUsed() for SkRecord backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More tweaks for object size Created 6 years, 1 month 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 | « tests/PictureTest.cpp ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 "Test.h" 8 #include "Test.h"
9 #include "RecordTestUtils.h" 9 #include "RecordTestUtils.h"
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 struct TestBBH : public SkBBoxHierarchy { 102 struct TestBBH : public SkBBoxHierarchy {
103 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE { 103 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE {
104 fEntries.setCount(N); 104 fEntries.setCount(N);
105 for (int i = 0; i < N; i++) { 105 for (int i = 0; i < N; i++) {
106 Entry e = { (unsigned)i, (*boundsArray)[i] }; 106 Entry e = { (unsigned)i, (*boundsArray)[i] };
107 fEntries[i] = e; 107 fEntries[i] = e;
108 } 108 }
109 } 109 }
110 110
111 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE {} 111 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE {}
112 virtual size_t bytesUsed() const SK_OVERRIDE { return 0; }
112 113
113 struct Entry { 114 struct Entry {
114 unsigned opIndex; 115 unsigned opIndex;
115 SkRect bounds; 116 SkRect bounds;
116 }; 117 };
117 SkTDArray<Entry> fEntries; 118 SkTDArray<Entry> fEntries;
118 }; 119 };
119 120
120 // Like a==b, with a little slop recognizing that float equality can be weird. 121 // Like a==b, with a little slop recognizing that float equality can be weird.
121 static bool sloppy_rect_eq(SkRect a, SkRect b) { 122 static bool sloppy_rect_eq(SkRect a, SkRect b) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 327
327 { 328 {
328 SkRecord record; 329 SkRecord record;
329 SkRecorder recorder(&record, 10, 10); 330 SkRecorder recorder(&record, 10, 10);
330 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); 331 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10));
331 SkRecordDraw(record, &canvas, 0, 0); 332 SkRecordDraw(record, &canvas, 0, 0);
332 } 333 }
333 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 334 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
334 335
335 } 336 }
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698