remove append_from_srgb()
It's now no different than append(from_srgb). Bug: skia:7419 Change-Id: I97c59b6987f033ec2f1859db40ca3056b87b370a Reviewed-on: https://skia-review.googlesource.com/86741 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
95152e1c83
commit
f1f1162273
@ -42,14 +42,14 @@ public:
|
||||
|
||||
SkRasterPipeline_<256> p;
|
||||
p.append(SkRasterPipeline::load_8888, &src_ctx);
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
p.append(SkRasterPipeline::scale_u8, &mask_ctx);
|
||||
p.append(SkRasterPipeline::move_src_dst);
|
||||
if (kF16) {
|
||||
p.append(SkRasterPipeline::load_f16, &dst_ctx);
|
||||
} else {
|
||||
p.append(SkRasterPipeline::load_8888, &dst_ctx);
|
||||
p.append_from_srgb(kPremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
p.append(SkRasterPipeline::dstover);
|
||||
if (kF16) {
|
||||
|
@ -364,7 +364,7 @@ static void blend_line(SkColorType dstCT, void* dst,
|
||||
// Load the final dst.
|
||||
p.append(load_dst, &dst_ctx);
|
||||
if (needsSrgbToLinear) {
|
||||
p.append_from_srgb(dstAt);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
if (kUnpremul_SkAlphaType == dstAt) {
|
||||
p.append(SkRasterPipeline::premul);
|
||||
@ -376,7 +376,7 @@ static void blend_line(SkColorType dstCT, void* dst,
|
||||
pick_memory_stages(srcCT, &load_src, nullptr);
|
||||
p.append(load_src, &src_ctx);
|
||||
if (needsSrgbToLinear) {
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
if (srcHasAlpha) {
|
||||
p.append(SkRasterPipeline::premul);
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
}
|
||||
if (fDst.colorSpace() &&
|
||||
(!fSource.colorSpace() || fSource.colorSpace()->gammaCloseToSRGB())) {
|
||||
p.append_from_srgb(fSource.alphaType());
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
if (fSource.colorType() == kAlpha_8_SkColorType) {
|
||||
p.append(SkRasterPipeline::set_rgb, &fPaintColor);
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
p->append(SkRasterPipeline::to_srgb);
|
||||
break;
|
||||
case Direction::kSRGBToLinear:
|
||||
p->append_from_srgb(shaderIsOpaque ? kOpaque_SkAlphaType : kUnpremul_SkAlphaType);
|
||||
p->append(SkRasterPipeline::from_srgb);
|
||||
break;
|
||||
}
|
||||
if (!shaderIsOpaque) {
|
||||
|
@ -485,7 +485,7 @@ bool SkColorSpaceXform_XYZ::onApply(ColorFormat dstColorFormat, void* dst,
|
||||
break;
|
||||
case kSRGB_SrcGamma:
|
||||
pipeline.append(SkRasterPipeline::load_u16_be, &src_ctx);
|
||||
pipeline.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
pipeline.append(SkRasterPipeline::from_srgb);
|
||||
break;
|
||||
case kTable_SrcGamma:
|
||||
loadTables.fSrc = src;
|
||||
@ -503,7 +503,7 @@ bool SkColorSpaceXform_XYZ::onApply(ColorFormat dstColorFormat, void* dst,
|
||||
break;
|
||||
case kSRGB_SrcGamma:
|
||||
pipeline.append(SkRasterPipeline::load_rgb_u16_be, &src_ctx);
|
||||
pipeline.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
pipeline.append(SkRasterPipeline::from_srgb);
|
||||
break;
|
||||
case kTable_SrcGamma:
|
||||
loadTables.fSrc = src;
|
||||
|
@ -140,8 +140,7 @@ SkColorSpaceXform_A2B::SkColorSpaceXform_A2B(SkColorSpace_A2B* srcSpace,
|
||||
// Take the fast path for ordinary sRGB.
|
||||
if (3 == currentChannels && kSRGB_SkGammaNamed == e.gammaNamed()) {
|
||||
SkCSXformPrintf("fast path from sRGB\n");
|
||||
// Images should always start the pipeline as unpremul
|
||||
fElementsPipeline.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
fElementsPipeline.append(SkRasterPipeline::from_srgb);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ namespace {
|
||||
return { 1,1, 0,0,0,0,0 };
|
||||
}
|
||||
|
||||
void linearizeDst(SkRasterPipeline*, SkAlphaType) const override {}
|
||||
void linearizeSrc(SkRasterPipeline*, SkAlphaType) const override {}
|
||||
void encodeSrc(SkRasterPipeline* ) const override {}
|
||||
void linearizeDst(SkRasterPipeline*) const override {}
|
||||
void linearizeSrc(SkRasterPipeline*) const override {}
|
||||
void encodeSrc(SkRasterPipeline*) const override {}
|
||||
};
|
||||
|
||||
struct SRGBTransferFn : public SkColorSpace_New::TransferFn {
|
||||
@ -28,11 +28,11 @@ namespace {
|
||||
return { 2.4f, 1/1.055f, 0.055f/1.055f, 1/12.92f, 0.04045f, 0, 0 };
|
||||
}
|
||||
|
||||
void linearizeDst(SkRasterPipeline* p, SkAlphaType at) const override {
|
||||
p->append_from_srgb_dst(at);
|
||||
void linearizeDst(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::from_srgb_dst);
|
||||
}
|
||||
void linearizeSrc(SkRasterPipeline* p, SkAlphaType at) const override {
|
||||
p->append_from_srgb(at);
|
||||
void linearizeSrc(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
void encodeSrc(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::to_srgb);
|
||||
@ -49,13 +49,11 @@ namespace {
|
||||
return { fGamma, 1, 0,0,0,0,0 };
|
||||
}
|
||||
|
||||
void linearizeDst(SkRasterPipeline* p, SkAlphaType) const override {
|
||||
void linearizeDst(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::gamma_dst, &fGamma);
|
||||
// TODO: use SkAlphaType to clamp like SRGBTransferFn does?
|
||||
}
|
||||
void linearizeSrc(SkRasterPipeline* p, SkAlphaType) const override {
|
||||
void linearizeSrc(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::gamma, &fGamma);
|
||||
// TODO: use SkAlphaType to clamp like SRGBTransferFn does?
|
||||
}
|
||||
void encodeSrc(SkRasterPipeline* p) const override {
|
||||
p->append(SkRasterPipeline::gamma, &fInv);
|
||||
|
@ -26,9 +26,9 @@ public:
|
||||
virtual SkColorSpaceTransferFn parameterize() const = 0;
|
||||
|
||||
// Append stages to use this transfer function with SkRasterPipeline-based rendering.
|
||||
virtual void linearizeDst(SkRasterPipeline*, SkAlphaType) const = 0;
|
||||
virtual void linearizeSrc(SkRasterPipeline*, SkAlphaType) const = 0;
|
||||
virtual void encodeSrc(SkRasterPipeline* ) const = 0;
|
||||
virtual void linearizeDst(SkRasterPipeline*) const = 0;
|
||||
virtual void linearizeSrc(SkRasterPipeline*) const = 0;
|
||||
virtual void encodeSrc(SkRasterPipeline*) const = 0;
|
||||
|
||||
// TODO: Ganesh hooks.
|
||||
|
||||
|
@ -253,7 +253,7 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size
|
||||
|
||||
SkColorSpaceTransferFn srcFn;
|
||||
if (isColorAware && srcInfo.gammaCloseToSRGB()) {
|
||||
pipeline.append_from_srgb(premulState);
|
||||
pipeline.append(SkRasterPipeline::from_srgb);
|
||||
} else if (isColorAware && !srcInfo.colorSpace()->gammaIsLinear()) {
|
||||
SkAssertResult(srcInfo.colorSpace()->isNumericalTransferFn(&srcFn));
|
||||
if (is_just_gamma(srcFn)) {
|
||||
|
@ -21,7 +21,6 @@ void SkRasterPipeline::reset() {
|
||||
}
|
||||
|
||||
void SkRasterPipeline::append(StockStage stage, void* ctx) {
|
||||
SkASSERT(stage != from_srgb); // Please use append_from_srgb().
|
||||
SkASSERT(stage != uniform_color); // Please use append_constant_color().
|
||||
SkASSERT(stage != seed_shader); // Please use append_seed_shader().
|
||||
this->unchecked_append(stage, ctx);
|
||||
@ -123,15 +122,6 @@ void SkRasterPipeline::append_constant_color(SkArenaAlloc* alloc, const float rg
|
||||
#undef INC_WHITE
|
||||
#undef INC_COLOR
|
||||
|
||||
// TODO: we used to clamp to [0,a]] here if at == kPremul, but don't anymore.
|
||||
// These should no longer need to be special append() methods.
|
||||
void SkRasterPipeline::append_from_srgb(SkAlphaType) {
|
||||
this->unchecked_append(from_srgb, nullptr);
|
||||
}
|
||||
void SkRasterPipeline::append_from_srgb_dst(SkAlphaType) {
|
||||
this->unchecked_append(from_srgb_dst, nullptr);
|
||||
}
|
||||
|
||||
//static int gCounts[5] = { 0, 0, 0, 0, 0 };
|
||||
|
||||
void SkRasterPipeline::append_matrix(SkArenaAlloc* alloc, const SkMatrix& matrix) {
|
||||
|
@ -125,11 +125,6 @@ public:
|
||||
|
||||
void dump() const;
|
||||
|
||||
// Conversion from sRGB can be subtly tricky when premultiplication is involved.
|
||||
// Use these helpers to keep things sane.
|
||||
void append_from_srgb(SkAlphaType);
|
||||
void append_from_srgb_dst(SkAlphaType);
|
||||
|
||||
// Appends a stage for the specified matrix.
|
||||
// Tries to optimize the stage by analyzing the type of matrix.
|
||||
void append_matrix(SkArenaAlloc*, const SkMatrix&);
|
||||
|
@ -238,7 +238,7 @@ void SkRasterPipelineBlitter::append_load_dst(SkRasterPipeline* p) const {
|
||||
default: break;
|
||||
}
|
||||
if (fDst.info().gammaCloseToSRGB()) {
|
||||
p->append_from_srgb_dst(fDst.info().alphaType());
|
||||
p->append(SkRasterPipeline::from_srgb_dst);
|
||||
}
|
||||
if (fDst.info().alphaType() == kUnpremul_SkAlphaType) {
|
||||
p->append(SkRasterPipeline::premul_dst);
|
||||
|
@ -27,8 +27,7 @@ void SkToSRGBColorFilter::onAppendStages(SkRasterPipeline* p,
|
||||
if (fSrcColorSpace->gammaIsLinear()) {
|
||||
// Nothing to do.
|
||||
} else if (fSrcColorSpace->gammaCloseToSRGB()) {
|
||||
p->append_from_srgb(shaderIsOpaque ? kOpaque_SkAlphaType
|
||||
: kPremul_SkAlphaType);
|
||||
p->append(SkRasterPipeline::from_srgb);
|
||||
} else if (fSrcColorSpace->isNumericalTransferFn(&srcFn)) {
|
||||
auto copy = alloc->make<SkColorSpaceTransferFn>(srcFn);
|
||||
p->append(SkRasterPipeline::parametric_r, copy);
|
||||
|
@ -175,7 +175,7 @@ static inline void transform_scanline_unpremultiply_sRGB(void* dst, const void*
|
||||
p.append(SkRasterPipeline::load_bgra, &src_ctx);
|
||||
}
|
||||
|
||||
p.append_from_srgb(kPremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
p.append(SkRasterPipeline::unpremul);
|
||||
p.append(SkRasterPipeline::to_srgb);
|
||||
p.append(SkRasterPipeline::store_8888, &dst_ctx);
|
||||
@ -201,7 +201,7 @@ static inline void transform_scanline_to_premul_linear(char* SK_RESTRICT dst,
|
||||
dst_ctx = { (void*)dst, 0 };
|
||||
SkRasterPipeline_<256> p;
|
||||
p.append(SkRasterPipeline::load_8888, &src_ctx);
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
p.append(SkRasterPipeline::premul);
|
||||
p.append(SkRasterPipeline::to_srgb);
|
||||
p.append(SkRasterPipeline::store_8888, &dst_ctx);
|
||||
|
@ -347,7 +347,7 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
|
||||
default: SkASSERT(false);
|
||||
}
|
||||
if (rec.fDstCS && (!info.colorSpace() || info.gammaCloseToSRGB())) {
|
||||
p->append_from_srgb(info.alphaType());
|
||||
p->append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ DEF_TEST(sk_pipeline_srgb_roundtrip, r) {
|
||||
|
||||
SkRasterPipeline_<256> p;
|
||||
p.append(SkRasterPipeline::load_8888, &ptr);
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
p.append(SkRasterPipeline::to_srgb);
|
||||
p.append(SkRasterPipeline::store_8888, &ptr);
|
||||
|
||||
|
@ -62,11 +62,11 @@ DEF_TEST(SkColorSpace_New_TransferFnStages, r) {
|
||||
SkRasterPipeline_<256> p;
|
||||
|
||||
p.append(SkRasterPipeline::load_8888, &src_ctx);
|
||||
cs->transferFn().linearizeSrc(&p, kUnpremul_SkAlphaType);
|
||||
cs->transferFn().linearizeSrc(&p);
|
||||
p.append(SkRasterPipeline::premul);
|
||||
|
||||
p.append(SkRasterPipeline::load_8888_dst, &dst_ctx);
|
||||
cs->transferFn().linearizeDst(&p, kUnpremul_SkAlphaType);
|
||||
cs->transferFn().linearizeDst(&p);
|
||||
p.append(SkRasterPipeline::premul_dst);
|
||||
|
||||
p.append(SkRasterPipeline::srcover);
|
||||
|
@ -95,7 +95,7 @@ namespace sk_tools {
|
||||
default: SkASSERT(false); // DM doesn't support any other formats, does it?
|
||||
}
|
||||
if (bitmap.info().gammaCloseToSRGB()) {
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::from_srgb);
|
||||
}
|
||||
p.append(SkRasterPipeline::unpremul);
|
||||
p.append(SkRasterPipeline::clamp_0);
|
||||
|
Loading…
Reference in New Issue
Block a user