Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: tests/SwizzlerTest.cpp

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix windows errors Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/CodexTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/CodexTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698