From e8a8a3be0b1962b704529ee590bd871554650629 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Wed, 26 Oct 2022 09:46:14 -0400 Subject: [PATCH] Replace some includes with forward declares in public headers Follow-up from https://skia-review.googlesource.com/c/skia/+/594807 These work as-is with my local Chrome build at least, so that's a good sign. Change-Id: Iaf459eae20e749c83fe73a14341979b68e14ab69 Bug: skia:13052 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/596076 Commit-Queue: Kevin Lubick Owners-Override: Kevin Lubick Reviewed-by: Ben Wagner --- include/effects/SkColorMatrix.h | 5 ++--- include/utils/SkNWayCanvas.h | 8 +++----- include/utils/SkPaintFilterCanvas.h | 4 +--- src/effects/SkColorMatrix.cpp | 2 ++ src/utils/SkNWayCanvas.cpp | 2 ++ 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/effects/SkColorMatrix.h b/include/effects/SkColorMatrix.h index 40c163188738..5092278f0def 100644 --- a/include/effects/SkColorMatrix.h +++ b/include/effects/SkColorMatrix.h @@ -10,12 +10,11 @@ #include "include/core/SkTypes.h" -// TODO(kjlubick, bungeman) replace this include with a forward declare. -#include "include/core/SkImageInfo.h" // IWYU pragma: keep - #include #include +enum SkYUVColorSpace : int; + class SK_API SkColorMatrix { public: constexpr SkColorMatrix() : SkColorMatrix(1, 0, 0, 0, 0, diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index f675e83c6510..603ef7ed89a6 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -19,17 +19,13 @@ #include "include/private/SkTDArray.h" #include "include/utils/SkNoDrawCanvas.h" -// TODO(kjlubick, bungeman) replace these includes with forward declares. -#include "include/core/SkBlendMode.h" // IWYU pragma: keep -#include "include/core/SkCanvas.h" // IWYU pragma: keep -#include "include/core/SkClipOp.h" // IWYU pragma: keep - #include namespace sktext { class GlyphRunList; } +class SkCanvas; class SkData; class SkDrawable; class SkImage; @@ -42,6 +38,8 @@ class SkRegion; class SkShader; class SkTextBlob; class SkVertices; +enum class SkBlendMode; +enum class SkClipOp; struct SkDrawShadowRec; struct SkPoint; struct SkRSXform; diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h index 0df8241501a6..88f4182e4efc 100644 --- a/include/utils/SkPaintFilterCanvas.h +++ b/include/utils/SkPaintFilterCanvas.h @@ -20,9 +20,6 @@ #include "include/private/SkTDArray.h" #include "include/utils/SkNWayCanvas.h" -// TODO(kjlubick, bungeman) replace this include with a forward declare. -#include "include/core/SkBlendMode.h" // IWYU pragma: keep - #include namespace sktext { @@ -44,6 +41,7 @@ class SkSurface; class SkSurfaceProps; class SkTextBlob; class SkVertices; +enum class SkBlendMode; struct SkDrawShadowRec; struct SkPoint; struct SkRSXform; diff --git a/src/effects/SkColorMatrix.cpp b/src/effects/SkColorMatrix.cpp index febaa591bd92..e9ed2a509ae8 100644 --- a/src/effects/SkColorMatrix.cpp +++ b/src/effects/SkColorMatrix.cpp @@ -8,6 +8,8 @@ #include "include/effects/SkColorMatrix.h" #include "src/core/SkYUVMath.h" +enum SkYUVColorSpace : int; + SkColorMatrix SkColorMatrix::RGBtoYUV(SkYUVColorSpace cs) { SkColorMatrix m; SkColorMatrix_RGB2YUV(cs, m.fMat.data()); diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index 22b01ef6e974..54e5a86d3e13 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -38,6 +38,8 @@ class SkRRect; class SkRegion; class SkTextBlob; class SkVertices; +enum class SkBlendMode; +enum class SkClipOp; struct SkDrawShadowRec; SkNWayCanvas::SkNWayCanvas(int width, int height) : INHERITED(width, height) {}