aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ReadPixelsTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-05 18:56:21 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-05 18:56:33 +0000
commit1b35256f1166358056b2aad8ce09caa6f07912d5 (patch)
tree9d9bcd6bffc6126d656efefee15bb376dab81d42 /tests/ReadPixelsTest.cpp
parent1987366b3c0a9dd9280620e62e0edb7d5087a828 (diff)
Revert "Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv (take 2)"
This reverts commit aaee31f18c0845417103d84285e365575def3c40. Reason for revert: possible valgrind leak Original change's description: > Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv (take 2) > > This is in service of: https://skia-review.googlesource.com/c/11125/ (Add parallel proxyID to StencilOps & RenderTargetOpList) where I want a better choke point for texture creation to improve discard handling. > > This is a reland of: https://skia-review.googlesource.com/c/11200/ (Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv) > > Change-Id: Icd0a90d2beb483dc24ed87c3bace9c817019e148 > Reviewed-on: https://skia-review.googlesource.com/11326 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ia0b92bf6402cb5f9607310d356f43bff2e3e75eb Reviewed-on: https://skia-review.googlesource.com/11361 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/ReadPixelsTest.cpp')
-rw-r--r--tests/ReadPixelsTest.cpp38
1 files changed, 14 insertions, 24 deletions
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index c67e62b090..774f0af06a 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -16,7 +16,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrContextPriv.h"
#include "GrResourceProvider.h"
#include "SkGr.h"
#endif
@@ -124,16 +123,11 @@ static void fill_src_canvas(SkCanvas* canvas) {
}
#if SK_SUPPORT_GPU
-static void fill_src_texture(GrContext* context, GrTextureProxy* proxy) {
+static void fill_src_texture(GrTexture* texture) {
SkBitmap bmp = make_src_bitmap();
bmp.lockPixels();
-
- SkDEBUGCODE(bool result =) context->contextPriv().writeSurfacePixels(
- proxy, nullptr,
- 0, 0, DEV_W, DEV_H,
- kSkia8888_GrPixelConfig, nullptr,
- bmp.getPixels(), bmp.rowBytes());
- SkASSERT(result);
+ texture->writePixels(0, 0, DEV_W, DEV_H, kSkia8888_GrPixelConfig, bmp.getPixels(),
+ bmp.rowBytes());
bmp.unlockPixels();
}
#endif
@@ -442,9 +436,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) {
#endif
#if SK_SUPPORT_GPU
-static void test_readpixels_texture(skiatest::Reporter* reporter,
- GrContext* context, sk_sp<GrTextureProxy> proxy) {
- fill_src_texture(context, proxy.get());
+static void test_readpixels_texture(skiatest::Reporter* reporter, GrTexture* texture) {
+ fill_src_texture(texture);
for (size_t rect = 0; rect < SK_ARRAY_COUNT(gReadPixelsTestRects); ++rect) {
const SkIRect& srcRect = gReadPixelsTestRects[rect];
for (BitmapInit bmi = kFirstBitmapInit; bmi <= kLast_BitmapInit; bmi = nextBMI(bmi)) {
@@ -459,18 +452,16 @@ static void test_readpixels_texture(skiatest::Reporter* reporter,
// Try doing the read directly from a non-renderable texture
if (startsWithPixels) {
fill_dst_bmp_with_init_data(&bmp);
- GrPixelConfig dstConfig = SkImageInfo2GrPixelConfig(bmp.info(),
- *context->caps());
+ GrPixelConfig dstConfig =
+ SkImageInfo2GrPixelConfig(bmp.info(), *texture->getContext()->caps());
uint32_t flags = 0;
if (gReadPixelsConfigs[c].fAlphaType == kUnpremul_SkAlphaType) {
- flags = GrContextPriv::kUnpremul_PixelOpsFlag;
+ flags = GrContext::kUnpremul_PixelOpsFlag;
}
bmp.lockPixels();
- bool success = context->contextPriv().readSurfacePixels(
- proxy.get(), nullptr,
- srcRect.fLeft, srcRect.fTop, bmp.width(),
- bmp.height(), dstConfig, nullptr,
- bmp.getPixels(), bmp.rowBytes(), flags);
+ bool success = texture->readPixels(srcRect.fLeft, srcRect.fTop, bmp.width(),
+ bmp.height(), dstConfig, bmp.getPixels(),
+ bmp.rowBytes(), flags);
bmp.unlockPixels();
check_read(reporter, bmp, srcRect.fLeft, srcRect.fTop,
success, true,
@@ -490,10 +481,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) {
desc.fHeight = DEV_H;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = origin;
- sk_sp<GrTexture> texture =
- ctxInfo.grContext()->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
- test_readpixels_texture(reporter, ctxInfo.grContext(),
- GrSurfaceProxy::MakeWrapped(std::move(texture)));
+ sk_sp<GrTexture> texture(ctxInfo.grContext()->resourceProvider()->createTexture(desc,
+ SkBudgeted::kNo));
+ test_readpixels_texture(reporter, texture.get());
}
}
}