Chromium Code Reviews| Index: tests/ImageTest.cpp |
| diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp |
| index efded7c6defa347edefb8c86b00947339f75ba67..e7eb7c52f7c377dd13d4b0d5e43090ea13027249 100644 |
| --- a/tests/ImageTest.cpp |
| +++ b/tests/ImageTest.cpp |
| @@ -738,71 +738,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { |
| #endif |
| #if SK_SUPPORT_GPU |
| -struct TextureReleaseChecker { |
| - TextureReleaseChecker() : fReleaseCount(0) {} |
| - int fReleaseCount; |
| - static void Release(void* self) { |
| - static_cast<TextureReleaseChecker*>(self)->fReleaseCount++; |
| - } |
| -}; |
| -static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPMColor expected) { |
| - const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); |
| - SkPMColor pixel; |
| - REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0)); |
| - REPORTER_ASSERT(reporter, pixel == expected); |
| -} |
| -DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) { |
| - GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); |
| - const int w = 10; |
| - const int h = 10; |
| - SkPMColor storage[w * h]; |
| - const SkPMColor expected0 = SkPreMultiplyColor(SK_ColorRED); |
| - sk_memset32(storage, expected0, w * h); |
| - GrSurfaceDesc desc; |
| - desc.fFlags = kRenderTarget_GrSurfaceFlag; // needs to be a rendertarget for readpixels(); |
| - desc.fOrigin = kDefault_GrSurfaceOrigin; |
| - desc.fWidth = w; |
| - desc.fHeight = h; |
| - desc.fConfig = kSkia8888_GrPixelConfig; |
| - desc.fSampleCnt = 0; |
| - SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo, storage, w * 4)); |
| - if (!tex) { |
| - REPORTER_ASSERT(reporter, false); |
| - return; |
| - } |
| - |
| - GrBackendTextureDesc backendDesc; |
| - backendDesc.fConfig = kSkia8888_GrPixelConfig; |
| - backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag; |
| - backendDesc.fWidth = w; |
| - backendDesc.fHeight = h; |
| - backendDesc.fSampleCnt = 0; |
| - backendDesc.fTextureHandle = tex->getTextureHandle(); |
| - TextureReleaseChecker releaseChecker; |
| - sk_sp<SkImage> refImg( |
| - SkImage::MakeFromTexture(ctxInfo.grContext(), backendDesc, kPremul_SkAlphaType, |
| - TextureReleaseChecker::Release, &releaseChecker)); |
| - |
| - check_image_color(reporter, refImg.get(), expected0); |
| - |
| - // Now lets jam new colors into our "external" texture, and see if the images notice |
| - const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); |
| - sk_memset32(storage, expected1, w * h); |
| - tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kFlushWrites_PixelOp); |
| - |
| - // The cpy'd one should still see the old color |
| -#if 0 |
| - // There is no guarantee that refImg sees the new color. We are free to have made a copy. Our |
| - // write pixels call violated the contract with refImg and refImg is now undefined. |
| - check_image_color(reporter, refImg, expected1); |
| -#endif |
| - |
| - // Now exercise the release proc |
|
robertphillips
2016/07/21 15:11:30
Do we test, somewhere else, that we correctly call
bsalomon
2016/07/21 15:16:00
Ah, that is probably worth testing (with a much sm
|
| - REPORTER_ASSERT(reporter, 0 == releaseChecker.fReleaseCount); |
| - refImg.reset(nullptr); // force a release of the image |
| - REPORTER_ASSERT(reporter, 1 == releaseChecker.fReleaseCount); |
| -} |
| - |
| static void check_images_same(skiatest::Reporter* reporter, const SkImage* a, const SkImage* b) { |
| if (a->width() != b->width() || a->height() != b->height()) { |
| ERRORF(reporter, "Images must have the same size"); |