From f9f68ffa309b67d81b505c1631883cecb018dd9c Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Fri, 12 Oct 2018 14:23:06 -0400 Subject: [PATCH] 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 Commit-Queue: Brian Osman Auto-Submit: Mike Klein Reviewed-by: Brian Osman --- src/shaders/gradients/SkGradientShader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp index 39c34702d4..e5801dea4b 100644 --- a/src/shaders/gradients/SkGradientShader.cpp +++ b/src/shaders/gradients/SkGradientShader.cpp @@ -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);