Reland "Migrate GrSurfaceContext readPixels to take direct context"
This reverts commit cf0d08e149cfea45b2bc70ec22181315d33ddb3f.
Reason for revert: fix codegen
Original change's description:
> Revert "Migrate GrSurfaceContext readPixels to take direct context"
>
> This reverts commit d169e1915cba8caaddabb22b3672c7cefa91bfa2.
>
> Reason for revert: broke chrome via code generator
>
> Original change's description:
> > 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>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I6126f2dca4bc902c903512ac486e22841cc472e5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309281
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>
TBR=robertphillips@google.com,adlai@google.com
Bug: skia:104662
Change-Id: If899edab54d031a3619a4bbab90d13738679c037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309319
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 70f44db..568e5f2 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -564,17 +564,17 @@
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
static const int kNumViews = 3;
- auto context = ctxInfo.directContext();
- auto proxyProvider = context->priv().proxyProvider();
+ auto dContext = ctxInfo.directContext();
+ auto proxyProvider = dContext->priv().proxyProvider();
AtlasObject object(reporter);
- context->priv().addOnFlushCallbackObject(&object);
+ dContext->priv().addOnFlushCallbackObject(&object);
GrSurfaceProxyView views[kNumViews];
for (int i = 0; i < kNumViews; ++i) {
- views[i] = make_upstream_image(context, &object, i * 3,
- object.getAtlasView(proxyProvider, context->priv().caps()),
+ views[i] = make_upstream_image(dContext, &object, i * 3,
+ object.getAtlasView(proxyProvider, dContext->priv().caps()),
kPremul_SkAlphaType);
}
@@ -582,7 +582,7 @@
static const int kFinalHeight = kDrawnTileSize;
auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox,
+ dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox,
{kFinalWidth, kFinalHeight});
rtc->clear(SK_PMColor4fWHITE);
@@ -606,11 +606,10 @@
SkBitmap readBack;
readBack.allocN32Pixels(kFinalWidth, kFinalHeight);
- SkDEBUGCODE(bool result =) rtc->readPixels(readBack.info(), readBack.getPixels(),
- readBack.rowBytes(), {0, 0});
- SkASSERT(result);
+ SkAssertResult(rtc->readPixels(dContext, readBack.info(), readBack.getPixels(),
+ readBack.rowBytes(), {0, 0}));
- context->priv().testingOnly_flushAndRemoveOnFlushCallbackObject(&object);
+ dContext->priv().testingOnly_flushAndRemoveOnFlushCallbackObject(&object);
object.markAsDone();