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

Unified Diff: tests/SurfaceTest.cpp

Issue 1931293003: Revert of Make stencils be attachable to render targets created via… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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/gpu/gl/GrGLGpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index b8123f860926aa429d4a640aaaef91181073decc..ba66a2b3bb3f184290c2817497952e30ac0f78ca 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -897,74 +897,3 @@
}
}
#endif
-
-#if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceWrappedTextureAsRenderTarget, reporter, ctxInfo) {
- GrGpu* gpu = ctxInfo.fGrContext->getGpu();
- if (!gpu) {
- return;
- }
- // Validate that we can draw paths to a canvas of a surface created with
- // SkSurface::MakeFromBackendTextureAsRenderTarget. The code intends to enforce the use of
- // stencil buffer. The original bug prevented the creation of stencil buffer, causing an assert
- // while drawing paths.
-
- static const int kW = 100;
- static const int kH = 100;
- static const uint32_t kOrigColor = SK_ColorRED;
- const SkColor kShapeColor = SK_ColorGREEN;
-
- SkPath clipPath;
- clipPath.quadTo(SkIntToScalar(kW), SkIntToScalar(0), SkIntToScalar(kW), SkIntToScalar(kH));
- clipPath.lineTo(SkIntToScalar(0), SkIntToScalar(kH));
- clipPath.lineTo(SkIntToScalar(0), SkIntToScalar(0));
- clipPath.close();
- SkPath path;
- path.quadTo(SkIntToScalar(0), SkIntToScalar(kH), SkIntToScalar(kW), SkIntToScalar(kH));
- path.lineTo(SkIntToScalar(kW), SkIntToScalar(0));
- path.lineTo(SkIntToScalar(0), SkIntToScalar(0));
- path.close();
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(kShapeColor);
-
- SkImageInfo bitmapInfo = SkImageInfo::Make(kW, kH, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
- for (int sampleCnt : {0, 4, 8}) {
- SkBitmap bitmap;
- bitmap.allocPixels(bitmapInfo);
- bitmap.eraseColor(kOrigColor);
- GrBackendObject texHandle = gpu->createTestingOnlyBackendTexture(bitmap.getPixels(), kW, kH,
- kRGBA_8888_GrPixelConfig);
-
- GrBackendTextureDesc wrappedDesc;
- wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig;
- wrappedDesc.fWidth = kW;
- wrappedDesc.fHeight = kH;
- wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
- wrappedDesc.fTextureHandle = texHandle;
- wrappedDesc.fSampleCnt = sampleCnt;
-
- sk_sp<SkSurface> surface(
- SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.fGrContext, wrappedDesc,
- nullptr));
- if (!surface) {
- continue;
- }
-
- surface->getCanvas()->clipPath(clipPath, SkRegion::kIntersect_Op, true);
- surface->getCanvas()->drawPath(path, paint);
- SkAssertResult(surface->readPixels(bitmapInfo, bitmap.getPixels(),
- bitmap.rowBytes(), 0, 0));
- // Ensure that the shape color ends up to the surface.
- REPORTER_ASSERT(reporter, kShapeColor == bitmap.getColor(kW / 2, kH / 2));
- SkColor backgroundColor = bitmap.getColor(kW - 1, 0);
- if (!sampleCnt) {
- // Ensure that the original texture color is preserved in pixels that aren't rendered to
- // via the surface.
- REPORTER_ASSERT(reporter, kOrigColor == backgroundColor);
- }
- gpu->deleteTestingOnlyBackendTexture(texHandle);
- }
-}
-#endif
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698