[graphite] Move the bicubic padding constant out of GrBicubicEffect
This removes another Ganesh-specific usage in code that will be shared in the large image tiling API (i.e., in draw_tiled_bitmap).
Bug: b/267656937
Change-Id: Id730b51d0a40b0eca8e7d7e67e2fe9feb071a0a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/702337
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/core/SkSamplingPriv.h b/src/core/SkSamplingPriv.h
index 1972a20..bf9e4e3 100644
--- a/src/core/SkSamplingPriv.h
+++ b/src/core/SkSamplingPriv.h
@@ -13,6 +13,10 @@
class SkReadBuffer;
class SkWriteBuffer;
+// Given a src rect in texels to be filtered, this number of surrounding texels are needed by
+// the kernel in x and y.
+static constexpr int kBicubicFilterTexelPad = 2;
+
// Private copy of SkFilterQuality, just for legacy deserialization
// Matches values in SkFilterQuality
enum SkLegacyFQ {
diff --git a/src/gpu/ganesh/Device_drawTexture.cpp b/src/gpu/ganesh/Device_drawTexture.cpp
index 3f65d8a..33f672a 100644
--- a/src/gpu/ganesh/Device_drawTexture.cpp
+++ b/src/gpu/ganesh/Device_drawTexture.cpp
@@ -27,7 +27,6 @@
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
-#include "src/gpu/ganesh/effects/GrBicubicEffect.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrRect.h"
@@ -626,7 +625,7 @@
// not bleed across the original clamped edges)
srcRect.roundOut(&iClampRect);
}
- int outset = sampling.useCubic ? GrBicubicEffect::kFilterTexelPad : 1;
+ int outset = sampling.useCubic ? kBicubicFilterTexelPad : 1;
clamped_outset_with_offset(&iTileR, outset, &offset, iClampRect);
}
@@ -785,7 +784,7 @@
if (!image->isTextureBacked()) {
int tileFilterPad;
if (sampling.useCubic) {
- tileFilterPad = GrBicubicEffect::kFilterTexelPad;
+ tileFilterPad = kBicubicFilterTexelPad;
} else if (sampling.filter == SkFilterMode::kLinear || sampling.isAniso()) {
// Aniso will fallback to linear filtering in the tiling case.
tileFilterPad = 1;
diff --git a/src/gpu/ganesh/SurfaceDrawContext.cpp b/src/gpu/ganesh/SurfaceDrawContext.cpp
index fe11505..ccc46b9 100644
--- a/src/gpu/ganesh/SurfaceDrawContext.cpp
+++ b/src/gpu/ganesh/SurfaceDrawContext.cpp
@@ -52,7 +52,6 @@
#include "src/gpu/ganesh/GrTracing.h"
#include "src/gpu/ganesh/PathRenderer.h"
#include "src/gpu/ganesh/SkGr.h"
-#include "src/gpu/ganesh/effects/GrBicubicEffect.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
diff --git a/src/gpu/ganesh/effects/GrBicubicEffect.h b/src/gpu/ganesh/effects/GrBicubicEffect.h
index f828c07..91a07f8 100644
--- a/src/gpu/ganesh/effects/GrBicubicEffect.h
+++ b/src/gpu/ganesh/effects/GrBicubicEffect.h
@@ -27,11 +27,6 @@
class GrBicubicEffect : public GrFragmentProcessor {
public:
- enum {
- kFilterTexelPad = 2, // Given a src rect in texels to be filtered, this number of
- // surrounding texels are needed by the kernel in x and y.
- };
-
inline static constexpr SkCubicResampler gMitchell = { 1.0f/3, 1.0f/3 };
inline static constexpr SkCubicResampler gCatmullRom = { 0, 1.0f/2 };