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

Side by Side Diff: tests/RecordTest.cpp

Issue 1360943003: simplify code in SkRecords.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another SaveLayer Created 5 years, 2 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/SkRecorder.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 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 draw->rect.fBottom *= 2; 44 draw->rect.fBottom *= 2;
45 } 45 }
46 46
47 void apply(SkRecord* record) { 47 void apply(SkRecord* record) {
48 for (int i = 0; i < record->count(); i++) { 48 for (int i = 0; i < record->count(); i++) {
49 record->mutate<void>(i, *this); 49 record->mutate<void>(i, *this);
50 } 50 }
51 } 51 }
52 }; 52 };
53 53
54 #define APPEND(record, type, ...) new (record.append<type>()) type(__VA_ARGS__) 54 #define APPEND(record, type, ...) new (record.append<type>()) type{__VA_ARGS__}
55 55
56 // Basic tests for the low-level SkRecord code. 56 // Basic tests for the low-level SkRecord code.
57 DEF_TEST(Record, r) { 57 DEF_TEST(Record, r) {
58 SkRecord record; 58 SkRecord record;
59 59
60 // Add a simple DrawRect command. 60 // Add a simple DrawRect command.
61 SkRect rect = SkRect::MakeWH(10, 10); 61 SkRect rect = SkRect::MakeWH(10, 10);
62 SkPaint paint; 62 SkPaint paint;
63 APPEND(record, SkRecords::DrawRect, paint, rect); 63 APPEND(record, SkRecords::DrawRect, paint, rect);
64 64
(...skipping 25 matching lines...) Expand all
90 REPORTER_ASSERT(r, is_aligned(record.alloc<uint32_t>())); 90 REPORTER_ASSERT(r, is_aligned(record.alloc<uint32_t>()));
91 REPORTER_ASSERT(r, is_aligned(record.alloc<void*>())); 91 REPORTER_ASSERT(r, is_aligned(record.alloc<void*>()));
92 92
93 // It's not clear if we care that 8-byte values are aligned on 32-bit machin es. 93 // It's not clear if we care that 8-byte values are aligned on 32-bit machin es.
94 if (sizeof(void*) == 8) { 94 if (sizeof(void*) == 8) {
95 REPORTER_ASSERT(r, is_aligned(record.alloc<double>())); 95 REPORTER_ASSERT(r, is_aligned(record.alloc<double>()));
96 REPORTER_ASSERT(r, is_aligned(record.alloc<uint64_t>())); 96 REPORTER_ASSERT(r, is_aligned(record.alloc<uint64_t>()));
97 } 97 }
98 } 98 }
99 99
OLDNEW
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698