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

Unified Diff: tests/SwizzlerTest.cpp

Issue 1075243003: Implementing filling for SkBmpCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Sharing code in static helper Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkSwizzler.cpp ('k') | tools/dm_flags.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SwizzlerTest.cpp
diff --git a/tests/SwizzlerTest.cpp b/tests/SwizzlerTest.cpp
index f02f86b68260e864d2ec5af617c4ca08390f160d..147dfaa83d2ee637d7f23f191a5d6520cad05661 100644
--- a/tests/SwizzlerTest.cpp
+++ b/tests/SwizzlerTest.cpp
@@ -15,6 +15,7 @@ static const uint32_t kFillColor = 0x22334455;
static void check_fill(skiatest::Reporter* r,
const SkImageInfo& imageInfo,
uint32_t startRow,
+ uint32_t endRow,
size_t rowBytes,
uint32_t offset,
uint32_t colorOrIndex,
@@ -32,15 +33,17 @@ static void check_fill(skiatest::Reporter* r,
memset(storage.get(), 0, totalBytes);
// Adjust the pointer in order to test on different memory alignments
uint8_t* imageData = storage.get() + offset;
+ uint8_t* imageStart = imageData + rowBytes * startRow;
// Fill image with the fill value starting at the indicated row
- SkSwizzler::Fill(imageData, imageInfo, rowBytes, startRow, colorOrIndex, colorTable);
+ SkSwizzler::Fill(imageStart, imageInfo, rowBytes, endRow - startRow + 1, colorOrIndex,
+ colorTable);
// Ensure that the pixels are filled properly
// The bots should catch any memory corruption
uint8_t* indexPtr = imageData + startRow * rowBytes;
uint32_t* colorPtr = (uint32_t*) indexPtr;
- for (int32_t y = startRow; y < imageInfo.height(); y++) {
+ for (uint32_t y = startRow; y <= endRow; y++) {
for (int32_t x = 0; x < imageInfo.width(); x++) {
if (kIndex_8_SkColorType == imageInfo.colorType()) {
REPORTER_ASSERT(r, kFillIndex == indexPtr[x]);
@@ -90,20 +93,22 @@ DEF_TEST(SwizzlerFill, r) {
// If there is padding, we can invent an offset to change the memory alignment
for (uint32_t offset = 0; offset <= padding; offset++) {
- // Test all possible start rows
+ // Test all possible start rows with all possible end rows
for (uint32_t startRow = 0; startRow < height; startRow++) {
+ for (uint32_t endRow = startRow; endRow < height; endRow++) {
- // Fill with an index that we use to look up a color
- check_fill(r, colorInfo, startRow, colorRowBytes, offset, kFillIndex,
- colorTable);
+ // Fill with an index that we use to look up a color
+ check_fill(r, colorInfo, startRow, endRow, colorRowBytes, offset,
+ kFillIndex, colorTable);
- // Fill with a color
- check_fill(r, colorInfo, startRow, colorRowBytes, offset, kFillColor,
- NULL);
+ // Fill with a color
+ check_fill(r, colorInfo, startRow, endRow, colorRowBytes, offset,
+ kFillColor, NULL);
- // Fill with an index
- check_fill(r, indexInfo, startRow, indexRowBytes, offset, kFillIndex,
- NULL);
+ // Fill with an index
+ check_fill(r, indexInfo, startRow, endRow, indexRowBytes, offset,
+ kFillIndex, NULL);
+ }
}
}
}
« no previous file with comments | « src/codec/SkSwizzler.cpp ('k') | tools/dm_flags.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698