| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 REPORTER_ASSERT(reporter, reader.eof()); | 146 REPORTER_ASSERT(reporter, reader.eof()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { | 149 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { |
| 150 // Create some random data to write. | 150 // Create some random data to write. |
| 151 const size_t dataSize = 10<<2; | 151 const size_t dataSize = 10<<2; |
| 152 SkASSERT(SkIsAlign4(dataSize)); | 152 SkASSERT(SkIsAlign4(dataSize)); |
| 153 | 153 |
| 154 SkAutoMalloc originalData(dataSize); | 154 SkAutoMalloc originalData(dataSize); |
| 155 { | 155 { |
| 156 SkMWCRandom rand(0); | 156 SkRandom rand(0); |
| 157 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); | 157 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); |
| 158 uint32_t* stop = ptr + (dataSize>>2); | 158 uint32_t* stop = ptr + (dataSize>>2); |
| 159 while (ptr < stop) { | 159 while (ptr < stop) { |
| 160 *ptr++ = rand.nextU(); | 160 *ptr++ = rand.nextU(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Write the random data to the writer at different lengths for | 163 // Write the random data to the writer at different lengths for |
| 164 // different alignments. | 164 // different alignments. |
| 165 for (size_t len = 0; len < dataSize; len++) { | 165 for (size_t len = 0; len < dataSize; len++) { |
| 166 writer->writePad(originalData.get(), len); | 166 writer->writePad(originalData.get(), len); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 test_reserve(reporter); | 250 test_reserve(reporter); |
| 251 test_string_null(reporter); | 251 test_string_null(reporter); |
| 252 test_ptr(reporter); | 252 test_ptr(reporter); |
| 253 test_rewind(reporter); | 253 test_rewind(reporter); |
| 254 } | 254 } |
| 255 | 255 |
| 256 #include "TestClassDef.h" | 256 #include "TestClassDef.h" |
| 257 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) | 257 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) |
| OLD | NEW |