OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkSwizzler.h" | 8 #include "SkSwizzler.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Create fake image data where every byte has a value of 0 | 31 // Create fake image data where every byte has a value of 0 |
32 SkAutoTDeleteArray<uint8_t> storage(new uint8_t[totalBytes]); | 32 SkAutoTDeleteArray<uint8_t> storage(new uint8_t[totalBytes]); |
33 memset(storage.get(), 0, totalBytes); | 33 memset(storage.get(), 0, totalBytes); |
34 // Adjust the pointer in order to test on different memory alignments | 34 // Adjust the pointer in order to test on different memory alignments |
35 uint8_t* imageData = storage.get() + offset; | 35 uint8_t* imageData = storage.get() + offset; |
36 uint8_t* imageStart = imageData + rowBytes * startRow; | 36 uint8_t* imageStart = imageData + rowBytes * startRow; |
37 | 37 |
38 // Fill image with the fill value starting at the indicated row | 38 // Fill image with the fill value starting at the indicated row |
39 SkSwizzler::Fill(imageStart, imageInfo, rowBytes, endRow - startRow + 1, col
orOrIndex, | 39 SkSwizzler::Fill(imageStart, imageInfo, rowBytes, endRow - startRow + 1, col
orOrIndex, |
40 colorTable); | 40 colorTable, SkCodec::kNo_ZeroInitialized); |
41 | 41 |
42 // Ensure that the pixels are filled properly | 42 // Ensure that the pixels are filled properly |
43 // The bots should catch any memory corruption | 43 // The bots should catch any memory corruption |
44 uint8_t* indexPtr = imageData + startRow * rowBytes; | 44 uint8_t* indexPtr = imageData + startRow * rowBytes; |
45 uint8_t* grayPtr = indexPtr; | 45 uint8_t* grayPtr = indexPtr; |
46 uint32_t* colorPtr = (uint32_t*) indexPtr; | 46 uint32_t* colorPtr = (uint32_t*) indexPtr; |
47 for (uint32_t y = startRow; y <= endRow; y++) { | 47 for (uint32_t y = startRow; y <= endRow; y++) { |
48 for (int32_t x = 0; x < imageInfo.width(); x++) { | 48 for (int32_t x = 0; x < imageInfo.width(); x++) { |
49 switch (imageInfo.colorType()) { | 49 switch (imageInfo.colorType()) { |
50 case kIndex_8_SkColorType: | 50 case kIndex_8_SkColorType: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Fill a grayscale image | 125 // Fill a grayscale image |
126 check_fill(r, grayInfo, startRow, endRow, grayRowByt
es, offset, | 126 check_fill(r, grayInfo, startRow, endRow, grayRowByt
es, offset, |
127 kFillColor, nullptr); | 127 kFillColor, nullptr); |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
OLD | NEW |