aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RectangleTextureTest.cpp
diff options
context:
space:
mode:
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());
}
}