tiny extra optimization for SkColor4fXformer

When dst is null we can't hit the Equals() fast path,
as Equals() says only null == null.  Instead treat
null dst as src, i.e. skip the transform.

This should be an observable no-op... SkConvertPixels
will recognize null dst == src and do no color transform.
This CL just avoids the extra copy.

Change-Id: I7c1983d5db733a2dd036d84c2ff91add136e1c68
Reviewed-on: https://skia-review.googlesource.com/c/161587
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2018-10-12 14:23:06 -04:00 committed by Skia Commit-Bot
parent 222e275b0a
commit f9f68ffa30

View File

@ -462,7 +462,7 @@ SkColor4fXformer::SkColor4fXformer(const SkColor4f* colors, int colorCount,
SkColorSpace* src, SkColorSpace* dst) {
fColors = colors;
if (!SkColorSpace::Equals(src, dst)) {
if (dst && !SkColorSpace::Equals(src, dst)) {
fStorage.reset(colorCount);
auto info = SkImageInfo::Make(colorCount,1, kRGBA_F32_SkColorType, kUnpremul_SkAlphaType);