GrFPArgs no longer needs sampling
Change-Id: I20fc4b4c3d6997f3ebc1d6d0049447b348f8a110 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387416 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
045d7513d7
commit
12a75588e7
@ -110,9 +110,8 @@ protected:
|
||||
// Create a base-layer FP for the const color processor to draw on top of.
|
||||
std::unique_ptr<GrFragmentProcessor> baseFP;
|
||||
if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
|
||||
SkSamplingOptions high(SkCubicResampler::Mitchell());
|
||||
GrColorInfo colorInfo;
|
||||
GrFPArgs args(context, SkSimpleMatrixProvider(SkMatrix::I()), high, &colorInfo);
|
||||
GrFPArgs args(context, SkSimpleMatrixProvider(SkMatrix::I()), &colorInfo);
|
||||
baseFP = as_SB(fShader)->asFragmentProcessor(args);
|
||||
} else {
|
||||
baseFP = GrConstColorProcessor::Make(
|
||||
|
@ -98,8 +98,7 @@ DEF_SIMPLE_GPU_GM(sample_matrix_constant, ctx, rtCtx, canvas, 1024, 256) {
|
||||
SkMatrix matrix;
|
||||
SkSimpleMatrixProvider matrixProvider(matrix);
|
||||
GrColorInfo colorInfo;
|
||||
GrFPArgs args(ctx, matrixProvider, SkSamplingOptions(SkCubicResampler::Mitchell()),
|
||||
&colorInfo);
|
||||
GrFPArgs args(ctx, matrixProvider, &colorInfo);
|
||||
std::unique_ptr<GrFragmentProcessor> gradientFP = as_SB(shader)->asFragmentProcessor(args);
|
||||
draw(std::move(gradientFP), 512, 0);
|
||||
gradientFP = as_SB(shader)->asFragmentProcessor(args);
|
||||
|
@ -96,8 +96,7 @@ DEF_SIMPLE_GPU_GM(sample_matrix_variable, ctx, rtCtx, canvas, 512, 256) {
|
||||
SkMatrix matrix;
|
||||
SkSimpleMatrixProvider matrixProvider(matrix);
|
||||
GrColorInfo colorInfo;
|
||||
GrFPArgs args(ctx, matrixProvider, SkSamplingOptions(SkCubicResampler::Mitchell()),
|
||||
&colorInfo);
|
||||
GrFPArgs args(ctx, matrixProvider, &colorInfo);
|
||||
std::unique_ptr<GrFragmentProcessor> gradientFP = as_SB(shader)->asFragmentProcessor(args);
|
||||
draw(std::move(gradientFP), -128, 256, 256, 0);
|
||||
}
|
||||
|
@ -845,10 +845,7 @@ sk_sp<SkImage> SkRuntimeEffect::makeImage(GrRecordingContext* recordingContext,
|
||||
"runtime_image",
|
||||
std::move(uniforms));
|
||||
GrColorInfo colorInfo(resultInfo.colorInfo());
|
||||
GrFPArgs args(recordingContext,
|
||||
matrixProvider,
|
||||
SkSamplingOptions{},
|
||||
&colorInfo);
|
||||
GrFPArgs args(recordingContext, matrixProvider, &colorInfo);
|
||||
for (size_t i = 0; i < childCount; ++i) {
|
||||
if (!children[i]) {
|
||||
return nullptr;
|
||||
|
@ -1293,7 +1293,7 @@ GrClip::Effect GrClipStack::apply(GrRecordingContext* context, GrSurfaceDrawCont
|
||||
if (cs.shader()) {
|
||||
static const GrColorInfo kCoverageColorInfo{GrColorType::kUnknown, kPremul_SkAlphaType,
|
||||
nullptr};
|
||||
GrFPArgs args(context, *fMatrixProvider, SkSamplingOptions(), &kCoverageColorInfo);
|
||||
GrFPArgs args(context, *fMatrixProvider, &kCoverageColorInfo);
|
||||
clipFP = as_SB(cs.shader())->asFragmentProcessor(args);
|
||||
if (clipFP) {
|
||||
// The initial input is the coverage from the geometry processor, so this ensures it
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define GrFPArgs_DEFINED
|
||||
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkSamplingOptions.h"
|
||||
|
||||
class GrColorInfo;
|
||||
class GrRecordingContext;
|
||||
@ -18,11 +17,9 @@ class SkMatrixProvider;
|
||||
struct GrFPArgs {
|
||||
GrFPArgs(GrRecordingContext* context,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
const SkSamplingOptions& sampling,
|
||||
const GrColorInfo* dstColorInfo)
|
||||
: fContext(context)
|
||||
, fMatrixProvider(matrixProvider)
|
||||
, fSampling(sampling)
|
||||
, fDstColorInfo(dstColorInfo) {
|
||||
SkASSERT(fContext);
|
||||
}
|
||||
@ -30,7 +27,7 @@ struct GrFPArgs {
|
||||
class WithPreLocalMatrix;
|
||||
|
||||
GrFPArgs withNewMatrixProvider(const SkMatrixProvider& provider) const {
|
||||
GrFPArgs newArgs(fContext, provider, fSampling, fDstColorInfo);
|
||||
GrFPArgs newArgs(fContext, provider, fDstColorInfo);
|
||||
newArgs.fInputColorIsOpaque = fInputColorIsOpaque;
|
||||
newArgs.fPreLocalMatrix = fPreLocalMatrix;
|
||||
return newArgs;
|
||||
@ -44,8 +41,6 @@ struct GrFPArgs {
|
||||
// Make this SkAlphaType?
|
||||
bool fInputColorIsOpaque = false;
|
||||
|
||||
SkSamplingOptions fSampling;
|
||||
bool fAllowFilterQualityReduction = true;
|
||||
const GrColorInfo* fDstColorInfo;
|
||||
};
|
||||
|
||||
|
@ -927,7 +927,7 @@ GrFPResult GrReducedClip::finishAndDetachAnalyticElements(GrRecordingContext* co
|
||||
if (fShader != nullptr) {
|
||||
static const GrColorInfo kCoverageColorInfo{GrColorType::kUnknown, kPremul_SkAlphaType,
|
||||
nullptr};
|
||||
GrFPArgs args(context, matrixProvider, SkSamplingOptions(), &kCoverageColorInfo);
|
||||
GrFPArgs args(context, matrixProvider, &kCoverageColorInfo);
|
||||
shaderFP = as_SB(fShader)->asFragmentProcessor(args);
|
||||
if (shaderFP != nullptr) {
|
||||
shaderFP = GrFragmentProcessor::MulInputByChildAlpha(std::move(shaderFP));
|
||||
|
@ -347,7 +347,6 @@ TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
|
||||
GrColorType::kRGBA_8888, kPremul_SkAlphaType, TestColorSpace(d->fRandom)))
|
||||
, fArgs(d->context(),
|
||||
fMatrixProvider,
|
||||
SkSamplingOptions(),
|
||||
fColorInfoStorage.get()) {}
|
||||
|
||||
TestAsFPArgs::~TestAsFPArgs() {}
|
||||
|
@ -898,11 +898,8 @@ void SkGpuDevice::drawAtlas(const SkImage* atlas, const SkRSXform xform[],
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a fragment processor for atlas image. Filter-quality reduction is disabled because the
|
||||
// SkRSXform matrices might include scale or non-trivial rotation.
|
||||
GrFPArgs fpArgs(fContext.get(), this->asMatrixProvider(), sampling,
|
||||
&fSurfaceDrawContext->colorInfo());
|
||||
fpArgs.fAllowFilterQualityReduction = false;
|
||||
// Create a fragment processor for atlas image.
|
||||
GrFPArgs fpArgs(fContext.get(), this->asMatrixProvider(), &fSurfaceDrawContext->colorInfo());
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> shaderFP = as_SB(shader)->asFragmentProcessor(fpArgs);
|
||||
if (shaderFP == nullptr) {
|
||||
|
@ -225,14 +225,10 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
|
||||
std::unique_ptr<GrFragmentProcessor>* shaderProcessor,
|
||||
SkBlendMode* primColorMode,
|
||||
GrPaint* grPaint) {
|
||||
// TODO: take sampling directly
|
||||
SkSamplingOptions sampling(skPaint.getFilterQuality(),
|
||||
SkSamplingOptions::kMedium_asMipmapLinear);
|
||||
|
||||
// Convert SkPaint color to 4f format in the destination color space
|
||||
SkColor4f origColor = SkColor4fPrepForDst(skPaint.getColor4f(), dstColorInfo);
|
||||
|
||||
GrFPArgs fpArgs(context, matrixProvider, sampling, &dstColorInfo);
|
||||
GrFPArgs fpArgs(context, matrixProvider, &dstColorInfo);
|
||||
|
||||
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
|
||||
// of per-vertex colors.
|
||||
@ -433,15 +429,11 @@ bool SkPaintToGrPaintWithTexture(GrRecordingContext* context,
|
||||
std::unique_ptr<GrFragmentProcessor> fp,
|
||||
bool textureIsAlphaOnly,
|
||||
GrPaint* grPaint) {
|
||||
// TODO: take sampling directly
|
||||
SkSamplingOptions sampling(paint.getFilterQuality(),
|
||||
SkSamplingOptions::kMedium_asMipmapLinear);
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> shaderFP;
|
||||
if (textureIsAlphaOnly) {
|
||||
if (const auto* shader = as_SB(paint.getShader())) {
|
||||
shaderFP = shader->asFragmentProcessor(
|
||||
GrFPArgs(context, matrixProvider, sampling, &dstColorInfo));
|
||||
GrFPArgs(context, matrixProvider, &dstColorInfo));
|
||||
if (!shaderFP) {
|
||||
return false;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ static void test_unsorted_degenerate(skiatest::Reporter* r) {
|
||||
GrMockOptions options;
|
||||
auto context = GrDirectContext::MakeMock(&options);
|
||||
|
||||
GrFPArgs args(context.get(), provider, SkSamplingOptions(), &dstColorInfo);
|
||||
GrFPArgs args(context.get(), provider, &dstColorInfo);
|
||||
as_SB(gradient)->asFragmentProcessor(args);
|
||||
}
|
||||
|
||||
|
@ -704,8 +704,7 @@ static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(
|
||||
pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
|
||||
GrColorInfo colorInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr);
|
||||
SkSimpleMatrixProvider matrixProvider(SkMatrix::I());
|
||||
GrFPArgs args(rContext, matrixProvider, SkSamplingOptions(SkFilterMode::kLinear), &colorInfo);
|
||||
return as_SB(shader)->asFragmentProcessor(args);
|
||||
return as_SB(shader)->asFragmentProcessor({rContext, matrixProvider, &colorInfo});
|
||||
}
|
||||
|
||||
static void test_path(GrRecordingContext* rContext,
|
||||
|
Loading…
Reference in New Issue
Block a user