simplify GrFPArgs, isolating localmatrix
Bug: skia: Change-Id: Icee24e0a355a7d1bae29b7721b4d95db8023ca77 Reviewed-on: https://skia-review.googlesource.com/97063 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
ad6660a639
commit
b76c717025
@ -303,6 +303,7 @@ SkMaskFilter::filterRectsToNine(const SkRect[], int count, const SkMatrix&,
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> SkMaskFilter::asFragmentProcessor(const GrFPArgs& args) const {
|
||||
SkASSERT(args.fLocalMatrix == nullptr);
|
||||
auto fp = this->onAsFragmentProcessor(args);
|
||||
if (fp) {
|
||||
SkASSERT(this->hasFragmentProcessor());
|
||||
|
@ -15,7 +15,6 @@ class GrContext;
|
||||
class GrColorSpaceInfo;
|
||||
|
||||
struct GrFPArgs {
|
||||
GrFPArgs() {}
|
||||
GrFPArgs(GrContext* context,
|
||||
const SkMatrix* viewMatrix,
|
||||
const SkMatrix* localMatrix,
|
||||
@ -27,6 +26,16 @@ struct GrFPArgs {
|
||||
, fFilterQuality(filterQuality)
|
||||
, fDstColorSpaceInfo(dstColorSpaceInfo) {}
|
||||
|
||||
GrFPArgs(GrContext* context,
|
||||
const SkMatrix* viewMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
const GrColorSpaceInfo* dstColorSpaceInfo)
|
||||
: fContext(context)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fLocalMatrix(nullptr)
|
||||
, fFilterQuality(filterQuality)
|
||||
, fDstColorSpaceInfo(dstColorSpaceInfo) {}
|
||||
|
||||
GrContext* fContext;
|
||||
const SkMatrix* fViewMatrix;
|
||||
const SkMatrix* fLocalMatrix;
|
||||
|
@ -334,17 +334,13 @@ sk_sp<GrColorSpaceXform> TestColorXform(SkRandom* random) {
|
||||
return gXforms[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gXforms)))];
|
||||
}
|
||||
|
||||
TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d) {
|
||||
fViewMatrixStorage = TestMatrix(d->fRandom);
|
||||
fColorSpaceInfoStorage = skstd::make_unique<GrColorSpaceInfo>(TestColorSpace(d->fRandom),
|
||||
kRGBA_8888_GrPixelConfig);
|
||||
|
||||
fArgs.fContext = d->context();
|
||||
fArgs.fViewMatrix = &fViewMatrixStorage;
|
||||
fArgs.fLocalMatrix = nullptr;
|
||||
fArgs.fFilterQuality = kNone_SkFilterQuality;
|
||||
fArgs.fDstColorSpaceInfo = fColorSpaceInfoStorage.get();
|
||||
}
|
||||
TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
|
||||
: fViewMatrixStorage(TestMatrix(d->fRandom))
|
||||
, fColorSpaceInfoStorage(skstd::make_unique<GrColorSpaceInfo>(TestColorSpace(d->fRandom),
|
||||
kRGBA_8888_GrPixelConfig))
|
||||
, fArgs(d->context(), &fViewMatrixStorage, nullptr, kNone_SkFilterQuality,
|
||||
fColorSpaceInfoStorage.get())
|
||||
{}
|
||||
|
||||
TestAsFPArgs::~TestAsFPArgs() {}
|
||||
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
const GrFPArgs& args() const { return fArgs; }
|
||||
|
||||
private:
|
||||
GrFPArgs fArgs;
|
||||
SkMatrix fViewMatrixStorage;
|
||||
std::unique_ptr<GrColorSpaceInfo> fColorSpaceInfoStorage;
|
||||
GrFPArgs fArgs;
|
||||
};
|
||||
|
||||
// We have a simplified dash path effect here to avoid relying on SkDashPathEffect which
|
||||
|
@ -375,7 +375,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
// Convert SkPaint color to 4f format, including optional linearizing and gamut conversion.
|
||||
GrColor4f origColor = SkColorToUnpremulGrColor4f(skPaint.getColor(), colorSpaceInfo);
|
||||
|
||||
const GrFPArgs fpArgs(context, &viewM, nullptr, skPaint.getFilterQuality(), &colorSpaceInfo);
|
||||
const GrFPArgs fpArgs(context, &viewM, skPaint.getFilterQuality(), &colorSpaceInfo);
|
||||
|
||||
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
|
||||
// of per-vertex colors.
|
||||
|
@ -369,7 +369,7 @@ std::unique_ptr<GrFragmentProcessor> SkPictureShader::asFragmentProcessor(
|
||||
return nullptr;
|
||||
}
|
||||
return as_SB(bitmapShader)
|
||||
->asFragmentProcessor(GrFPArgs(args.fContext, args.fViewMatrix, nullptr,
|
||||
->asFragmentProcessor(GrFPArgs(args.fContext, args.fViewMatrix,
|
||||
args.fFilterQuality, args.fDstColorSpaceInfo));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user