remove dead code from old factories, enum
Change-Id: I12d46c2c60539689949a08636c3a654d2298285a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207868
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index 33d8e08..75ef731 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -105,49 +105,6 @@
kSkColorFilter_Type, data, size, procs).release()));
}
-#ifdef SK_SUPPORT_LEGACY_COLORFILTER_FACTORIES
- /** Create a colorfilter that uses the specified color and mode.
- If the Mode is DST, this function will return NULL (since that
- mode will have no effect on the result).
- @param c The source color used with the specified mode
- @param mode The blend that is applied to each color in
- the colorfilter's filterSpan[16,32] methods
- @return colorfilter object that applies the src color and mode,
- or NULL if the mode will have no effect.
- */
- static sk_sp<SkColorFilter> MakeModeFilter(SkColor c, SkBlendMode mode);
-
- // DEPRECATED, call makeComposed instead
- static sk_sp<SkColorFilter> MakeComposeFilter(sk_sp<SkColorFilter> outer,
- sk_sp<SkColorFilter> inner) {
- return outer ? outer->makeComposed(inner) : inner;
- }
-
- /** Construct a color filter that transforms a color by a 4x5 matrix. The matrix is in row-
- * major order and the translation column is specified in unnormalized, 0...255, space.
- */
- static sk_sp<SkColorFilter> MakeMatrixFilterRowMajor255(const SkScalar array[20]);
-
- /** Construct a colorfilter that applies the srgb gamma curve to the RGB channels */
- static sk_sp<SkColorFilter> MakeLinearToSRGBGamma();
-
- /** Construct a colorfilter that applies the inverse of the srgb gamma curve to the
- * RGB channels
- */
- static sk_sp<SkColorFilter> MakeSRGBToLinearGamma();
-
- /**
- * Returns a new filter that returns the weighted average between the outputs of
- * two other filters. If either is null, then it is treated as an identity filter.
- *
- * result = cf0(color) * (1 - weight) + cf1(color) * weight
- *
- * If both filters are null, or if weight is NaN, then null is returned.
- */
- static sk_sp<SkColorFilter> MakeLerp(sk_sp<SkColorFilter> cf0, sk_sp<SkColorFilter> cf1,
- float weight);
-#endif
-
protected:
SkColorFilter() {}
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 020c8c2..008ee6d 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -681,13 +681,6 @@
*/
sk_sp<SkShader> makeShader(SkTileMode tmx, SkTileMode tmy,
const SkMatrix* localMatrix = nullptr) const;
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- sk_sp<SkShader> makeShader(SkShader::TileMode tmx, SkShader::TileMode tmy,
- const SkMatrix* localMatrix = nullptr) const {
- return this->makeShader(static_cast<SkTileMode>(tmx), static_cast<SkTileMode>(tmy),
- localMatrix);
- }
-#endif
/** Creates SkShader from SkImage. SkShader dimensions are taken from SkImage. SkShader uses
SkShader::kClamp_TileMode to fill drawn area outside SkImage. localMatrix permits
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 3ad0ad3..94820f7 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -39,36 +39,6 @@
*/
class SK_API SkShader : public SkFlattenable {
public:
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- enum TileMode {
- /**
- * Replicate the edge color if the shader draws outside of its
- * original bounds.
- */
- kClamp_TileMode,
-
- /**
- * Repeat the shader's image horizontally and vertically.
- */
- kRepeat_TileMode,
-
- /**
- * Repeat the shader's image horizontally and vertically, alternating
- * mirror images so that adjacent images always seam.
- */
- kMirror_TileMode,
-
- /**
- * Only draw within the original domain, return transparent-black everywhere else.
- */
- kDecal_TileMode,
-
- kLast_TileMode = kDecal_TileMode,
- };
-
- static constexpr int kTileModeCount = kLast_TileMode + 1;
-#endif
-
/**
* Returns true if the shader is guaranteed to produce only opaque
* colors, subject to the SkPaint using the shader to apply an opaque
@@ -82,11 +52,6 @@
* if they want to keep it longer than the lifetime of the shader). If not, return nullptr.
*/
SkImage* isAImage(SkMatrix* localMatrix, SkTileMode xy[2]) const;
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- SkImage* isAImage(SkMatrix* localMatrix, TileMode xy[2]) const {
- return this->isAImage(localMatrix, (SkTileMode*)xy);
- }
-#endif
bool isAImage() const {
return this->isAImage(nullptr, (SkTileMode*)nullptr) != nullptr;
@@ -140,11 +105,7 @@
SkScalar* fColorOffsets; //!< The unit offset for color transitions.
SkPoint fPoint[2]; //!< Type specific, see above.
SkScalar fRadius[2]; //!< Type specific, see above.
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- TileMode fTileMode; //!< The tile mode used.
-#else
SkTileMode fTileMode;
-#endif
uint32_t fGradientFlags; //!< see SkGradientShader::Flags
};
@@ -169,89 +130,6 @@
//////////////////////////////////////////////////////////////////////////
// Factory methods for stock shaders
-#ifdef SK_SUPPORT_LEGACY_SHADER_FACTORIES
- /**
- * Call this to create a new "empty" shader, that will not draw anything.
- */
- static sk_sp<SkShader> MakeEmptyShader();
-
- /**
- * Call this to create a new shader that just draws the specified color. This should always
- * draw the same as a paint with this color (and no shader).
- */
- static sk_sp<SkShader> MakeColorShader(SkColor);
-
- /**
- * Create a shader that draws the specified color (in the specified colorspace).
- *
- * This works around the limitation that SkPaint::setColor() only takes byte values, and does
- * not support specific colorspaces.
- */
- static sk_sp<SkShader> MakeColorShader(const SkColor4f&, sk_sp<SkColorSpace>);
-
- static sk_sp<SkShader> MakeBlend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src);
-
- /*
- * DEPRECATED: call MakeBlend.
- */
- static sk_sp<SkShader> MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
- SkBlendMode mode) {
- return MakeBlend(mode, std::move(dst), std::move(src));
- }
-
- /**
- * Compose two shaders together using a weighted average.
- *
- * result = dst * (1 - weight) + src * weight
- *
- * If either shader is nullptr, then this returns nullptr.
- * If weight is NaN then this returns nullptr, otherwise lerp is clamped to [0..1].
- */
- static sk_sp<SkShader> MakeLerp(float weight, sk_sp<SkShader> dst, sk_sp<SkShader> src);
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_BITMAPSHADER_FACTORY
- /** DEPRECATED. call bitmap.makeShader()
- * Call this to create a new shader that will draw with the specified bitmap.
- *
- * If the bitmap cannot be used (e.g. has no pixels, or its dimensions
- * exceed implementation limits (currently at 64K - 1)) then SkEmptyShader
- * may be returned.
- *
- * If the src is kA8_Config then that mask will be colorized using the color on
- * the paint.
- *
- * @param src The bitmap to use inside the shader
- * @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
- * @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
- * @return Returns a new shader object. Note: this function never returns null.
- */
- static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, SkTileMode tmx, SkTileMode tmy,
- const SkMatrix* localMatrix = nullptr);
-#endif
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
- const SkMatrix* localMatrix = nullptr);
-
- /** DEPRECATED: call picture->makeShader(...)
- * Call this to create a new shader that will draw with the specified picture.
- *
- * @param src The picture to use inside the shader (if not NULL, its ref count
- * is incremented). The SkPicture must not be changed after
- * successfully creating a picture shader.
- * @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
- * @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
- * @param tile The tile rectangle in picture coordinates: this represents the subset
- * (or superset) of the picture used when building a tile. It is not
- * affected by localMatrix and does not imply scaling (only translation
- * and cropping). If null, the tile rect is considered equal to the picture
- * bounds.
- * @return Returns a new shader object. Note: this function never returns null.
- */
- static sk_sp<SkShader> MakePictureShader(sk_sp<SkPicture> src, TileMode tmx, TileMode tmy,
- const SkMatrix* localMatrix, const SkRect* tile);
-#endif
-
#ifdef SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX
SkMatrix getLocalMatrix() const;
sk_sp<SkShader> makeAsALocalMatrixShader(SkMatrix* localMatrix) const;
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h
index 2706eb1..e5910c6 100644
--- a/include/effects/SkGradientShader.h
+++ b/include/effects/SkGradientShader.h
@@ -76,19 +76,6 @@
SkTileMode mode) {
return MakeLinear(pts, colors, pos, count, mode, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeLinear(pts, colors, pos, count, (SkTileMode)mode, flags, localMatrix);
- }
- static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return MakeLinear(pts, colors, pos, count, mode, 0, nullptr);
- }
-#endif
/** Returns a shader that generates a linear gradient between the two specified points.
<p />
@@ -111,19 +98,6 @@
const SkScalar pos[], int count, SkTileMode mode) {
return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int count, SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeLinear(pts, colors, colorSpace, pos, count, (SkTileMode)mode, flags, localMatrix);
- }
- static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int count, SkShader::TileMode mode) {
- return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, 0, nullptr);
- }
-#endif
/** Returns a shader that generates a radial gradient given the center and radius.
<p />
@@ -147,19 +121,6 @@
SkTileMode mode) {
return MakeRadial(center, radius, colors, pos, count, mode, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeRadial(center, radius, colors, pos, count, (SkTileMode)mode, flags, localMatrix);
- }
- static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return MakeRadial(center, radius, colors, pos, count, mode, 0, nullptr);
- }
-#endif
/** Returns a shader that generates a radial gradient given the center and radius.
<p />
@@ -184,21 +145,6 @@
return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode,
0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int count, SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeRadial(center, radius, colors, colorSpace, pos, count, (SkTileMode)mode,
- flags, localMatrix);
- }
- static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int count, SkShader::TileMode mode) {
- return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode,
- 0, nullptr);
- }
-#endif
/**
* Returns a shader that generates a conical gradient given two circles, or
@@ -218,23 +164,6 @@
return MakeTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[],
- int count, SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeTwoPointConical(start, startRadius, end, endRadius, colors, pos, count,
- (SkTileMode)mode, flags, localMatrix);
- }
- static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[],
- int count, SkShader::TileMode mode) {
- return MakeTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, nullptr);
- }
-#endif
/**
* Returns a shader that generates a conical gradient given two circles, or
@@ -256,25 +185,6 @@
return MakeTwoPointConical(start, startRadius, end, endRadius, colors,
std::move(colorSpace), pos, count, mode, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor4f colors[],
- sk_sp<SkColorSpace> colorSpace, const SkScalar pos[],
- int count, SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeTwoPointConical(start, startRadius, end, endRadius, colors, colorSpace, pos,
- count, (SkTileMode)mode, flags, localMatrix);
- }
- static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor4f colors[],
- sk_sp<SkColorSpace> colorSpace, const SkScalar pos[],
- int count, SkShader::TileMode mode) {
- return MakeTwoPointConical(start, startRadius, end, endRadius, colors,
- std::move(colorSpace), pos, count, mode, 0, nullptr);
- }
-#endif
/** Returns a shader that generates a sweep gradient given a center.
<p />
@@ -307,16 +217,6 @@
const SkColor colors[], const SkScalar pos[], int count) {
return MakeSweep(cx, cy, colors, pos, count, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkScalar startAngle, SkScalar endAngle,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeSweep(cx, cy, colors, pos, count, (SkTileMode)mode, startAngle, endAngle,
- flags, localMatrix);
- }
-#endif
/** Returns a shader that generates a sweep gradient given a center.
<p />
@@ -352,17 +252,6 @@
const SkScalar pos[], int count) {
return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, 0, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkScalar startAngle, SkScalar endAngle,
- uint32_t flags, const SkMatrix* localMatrix) {
- return MakeSweep(cx, cy, colors, colorSpace, pos, count, (SkTileMode)mode, startAngle,
- endAngle, flags, localMatrix);
- }
-#endif
static void RegisterFlattenables();
};
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 08312b6..e99d185 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -243,16 +243,6 @@
return sk_ref_sp(gSingleton);
}
-#ifdef SK_SUPPORT_LEGACY_COLORFILTER_FACTORIES
-sk_sp<SkColorFilter> SkColorFilter::MakeLinearToSRGBGamma() {
- return SkColorFilters::LinearToSRGBGamma();
-}
-
-sk_sp<SkColorFilter> SkColorFilter::MakeSRGBToLinearGamma() {
- return SkColorFilters::SRGBToLinearGamma();
-}
-#endif
-
sk_sp<SkColorFilter> SkColorFilters::LinearToSRGBGamma() {
return MakeSRGBGammaCF<SkSRGBGammaColorFilter::Direction::kLinearToSRGB>();
}
@@ -343,14 +333,6 @@
return SkColorFilters::Lerp(weight, std::move(cf0), std::move(cf1));
}
-#ifdef SK_SUPPORT_LEGACY_COLORFILTER_FACTORIES
-sk_sp<SkColorFilter> SkColorFilter::MakeLerp(sk_sp<SkColorFilter> cf0,
- sk_sp<SkColorFilter> cf1,
- float weight) {
- return SkColorFilters::Lerp(weight, std::move(cf0), std::move(cf1));
-}
-#endif
-
sk_sp<SkColorFilter> SkColorFilters::Lerp(float weight, sk_sp<SkColorFilter> cf0,
sk_sp<SkColorFilter> cf1) {
if (!cf0 && !cf1) {
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index e006d64..2bca26e 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -202,12 +202,6 @@
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_COLORFILTER_FACTORIES
-sk_sp<SkColorFilter> SkColorFilter::MakeMatrixFilterRowMajor255(const SkScalar array[20]) {
- return SkColorFilters::MatrixRowMajor255(array);
-}
-#endif
-
sk_sp<SkColorFilter> SkColorFilters::MatrixRowMajor255(const float array[20]) {
if (!SkScalarsAreFinite(array, 20)) {
return nullptr;
diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp
index 9e4855e..e42e978 100644
--- a/src/core/SkModeColorFilter.cpp
+++ b/src/core/SkModeColorFilter.cpp
@@ -104,12 +104,6 @@
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_COLORFILTER_FACTORIES
-sk_sp<SkColorFilter> SkColorFilter::MakeModeFilter(SkColor color, SkBlendMode mode) {
- return SkColorFilters::Blend(color, mode);
-}
-#endif
-
sk_sp<SkColorFilter> SkColorFilters::Blend(SkColor color, SkBlendMode mode) {
if (!SkIsValidMode(mode)) {
return nullptr;
diff --git a/src/pdf/SkPDFGradientShader.cpp b/src/pdf/SkPDFGradientShader.cpp
index f23b9a3..83320ad 100644
--- a/src/pdf/SkPDFGradientShader.cpp
+++ b/src/pdf/SkPDFGradientShader.cpp
@@ -873,13 +873,7 @@
const SkIRect& bbox) {
SkPDFGradientShader::Key key = {
SkShader::kNone_GradientType,
- {0, nullptr, nullptr, {{0, 0}, {0, 0}}, {0, 0},
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- SkShader::kClamp_TileMode,
-#else
- SkTileMode::kClamp,
-#endif
- 0},
+ {0, nullptr, nullptr, {{0, 0}, {0, 0}}, {0, 0}, SkTileMode::kClamp, 0},
nullptr,
nullptr,
canvasTransform,
diff --git a/src/shaders/SkColorShader.cpp b/src/shaders/SkColorShader.cpp
index 9884e9a..08d1aa2 100644
--- a/src/shaders/SkColorShader.cpp
+++ b/src/shaders/SkColorShader.cpp
@@ -34,11 +34,7 @@
info->fColors[0] = fColor;
}
info->fColorCount = 1;
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- info->fTileMode = SkShader::kRepeat_TileMode;
-#else
info->fTileMode = SkTileMode::kRepeat;
-#endif
}
return kColor_GradientType;
}
@@ -71,12 +67,6 @@
}
-#ifdef SK_SUPPORT_LEGACY_SHADER_FACTORIES
-sk_sp<SkShader> SkShader::MakeColorShader(const SkColor4f& color, sk_sp<SkColorSpace> space) {
- return SkShaders::Color(color, std::move(space));
-}
-#endif
-
sk_sp<SkShader> SkShaders::Color(const SkColor4f& color, sk_sp<SkColorSpace> space) {
if (!SkScalarsAreFinite(color.vec(), 4)) {
return nullptr;
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index d4a7baa..d3db1c5 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -16,16 +16,6 @@
#include "SkWriteBuffer.h"
#include "SkString.h"
-#ifdef SK_SUPPORT_LEGACY_SHADER_FACTORIES
-sk_sp<SkShader> SkShader::MakeBlend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
- return SkShaders::Blend(mode, std::move(dst), std::move(src));
-}
-
-sk_sp<SkShader> SkShader::MakeLerp(float weight, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
- return SkShaders::Lerp(weight, std::move(dst), std::move(src));
-}
-#endif
-
sk_sp<SkShader> SkShaders::Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
switch (mode) {
case SkBlendMode::kClear: return Color(0);
diff --git a/src/shaders/SkShader.cpp b/src/shaders/SkShader.cpp
index 2356db8..2a47bef 100644
--- a/src/shaders/SkShader.cpp
+++ b/src/shaders/SkShader.cpp
@@ -141,21 +141,9 @@
return nullptr;
}
-#ifdef SK_SUPPORT_LEGACY_SHADER_FACTORIES
-sk_sp<SkShader> SkShader::MakeEmptyShader() { return SkShaders::Empty(); }
-sk_sp<SkShader> SkShader::MakeColorShader(SkColor color) { return SkShaders::Color(color); }
-#endif
-
sk_sp<SkShader> SkShaders::Empty() { return sk_make_sp<SkEmptyShader>(); }
sk_sp<SkShader> SkShaders::Color(SkColor color) { return sk_make_sp<SkColorShader>(color); }
-#ifdef SK_SUPPORT_LEGACY_BITMAPSHADER_FACTORY
-sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, SkTileMode tmx, SkTileMode tmy,
- const SkMatrix* localMatrix) {
- return src.makeShader(tmx, tmy, localMatrix);
-}
-#endif
-
sk_sp<SkShader> SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy, const SkMatrix* lm) const {
if (lm && !lm->invert(nullptr)) {
return nullptr;
@@ -167,18 +155,6 @@
return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, lm);
}
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
-sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
- const SkMatrix* localMatrix) {
- return src.makeShader((SkTileMode)tmx, (SkTileMode)tmy, localMatrix);
-}
-sk_sp<SkShader> SkShader::MakePictureShader(sk_sp<SkPicture> src, TileMode tmx, TileMode tmy,
- const SkMatrix* localMatrix, const SkRect* tile) {
- return src ? src->makeShader((SkTileMode)tmx, (SkTileMode)tmy, localMatrix, tile)
- : MakeEmptyShader();
-}
-#endif
-
bool SkShaderBase::appendStages(const SkStageRec& rec) const {
return this->onAppendStages(rec);
}
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index e9c32c8..2bad568 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -473,11 +473,7 @@
}
}
info->fColorCount = fColorCount;
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
- info->fTileMode = (SkShader::TileMode)fTileMode;
-#else
info->fTileMode = fTileMode;
-#endif
info->fGradientFlags = fGradFlags;
}
}
diff --git a/tests/PictureShaderTest.cpp b/tests/PictureShaderTest.cpp
index bdcbc90..6970ffe 100644
--- a/tests/PictureShaderTest.cpp
+++ b/tests/PictureShaderTest.cpp
@@ -13,36 +13,6 @@
#include "SkSurface.h"
#include "Test.h"
-#ifdef SK_SUPPORT_LEGACY_TILEMODE_ENUM
-// Test that attempting to create a picture shader with a nullptr picture or
-// empty picture returns a shader that draws nothing.
-DEF_TEST(PictureShader_empty, reporter) {
- SkPaint paint;
-
- SkBitmap bitmap;
- bitmap.allocN32Pixels(1,1);
-
- SkCanvas canvas(bitmap);
- canvas.clear(SK_ColorGREEN);
-
- paint.setShader(SkShader::MakePictureShader(
- nullptr, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr));
-
- canvas.drawRect(SkRect::MakeWH(1,1), paint);
- REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN);
-
-
- SkPictureRecorder factory;
- factory.beginRecording(0, 0, nullptr, 0);
- paint.setShader(SkShader::MakePictureShader(factory.finishRecordingAsPicture(),
- SkShader::kClamp_TileMode,
- SkShader::kClamp_TileMode, nullptr, nullptr));
-
- canvas.drawRect(SkRect::MakeWH(1,1), paint);
- REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN);
-}
-#endif
-
// Test that the SkPictureShader cache is purged on shader deletion.
DEF_TEST(PictureShader_caching, reporter) {
auto makePicture = [] () {