OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 here to ensure SK_SUPPORT_GPU is set correctly before it is examined. | 8 // Include here to ensure SK_SUPPORT_GPU is set correctly before it is examined. |
9 #include "SkTypes.h" | 9 #include "SkTypes.h" |
10 | 10 |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 make_unique_key<1>(&key1, i); | 1232 make_unique_key<1>(&key1, i); |
1233 make_unique_key<2>(&key2, i); | 1233 make_unique_key<2>(&key2, i); |
1234 | 1234 |
1235 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); | 1235 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); |
1236 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); | 1236 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); |
1237 } | 1237 } |
1238 } | 1238 } |
1239 | 1239 |
1240 static void test_custom_data(skiatest::Reporter* reporter) { | 1240 static void test_custom_data(skiatest::Reporter* reporter) { |
1241 GrUniqueKey key1, key2; | 1241 GrUniqueKey key1, key2; |
| 1242 make_unique_key<0>(&key1, 1); |
| 1243 make_unique_key<0>(&key2, 2); |
1242 int foo = 4132; | 1244 int foo = 4132; |
1243 key1.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo))); | 1245 key1.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo))); |
1244 REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132); | 1246 REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132); |
1245 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); | 1247 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); |
1246 | 1248 |
1247 // Test that copying a key also takes a ref on its custom data. | 1249 // Test that copying a key also takes a ref on its custom data. |
1248 GrUniqueKey key3 = key1; | 1250 GrUniqueKey key3 = key1; |
1249 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); | 1251 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); |
1250 } | 1252 } |
1251 | 1253 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 test_purge_invalidated(reporter); | 1287 test_purge_invalidated(reporter); |
1286 test_cache_chained_purge(reporter); | 1288 test_cache_chained_purge(reporter); |
1287 test_resource_size_changed(reporter); | 1289 test_resource_size_changed(reporter); |
1288 test_timestamp_wrap(reporter); | 1290 test_timestamp_wrap(reporter); |
1289 test_flush(reporter); | 1291 test_flush(reporter); |
1290 test_large_resource_count(reporter); | 1292 test_large_resource_count(reporter); |
1291 test_custom_data(reporter); | 1293 test_custom_data(reporter); |
1292 } | 1294 } |
1293 | 1295 |
1294 #endif | 1296 #endif |
OLD | NEW |