Revert of remove unused (by clients) SkUnitMapper (https://codereview.chromium.org/283273002/)
Reason for revert:
does not address all legacy callsites in chrome.
e.g.
[13:45:32.091872] ../../ui/native_theme/native_theme_base.cc:608:76: error: no matching function for call to ‘SkGradientShader::CreateLinear(SkPoint [3], SkColor [3], NULL, int, SkShader::TileMode, NULL)’
[13:45:32.091919] gradient_bounds, colors, NULL, 3, SkShader::kClamp_TileMode, NULL));
Original issue's description:
> remove unused (by clients) SkUnitMapper
>
> BUG=skia:
>
> Committed: http://code.google.com/p/skia/source/detail?r=14761
R=robertphillips@google.com, scroggo@google.com, george@mozilla.com
TBR=george@mozilla.com, robertphillips@google.com, scroggo@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: reed@google.com
Review URL: https://codereview.chromium.org/287063009
git-svn-id: http://skia.googlecode.com/svn/trunk@14763 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h
index 2518458..871b34a 100644
--- a/include/effects/SkGradientShader.h
+++ b/include/effects/SkGradientShader.h
@@ -10,6 +10,8 @@
#include "SkShader.h"
+class SkUnitMapper;
+
/** \class SkGradientShader
SkGradientShader hosts factories for creating subclasses of SkShader that
@@ -41,28 +43,14 @@
intermediate values must be strictly increasing.
@param count Must be >=2. The number of colors (and pos if not NULL) entries.
@param mode The tiling mode
+ @param mapper May be NULL. Callback to modify the spread of the colors.
*/
static SkShader* CreateLinear(const SkPoint pts[2],
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix);
-
- static SkShader* CreateLinear(const SkPoint pts[2],
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return CreateLinear(pts, colors, pos, count, mode, 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE
- static SkShader* CreateLinear(const SkPoint pts[2],
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkDeadUnitMapperType*, // this type is now gone
- uint32_t flags,
- const SkMatrix* localMatrix) {
- return CreateLinear(pts, colors, pos, count, mode, flags, localMatrix);
- }
-#endif
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a radial gradient given the center and radius.
<p />
@@ -79,27 +67,14 @@
intermediate values must be strictly increasing.
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
@param mode The tiling mode
+ @param mapper May be NULL. Callback to modify the spread of the colors.
*/
static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
const SkColor colors[], const SkScalar pos[], int count,
SkShader::TileMode mode,
- uint32_t flags, const SkMatrix* localMatrix);
-
- static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return CreateRadial(center, radius, colors, pos, count, mode, 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE
- static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkDeadUnitMapperType*,
- uint32_t flags, const SkMatrix* localMatrix) {
- return CreateRadial(center, radius, colors, pos, count, mode, flags, localMatrix);
- }
-#endif
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a radial gradient given the start position, start radius, end position and end radius.
<p />
@@ -119,32 +94,18 @@
intermediate values must be strictly increasing.
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
@param mode The tiling mode
+ @param mapper May be NULL. Callback to modify the spread of the colors.
*/
- static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
+ static SkShader* CreateTwoPointRadial(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);
-
- static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE
- static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkDeadUnitMapperType*,
- uint32_t flags, const SkMatrix* localMatrix) {
- return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, pos, count, mode,
- flags, localMatrix);
- }
-#endif
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/**
* Returns a shader that generates a conical gradient given two circles, or
@@ -152,31 +113,16 @@
* two circles according to the following HTML spec.
* http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient
*/
- static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
+ static SkShader* CreateTwoPointConical(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);
-
- static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode) {
- return CreateTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE
- static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkDeadUnitMapperType*,
- uint32_t flags, const SkMatrix* localMatrix) {
- return CreateTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
- flags, localMatrix);
- }
-#endif
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
/** Returns a shader that generates a sweep gradient given a center.
<p />
@@ -192,24 +138,13 @@
If this is not null, the values must begin with 0, end with 1.0, and
intermediate values must be strictly increasing.
@param count Must be >= 2. The number of colors (and pos if not NULL) entries
+ @param mapper May be NULL. Callback to modify the spread of the colors.
*/
static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
- const SkColor colors[], const SkScalar pos[], int count,
- uint32_t flags, const SkMatrix* localMatrix);
-
- static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
- const SkColor colors[], const SkScalar pos[], int count) {
- return CreateSweep(cx, cy, colors, pos, count, 0, NULL);
- }
-
-#ifdef SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE
- static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
- const SkColor colors[], const SkScalar pos[], int count,
- SkDeadUnitMapperType*,
- uint32_t flags, const SkMatrix* localMatrix) {
- return CreateSweep(cx, cy, colors, pos, count, flags, localMatrix);
- }
-#endif
+ const SkColor colors[], const SkScalar pos[],
+ int count, SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};