Use raster pipeline for repeat/mirror radial gradients
(reland of https://skia-review.googlesource.com/c/24283/) The legacy clamp specialization is still faster, but for repeat and mirror RP wins (at low color stop counts). Change-Id: I97a77188e912239f31e94600021b469ce7c40797 Reviewed-on: https://skia-review.googlesource.com/24742 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
fe40abc14b
commit
2371da0731
@ -48,7 +48,11 @@ SkShaderBase::Context* SkRadialGradient::onMakeContext(
|
|||||||
|
|
||||||
SkRadialGradient::RadialGradientContext::RadialGradientContext(
|
SkRadialGradient::RadialGradientContext::RadialGradientContext(
|
||||||
const SkRadialGradient& shader, const ContextRec& rec)
|
const SkRadialGradient& shader, const ContextRec& rec)
|
||||||
: INHERITED(shader, rec) {}
|
: INHERITED(shader, rec) {
|
||||||
|
#ifndef SK_SUPPORT_LEGACY_RADIAL_GRADIENT
|
||||||
|
SkASSERT(shader.getTileMode() == SkShader::kClamp_TileMode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
|
SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
|
||||||
if (info) {
|
if (info) {
|
||||||
@ -359,6 +363,15 @@ sk_sp<SkShader> SkRadialGradient::onMakeColorSpace(SkColorSpaceXformer* xformer)
|
|||||||
&this->getLocalMatrix());
|
&this->getLocalMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SkRadialGradient::onIsRasterPipelineOnly() const {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_RADIAL_GRADIENT
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
// We have a clamp fast path; everything else -> RP.
|
||||||
|
return fTileMode != SkShader::kClamp_TileMode;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool SkRadialGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
|
bool SkRadialGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
|
||||||
SkMatrix* matrix,
|
SkMatrix* matrix,
|
||||||
SkRasterPipeline* p,
|
SkRasterPipeline* p,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "SkGradientShaderPriv.h"
|
#include "SkGradientShaderPriv.h"
|
||||||
|
|
||||||
class SkRadialGradient : public SkGradientShaderBase {
|
class SkRadialGradient final : public SkGradientShaderBase {
|
||||||
public:
|
public:
|
||||||
SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
|
SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
|
||||||
|
|
||||||
@ -41,7 +41,9 @@ protected:
|
|||||||
bool adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
|
bool adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
|
||||||
SkMatrix* matrix,
|
SkMatrix* matrix,
|
||||||
SkRasterPipeline* tPipeline,
|
SkRasterPipeline* tPipeline,
|
||||||
SkRasterPipeline* postPipeline) const final;
|
SkRasterPipeline* postPipeline) const override;
|
||||||
|
|
||||||
|
bool onIsRasterPipelineOnly() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const SkPoint fCenter;
|
const SkPoint fCenter;
|
||||||
|
Loading…
Reference in New Issue
Block a user