aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ReadWriteAlphaTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ReadWriteAlphaTest.cpp')
-rw-r--r--tests/ReadWriteAlphaTest.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 68a3ee0983..ba1022c689 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -25,11 +25,17 @@ static const int X_SIZE = 13;
static const int Y_SIZE = 13;
static void validate_alpha_data(skiatest::Reporter* reporter, int w, int h, const uint8_t* actual,
- size_t actualRowBytes, const uint8_t* expected, SkString extraMsg) {
+ size_t actualRowBytes, const uint8_t* expected, SkString extraMsg,
+ GrPixelConfig config) {
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
uint8_t a = actual[y * actualRowBytes + x];
uint8_t e = expected[y * w + x];
+ if (kRGBA_1010102_GrPixelConfig == config) {
+ // This config only preserves two bits of alpha
+ a >>= 6;
+ e >>= 6;
+ }
if (e != a) {
ERRORF(reporter,
"Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at (%d,%d), %s",
@@ -99,7 +105,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
SkString msg;
msg.printf("rb:%d A8", SkToU32(rowBytes));
validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes,
- alphaData, msg);
+ alphaData, msg, kAlpha_8_GrPixelConfig);
// Now try writing to a single channel surface (if we could create one).
if (surf) {
@@ -136,7 +142,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
static const GrPixelConfig kRGBAConfigs[] {
kRGBA_8888_GrPixelConfig,
kBGRA_8888_GrPixelConfig,
- kSRGBA_8888_GrPixelConfig
+ kSRGBA_8888_GrPixelConfig,
+ kRGBA_1010102_GrPixelConfig,
};
for (int y = 0; y < Y_SIZE; ++y) {
@@ -200,7 +207,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
SkString msg;
msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes));
validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes,
- alphaData, msg);
+ alphaData, msg, config);
}
}
}