Only enlarge bounds for color filters that affect transparent black

Change-Id: I695ee063d700bea1956290d12ddfa7e0792ff894
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432258
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 0f3de30..c88bf4b 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -8,6 +8,7 @@
 #include "include/core/SkBBHFactory.h"
 #include "include/core/SkImage.h"
 #include "src/core/SkCanvasPriv.h"
+#include "src/core/SkColorFilterBase.h"
 #include "src/core/SkRecordDraw.h"
 #include "src/utils/SkPatchUtils.h"
 
@@ -312,7 +313,9 @@
     static bool PaintMayAffectTransparentBlack(const SkPaint* paint) {
         if (paint) {
             // FIXME: this is very conservative
-            if (paint->getImageFilter() || paint->getColorFilter()) {
+            if (paint->getImageFilter() ||
+                (paint->getColorFilter() &&
+                 as_CFB(paint->getColorFilter())->affectsTransparentBlack())) {
                 return true;
             }
             const auto bm = paint->asBlendMode();