Migrate GrSurfaceContext readPixels to take direct context
After this lands we'll proceed up the stack and add the direct
context requirement to the public API and SkImage.
Bug: skia:104662
Change-Id: I4b2d779a7fcd65eec68e631757821ac8e136ddba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309044
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 8ddaa70..0017c8f 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -28,7 +28,7 @@
static const int DEV_W = 100, DEV_H = 100;
template <typename T>
-void runFPTest(skiatest::Reporter* reporter, GrDirectContext* context,
+void runFPTest(skiatest::Reporter* reporter, GrDirectContext* dContext,
T min, T max, T epsilon, T maxInt,
int arraySize, GrColorType colorType) {
if (0 != arraySize % 4) {
@@ -50,7 +50,7 @@
for (auto origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
auto fpProxy = sk_gpu_test::MakeTextureProxyFromData(
- context, GrRenderable::kYes, origin,
+ dContext, GrRenderable::kYes, origin,
{colorType, kPremul_SkAlphaType, nullptr, DEV_W, DEV_H},
controlPixelData.begin(), 0);
// Floating point textures are NOT supported everywhere
@@ -58,15 +58,16 @@
continue;
}
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(fpProxy->backendFormat(),
- colorType);
+ GrSwizzle swizzle = dContext->priv().caps()->getReadSwizzle(fpProxy->backendFormat(),
+ colorType);
GrSurfaceProxyView view(std::move(fpProxy), origin, swizzle);
- auto sContext = GrSurfaceContext::Make(context, std::move(view), colorType,
+ auto sContext = GrSurfaceContext::Make(dContext, std::move(view), colorType,
kPremul_SkAlphaType, nullptr);
REPORTER_ASSERT(reporter, sContext);
- bool result = sContext->readPixels({colorType, kPremul_SkAlphaType, nullptr, DEV_W, DEV_H},
- readBuffer.begin(), 0, {0, 0}, context);
+ bool result = sContext->readPixels(dContext,
+ {colorType, kPremul_SkAlphaType, nullptr, DEV_W, DEV_H},
+ readBuffer.begin(), 0, {0, 0});
REPORTER_ASSERT(reporter, result);
REPORTER_ASSERT(reporter,
0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBuffer.bytes()));