| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 REPORTER_ASSERT(reporter, reader.eof()); | 127 REPORTER_ASSERT(reporter, reader.eof()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { | 130 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { |
| 131 // Create some random data to write. | 131 // Create some random data to write. |
| 132 const size_t dataSize = 10<<2; | 132 const size_t dataSize = 10<<2; |
| 133 SkASSERT(SkIsAlign4(dataSize)); | 133 SkASSERT(SkIsAlign4(dataSize)); |
| 134 | 134 |
| 135 SkAutoMalloc originalData(dataSize); | 135 SkAutoMalloc originalData(dataSize); |
| 136 { | 136 { |
| 137 SkRandom rand(0); | 137 SkMWCRandom rand(0); |
| 138 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); | 138 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); |
| 139 uint32_t* stop = ptr + (dataSize>>2); | 139 uint32_t* stop = ptr + (dataSize>>2); |
| 140 while (ptr < stop) { | 140 while (ptr < stop) { |
| 141 *ptr++ = rand.nextU(); | 141 *ptr++ = rand.nextU(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Write the random data to the writer at different lengths for | 144 // Write the random data to the writer at different lengths for |
| 145 // different alignments. | 145 // different alignments. |
| 146 for (size_t len = 0; len < dataSize; len++) { | 146 for (size_t len = 0; len < dataSize; len++) { |
| 147 writer->writePad(originalData.get(), len); | 147 writer->writePad(originalData.get(), len); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 writer.reset(); | 222 writer.reset(); |
| 223 testWritePad(reporter, &writer); | 223 testWritePad(reporter, &writer); |
| 224 } | 224 } |
| 225 | 225 |
| 226 test_ptr(reporter); | 226 test_ptr(reporter); |
| 227 test_rewind(reporter); | 227 test_rewind(reporter); |
| 228 } | 228 } |
| 229 | 229 |
| 230 #include "TestClassDef.h" | 230 #include "TestClassDef.h" |
| 231 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) | 231 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) |
| OLD | NEW |