Skip clamps in color xform pipelines if possible.
This does skip clamp_0 when converting sRGB to your default colorspace. Each clamp is ~2% of the pipeline runtime, so it's small, but might as well. Change-Id: I2bb0dadf84759c31cc825f9b6b17680e7aa7d9f3 Reviewed-on: https://skia-review.googlesource.com/5467 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
a6abb57b99
commit
5e15961fa7
@ -15,6 +15,7 @@
|
||||
#include "SkColorSpaceXformPriv.h"
|
||||
#include "SkHalf.h"
|
||||
#include "SkOpts.h"
|
||||
#include "SkPM4fPriv.h"
|
||||
#include "SkRasterPipeline.h"
|
||||
#include "SkSRGB.h"
|
||||
|
||||
@ -1353,11 +1354,14 @@ bool SkColorSpaceXform_Pipeline::onApply(ColorFormat dstColorFormat, void* dst,
|
||||
|
||||
if (kNone_ColorSpaceMatch == fCSM) {
|
||||
pipeline.append(SkRasterPipeline::matrix_3x4, fSrcToDst);
|
||||
}
|
||||
|
||||
if (kRGBA_8888_ColorFormat == dstColorFormat || kBGRA_8888_ColorFormat == dstColorFormat) {
|
||||
pipeline.append(SkRasterPipeline::clamp_0);
|
||||
pipeline.append(SkRasterPipeline::clamp_1);
|
||||
if (kRGBA_8888_ColorFormat == dstColorFormat || kBGRA_8888_ColorFormat == dstColorFormat) {
|
||||
bool need_clamp_0, need_clamp_1;
|
||||
analyze_3x4_matrix(fSrcToDst, &need_clamp_0, &need_clamp_1);
|
||||
|
||||
if (need_clamp_0) { pipeline.append(SkRasterPipeline::clamp_0); }
|
||||
if (need_clamp_1) { pipeline.append(SkRasterPipeline::clamp_1); }
|
||||
}
|
||||
}
|
||||
|
||||
if (kPremul_SkAlphaType == alphaType) {
|
||||
|
Loading…
Reference in New Issue
Block a user