robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "tests/Test.h" |
reed | f037e0b | 2014-10-30 11:34:15 -0700 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkCanvas.h" |
| 11 | #include "include/core/SkSurface.h" |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 12 | #include "include/gpu/GrDirectContext.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "include/private/SkTo.h" |
Greg Daniel | 6f5441a | 2020-01-28 17:02:49 -0500 | [diff] [blame] | 14 | #include "src/gpu/GrBitmapTextureMaker.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 15 | #include "src/gpu/GrContextPriv.h" |
Brian Salomon | f2ebdd9 | 2019-09-30 12:15:30 -0400 | [diff] [blame] | 16 | #include "src/gpu/GrImageInfo.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 17 | #include "src/gpu/GrProxyProvider.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 18 | #include "src/gpu/GrSurfaceContext.h" |
Greg Daniel | f91aeb2 | 2019-06-18 09:58:02 -0400 | [diff] [blame] | 19 | #include "src/gpu/GrSurfaceProxy.h" |
| 20 | #include "src/gpu/GrTextureProxy.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 21 | #include "tools/gpu/ProxyUtils.h" |
robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 22 | |
bsalomon | f46a124 | 2015-12-15 12:37:38 -0800 | [diff] [blame] | 23 | // This was made indivisible by 4 to ensure we test setting GL_PACK_ALIGNMENT properly. |
| 24 | static const int X_SIZE = 13; |
| 25 | static const int Y_SIZE = 13; |
robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 26 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 27 | static void validate_alpha_data(skiatest::Reporter* reporter, int w, int h, const uint8_t* actual, |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 28 | size_t actualRowBytes, const uint8_t* expected, SkString extraMsg, |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 29 | GrColorType colorType) { |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 30 | for (int y = 0; y < h; ++y) { |
| 31 | for (int x = 0; x < w; ++x) { |
| 32 | uint8_t a = actual[y * actualRowBytes + x]; |
| 33 | uint8_t e = expected[y * w + x]; |
Robert Phillips | cbc9667 | 2020-04-28 15:03:34 -0400 | [diff] [blame] | 34 | if (GrColorType::kRGBA_1010102 == colorType || |
| 35 | GrColorType::kBGRA_1010102 == colorType) { |
| 36 | // These configs only preserves two bits of alpha |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 37 | a >>= 6; |
| 38 | e >>= 6; |
| 39 | } |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 40 | if (e != a) { |
| 41 | ERRORF(reporter, |
| 42 | "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at (%d,%d), %s", |
| 43 | e, a, x, y, extraMsg.c_str()); |
| 44 | return; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 49 | |
egdaniel | ab527a5 | 2016-06-28 08:07:26 -0700 | [diff] [blame] | 50 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 51 | auto direct = ctxInfo.directContext(); |
Robert Phillips | 1afd4cd | 2018-01-08 13:40:32 -0500 | [diff] [blame] | 52 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 53 | unsigned char alphaData[X_SIZE * Y_SIZE]; |
robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 54 | |
robertphillips | df082c5 | 2016-04-19 08:32:40 -0700 | [diff] [blame] | 55 | static const int kClearValue = 0x2; |
| 56 | |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 57 | bool match; |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 58 | static const size_t kRowBytes[] = {0, X_SIZE, X_SIZE + 1, 2 * X_SIZE - 1}; |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 59 | { |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 60 | // We are initializing the texture with zeros here |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 61 | memset(alphaData, 0, X_SIZE * Y_SIZE); |
Greg Daniel | 6f5441a | 2020-01-28 17:02:49 -0500 | [diff] [blame] | 62 | unsigned char alphaDataCopy[X_SIZE * Y_SIZE]; |
| 63 | memcpy(alphaDataCopy, alphaData, X_SIZE * Y_SIZE); |
Robert Phillips | c949ce9 | 2017-01-19 16:59:04 -0500 | [diff] [blame] | 64 | |
Brian Osman | 2700abc | 2018-09-12 10:19:41 -0400 | [diff] [blame] | 65 | const SkImageInfo ii = SkImageInfo::MakeA8(X_SIZE, Y_SIZE); |
| 66 | |
Greg Daniel | 6f5441a | 2020-01-28 17:02:49 -0500 | [diff] [blame] | 67 | SkBitmap bitmap; |
| 68 | bitmap.installPixels(ii, alphaDataCopy, ii.minRowBytes()); |
| 69 | bitmap.setImmutable(); |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 70 | GrBitmapTextureMaker maker(direct, bitmap, GrImageTexGenPolicy::kNew_Uncached_Budgeted); |
Brian Salomon | ecbb0fb | 2020-02-28 18:07:32 -0500 | [diff] [blame] | 71 | auto view = maker.view(GrMipMapped::kNo); |
Greg Daniel | cc104db | 2020-02-03 14:17:08 -0500 | [diff] [blame] | 72 | if (!view.proxy()) { |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 73 | ERRORF(reporter, "Could not create alpha texture."); |
| 74 | return; |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 75 | } |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 76 | |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 77 | auto sContext = GrSurfaceContext::Make(direct, std::move(view), maker.colorType(), |
Brian Salomon | ecbb0fb | 2020-02-28 18:07:32 -0500 | [diff] [blame] | 78 | kPremul_SkAlphaType, nullptr); |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 79 | |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 80 | sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(direct, SkBudgeted::kNo, ii)); |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 81 | |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 82 | // create a distinctive texture |
| 83 | for (int y = 0; y < Y_SIZE; ++y) { |
| 84 | for (int x = 0; x < X_SIZE; ++x) { |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 85 | alphaData[y * X_SIZE + x] = y*X_SIZE+x; |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 86 | } |
| 87 | } |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 88 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 89 | for (auto rowBytes : kRowBytes) { |
Robert Phillips | c949ce9 | 2017-01-19 16:59:04 -0500 | [diff] [blame] | 90 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 91 | // upload the texture (do per-rowbytes iteration because we may overwrite below). |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 92 | bool result = sContext->writePixels(ii, alphaData, 0, {0, 0}); |
Brian Salomon | 1c80e99 | 2018-01-29 09:50:47 -0500 | [diff] [blame] | 93 | REPORTER_ASSERT(reporter, result, "Initial A8 writePixels failed"); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 94 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 95 | size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE; |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 96 | size_t bufLen = nonZeroRowBytes * Y_SIZE; |
| 97 | std::unique_ptr<uint8_t[]> readback(new uint8_t[bufLen]); |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 98 | // clear readback to something non-zero so we can detect readback failures |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 99 | memset(readback.get(), kClearValue, bufLen); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 100 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 101 | // read the texture back |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 102 | result = sContext->readPixels(ii, readback.get(), rowBytes, {0, 0}); |
Brian Salomon | 19eaf2d | 2018-03-19 16:06:44 -0400 | [diff] [blame] | 103 | // We don't require reading from kAlpha_8 to be supported. TODO: At least make this work |
| 104 | // when kAlpha_8 is renderable. |
| 105 | if (!result) { |
| 106 | continue; |
| 107 | } |
Brian Salomon | 1c80e99 | 2018-01-29 09:50:47 -0500 | [diff] [blame] | 108 | REPORTER_ASSERT(reporter, result, "Initial A8 readPixels failed"); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 109 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 110 | // make sure the original & read back versions match |
| 111 | SkString msg; |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 112 | msg.printf("rb:%d A8", SkToU32(rowBytes)); |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 113 | validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes, |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 114 | alphaData, msg, GrColorType::kAlpha_8); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 115 | |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 116 | // Now try writing to a single channel surface (if we could create one). |
| 117 | if (surf) { |
robertphillips | 7715e06 | 2016-04-22 10:57:16 -0700 | [diff] [blame] | 118 | SkCanvas* canvas = surf->getCanvas(); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 119 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 120 | SkPaint paint; |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 121 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 122 | const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 123 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 124 | paint.setColor(SK_ColorWHITE); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 125 | |
robertphillips | 7715e06 | 2016-04-22 10:57:16 -0700 | [diff] [blame] | 126 | canvas->drawRect(rect, paint); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 127 | |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 128 | // Workaround for a bug in old GCC/glibc used in our Chromecast toolchain: |
| 129 | // error: call to '__warn_memset_zero_len' declared with attribute warning: |
| 130 | // memset used with constant zero length parameter; this could be due |
| 131 | // to transposed parameters |
| 132 | // See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61294 |
| 133 | if (bufLen > 0) { |
| 134 | memset(readback.get(), kClearValue, bufLen); |
| 135 | } |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 136 | result = surf->readPixels(ii, readback.get(), nonZeroRowBytes, 0, 0); |
Brian Salomon | 1c80e99 | 2018-01-29 09:50:47 -0500 | [diff] [blame] | 137 | REPORTER_ASSERT(reporter, result, "A8 readPixels after clear failed"); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 138 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 139 | match = true; |
| 140 | for (int y = 0; y < Y_SIZE && match; ++y) { |
| 141 | for (int x = 0; x < X_SIZE && match; ++x) { |
| 142 | uint8_t rbValue = readback.get()[y * nonZeroRowBytes + x]; |
| 143 | if (0xFF != rbValue) { |
| 144 | ERRORF(reporter, |
| 145 | "Failed alpha readback after clear. Expected: 0xFF, Got: 0x%02x" |
Brian Salomon | 2ea6ff7 | 2016-02-02 11:34:46 -0500 | [diff] [blame] | 146 | " at (%d,%d), rb:%d", rbValue, x, y, SkToU32(rowBytes)); |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 147 | match = false; |
| 148 | } |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 149 | } |
| 150 | } |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 151 | } |
| 152 | } |
| 153 | } |
| 154 | |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 155 | static constexpr struct { |
| 156 | GrColorType fColorType; |
Brian Salomon | e7499c7 | 2019-06-24 12:12:36 -0400 | [diff] [blame] | 157 | SkAlphaType fAlphaType; |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 158 | } kInfos[] = { |
Greg Daniel | e877dce | 2019-07-11 10:52:43 -0400 | [diff] [blame] | 159 | {GrColorType::kRGBA_8888, kPremul_SkAlphaType}, |
| 160 | {GrColorType::kBGRA_8888, kPremul_SkAlphaType}, |
| 161 | {GrColorType::kRGBA_8888_SRGB, kPremul_SkAlphaType}, |
| 162 | {GrColorType::kRGBA_1010102, kPremul_SkAlphaType}, |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 163 | }; |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 164 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 165 | for (int y = 0; y < Y_SIZE; ++y) { |
| 166 | for (int x = 0; x < X_SIZE; ++x) { |
| 167 | alphaData[y * X_SIZE + x] = y*X_SIZE+x; |
| 168 | } |
| 169 | } |
| 170 | |
Robert Phillips | bab2dbb | 2017-04-17 07:43:27 -0400 | [diff] [blame] | 171 | const SkImageInfo dstInfo = SkImageInfo::Make(X_SIZE, Y_SIZE, |
| 172 | kAlpha_8_SkColorType, |
| 173 | kPremul_SkAlphaType); |
| 174 | |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 175 | // Attempt to read back just alpha from a RGBA/BGRA texture. Once with a texture-only src and |
| 176 | // once with a render target. |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 177 | for (auto info : kInfos) { |
Robert Phillips | 9dbcdcc | 2019-05-13 10:40:06 -0400 | [diff] [blame] | 178 | for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) { |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 179 | uint32_t rgbaData[X_SIZE * Y_SIZE]; |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 180 | // Make the alpha channel of the rgba texture come from alphaData. |
| 181 | for (int y = 0; y < Y_SIZE; ++y) { |
| 182 | for (int x = 0; x < X_SIZE; ++x) { |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 183 | rgbaData[y * X_SIZE + x] = GrColorPackRGBA(6, 7, 8, alphaData[y * X_SIZE + x]); |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 184 | } |
| 185 | } |
Robert Phillips | 0bd24dc | 2018-01-16 08:06:32 -0500 | [diff] [blame] | 186 | |
Robert Phillips | 9dbcdcc | 2019-05-13 10:40:06 -0400 | [diff] [blame] | 187 | auto origin = GrRenderable::kYes == renderable ? kBottomLeft_GrSurfaceOrigin |
| 188 | : kTopLeft_GrSurfaceOrigin; |
Brian Salomon | e7499c7 | 2019-06-24 12:12:36 -0400 | [diff] [blame] | 189 | auto proxy = sk_gpu_test::MakeTextureProxyFromData( |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 190 | direct, renderable, origin, |
Brian Salomon | 4eda710 | 2019-10-21 15:04:52 -0400 | [diff] [blame] | 191 | {info.fColorType, info.fAlphaType, nullptr, X_SIZE, Y_SIZE}, rgbaData, 0); |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 192 | if (!proxy) { |
bsalomon | e957331 | 2016-01-25 14:33:25 -0800 | [diff] [blame] | 193 | continue; |
| 194 | } |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 195 | |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 196 | GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(proxy->backendFormat(), |
| 197 | info.fColorType); |
Greg Daniel | 3912a4b | 2020-01-14 09:56:04 -0500 | [diff] [blame] | 198 | GrSurfaceProxyView view(std::move(proxy), origin, swizzle); |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 199 | auto sContext = GrSurfaceContext::Make(direct, std::move(view), info.fColorType, |
Greg Daniel | bfa19c4 | 2019-12-19 16:41:40 -0500 | [diff] [blame] | 200 | kPremul_SkAlphaType, nullptr); |
Robert Phillips | bab2dbb | 2017-04-17 07:43:27 -0400 | [diff] [blame] | 201 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 202 | for (auto rowBytes : kRowBytes) { |
| 203 | size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE; |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 204 | |
Ben Wagner | 7ecc596 | 2016-11-02 17:07:33 -0400 | [diff] [blame] | 205 | std::unique_ptr<uint8_t[]> readback(new uint8_t[nonZeroRowBytes * Y_SIZE]); |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 206 | // Clear so we don't accidentally see values from previous iteration. |
robertphillips | df082c5 | 2016-04-19 08:32:40 -0700 | [diff] [blame] | 207 | memset(readback.get(), kClearValue, nonZeroRowBytes * Y_SIZE); |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 208 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 209 | // read the texture back |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 210 | bool result = sContext->readPixels(dstInfo, readback.get(), rowBytes, {0, 0}); |
Brian Salomon | 1c80e99 | 2018-01-29 09:50:47 -0500 | [diff] [blame] | 211 | REPORTER_ASSERT(reporter, result, "8888 readPixels failed"); |
bsalomon | 23e5666 | 2016-01-14 07:19:47 -0800 | [diff] [blame] | 212 | |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 213 | // make sure the original & read back versions match |
| 214 | SkString msg; |
Robert Phillips | 9dbcdcc | 2019-05-13 10:40:06 -0400 | [diff] [blame] | 215 | msg.printf("rt:%d, rb:%d 8888", GrRenderable::kYes == renderable, |
| 216 | SkToU32(rowBytes)); |
bsalomon | 9d02b26 | 2016-02-01 12:49:30 -0800 | [diff] [blame] | 217 | validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes, |
Brian Salomon | 58389b9 | 2018-03-07 13:01:25 -0500 | [diff] [blame] | 218 | alphaData, msg, info.fColorType); |
kkinnunen | 1530283 | 2015-12-01 04:35:26 -0800 | [diff] [blame] | 219 | } |
| 220 | } |
| 221 | } |
robertphillips@google.com | 6995068 | 2012-04-06 18:06:10 +0000 | [diff] [blame] | 222 | } |