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/src/gpu/effects/generated/GrConfigConversionEffect.cpp b/src/gpu/effects/generated/GrConfigConversionEffect.cpp
index a495915..1651a1d 100644
--- a/src/gpu/effects/generated/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/generated/GrConfigConversionEffect.cpp
@@ -28,7 +28,7 @@
(void)pmConversion;
fragBuilder->forceHighPrecision();
- SkString _sample5748 = this->invokeChild(0, args);
+ SkString _sample5773 = this->invokeChild(0, args);
fragBuilder->codeAppendf(
R"SkSL(%s = floor(%s * 255.0 + 0.5) / 255.0;
@switch (%d) {
@@ -40,7 +40,7 @@
break;
}
)SkSL",
- args.fOutputColor, _sample5748.c_str(), (int)_outer.pmConversion, args.fOutputColor,
+ args.fOutputColor, _sample5773.c_str(), (int)_outer.pmConversion, args.fOutputColor,
args.fOutputColor, args.fOutputColor, args.fOutputColor, args.fOutputColor,
args.fOutputColor, args.fOutputColor);
}
@@ -86,7 +86,7 @@
}
#endif
-bool GrConfigConversionEffect::TestForPreservingPMConversions(GrDirectContext* context) {
+bool GrConfigConversionEffect::TestForPreservingPMConversions(GrDirectContext* dContext) {
static constexpr int kSize = 256;
static constexpr GrColorType kColorType = GrColorType::kRGBA_8888;
SkAutoTMalloc<uint32_t> data(kSize * kSize * 3);
@@ -112,9 +112,9 @@
const SkImageInfo ii =
SkImageInfo::Make(kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
- auto readRTC = GrRenderTargetContext::Make(context, kColorType, nullptr, SkBackingFit::kExact,
+ auto readRTC = GrRenderTargetContext::Make(dContext, kColorType, nullptr, SkBackingFit::kExact,
{kSize, kSize});
- auto tempRTC = GrRenderTargetContext::Make(context, kColorType, nullptr, SkBackingFit::kExact,
+ auto tempRTC = GrRenderTargetContext::Make(dContext, kColorType, nullptr, SkBackingFit::kExact,
{kSize, kSize});
if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
return false;
@@ -130,7 +130,7 @@
bitmap.installPixels(ii, srcData, 4 * kSize);
bitmap.setImmutable();
- GrBitmapTextureMaker maker(context, bitmap, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
+ GrBitmapTextureMaker maker(dContext, bitmap, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
auto dataView = maker.view(GrMipmapped::kNo);
if (!dataView) {
return false;
@@ -149,7 +149,7 @@
paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
readRTC->fillRectToRect(nullptr, std::move(paint1), GrAA::kNo, SkMatrix::I(), kRect, kRect);
- if (!readRTC->readPixels(ii, firstRead, 0, {0, 0})) {
+ if (!readRTC->readPixels(dContext, ii, firstRead, 0, {0, 0})) {
return false;
}
@@ -173,7 +173,7 @@
readRTC->fillRectToRect(nullptr, std::move(paint3), GrAA::kNo, SkMatrix::I(), kRect, kRect);
- if (!readRTC->readPixels(ii, secondRead, 0, {0, 0})) {
+ if (!readRTC->readPixels(dContext, ii, secondRead, 0, {0, 0})) {
return false;
}