aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RectangleTextureTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-12-14 12:04:46 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-14 12:05:06 +0000
commitd316e77c1e1967b439a9a6c11146c54e367bff71 (patch)
treefbf7d3740c39507cdb2aad0267c2d96cd3d98bec /tests/RectangleTextureTest.cpp
parent2e018f548d76b0688f9873c683cffc681fec40ec (diff)
Revert "Add a deferred copy surface (take 2)"
This reverts commit 398487a850431cf495330d4023607df5305a311f. Reason for revert: See if this is causing the roll failure Original change's description: > Add a deferred copy surface (take 2) > > This CL forces all GrSurface copies to go through a GrSurfaceContext (rather than GrContext). > > There is a bit of goofiness going on here until read/writePixels is also consolidated in GrSurfaceContext and a proxy-backed SkImage/SkSurface is added. > > This is a reland of https://skia-review.googlesource.com/c/5773/ (Add a deferred copy surface) > > Change-Id: Ide560f569aede5e622420dc2f30eef76357d69f4 > Reviewed-on: https://skia-review.googlesource.com/5939 > Reviewed-by: Brian Osman <brianosman@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I1ef40f0d5fb0bca62031f94f10eb18acd753e913 Reviewed-on: https://skia-review.googlesource.com/6024 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/RectangleTextureTest.cpp')
-rw-r--r--tests/RectangleTextureTest.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 587160448c..cc0c4d1e31 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -15,7 +15,7 @@
#include "gl/GLTestContext.h"
static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context,
- GrSurface* texture, uint32_t expectedPixelValues[]) {
+ GrTexture* texture, uint32_t expectedPixelValues[]) {
int pixelCnt = texture->width() * texture->height();
SkAutoTMalloc<uint32_t> pixels(pixelCnt);
memset(pixels.get(), 0, sizeof(uint32_t)*pixelCnt);
@@ -52,30 +52,22 @@ static void test_write_pixels(skiatest::Reporter* reporter, GrContext* context,
}
static void test_copy_surface_src(skiatest::Reporter* reporter, GrContext* context,
- GrTexture* rectTexture, uint32_t expectedPixelValues[]) {
- GrSurfaceDesc copyDstDesc;
- copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig;
- copyDstDesc.fWidth = rectTexture->width();
- copyDstDesc.fHeight = rectTexture->height();
-
+ GrTexture* rectangleTexture, uint32_t expectedPixelValues[]) {
for (auto flags : {kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag}) {
+ GrSurfaceDesc copyDstDesc;
+ copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig;
+ copyDstDesc.fWidth = rectangleTexture->width();
+ copyDstDesc.fHeight = rectangleTexture->height();
copyDstDesc.fFlags = flags;
-
- sk_sp<GrSurfaceProxy> dst(GrSurfaceProxy::TestCopy(context, copyDstDesc,
- rectTexture, SkBudgeted::kYes));
-
- GrSurface* dstSurf = dst->instantiate(context->textureProvider());
-
- test_read_pixels(reporter, context, dstSurf, expectedPixelValues);
+ sk_sp<GrTexture> dst(
+ context->textureProvider()->createTexture(copyDstDesc, SkBudgeted::kYes));
+ context->copySurface(dst.get(), rectangleTexture);
+ test_read_pixels(reporter, context, dst.get(), expectedPixelValues);
}
}
static void test_copy_surface_dst(skiatest::Reporter* reporter, GrContext* context,
GrTexture* rectangleTexture) {
-
- sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeWrappedSurfaceContext(
- sk_ref_sp(rectangleTexture)));
-
int pixelCnt = rectangleTexture->width() * rectangleTexture->height();
SkAutoTMalloc<uint32_t> pixels(pixelCnt);
for (int y = 0; y < rectangleTexture->width(); ++y) {
@@ -89,13 +81,10 @@ static void test_copy_surface_dst(skiatest::Reporter* reporter, GrContext* conte
copySrcDesc.fWidth = rectangleTexture->width();
copySrcDesc.fHeight = rectangleTexture->height();
copySrcDesc.fFlags = flags;
+ sk_sp<GrTexture> src(context->textureProvider()->createTexture(
+ copySrcDesc, SkBudgeted::kYes, pixels.get(), 0));
- sk_sp<GrSurfaceProxy> src(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->textureProvider(),
- copySrcDesc,
- SkBudgeted::kYes, pixels.get(), 0));
- sContext->copy(src.get());
-
+ context->copySurface(rectangleTexture, src.get());
test_read_pixels(reporter, context, rectangleTexture, pixels.get());
}
}