OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |