Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: include/effects/SkGradientShader.h

Issue 296823008: Revert of Remove unused (by clients) SkUnitMapper (https://codereview.chromium.org/283273002/) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkUnitMapper.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkGradientShader.h
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h
index a5b4f29b7604e29fa31d5a4bfa73e6a1be60d7aa..d9276c9ad942c718826638d20173618e8efdbb0e 100644
--- a/include/effects/SkGradientShader.h
+++ b/include/effects/SkGradientShader.h
@@ -9,6 +9,8 @@
#define SkGradientShader_DEFINED
#include "SkShader.h"
+
+class SkUnitMapper;
/** \class SkGradientShader
@@ -41,16 +43,21 @@
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);
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
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);
+ SkShader::TileMode mode,
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
+ return CreateLinear(pts, colors, pos, count, mode, NULL, flags, localMatrix);
}
/** Returns a shader that generates a radial gradient given the center and radius.
@@ -68,16 +75,21 @@
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);
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
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);
+ SkShader::TileMode mode,
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
+ return CreateRadial(center, radius, colors, pos, count, mode, NULL, flags, localMatrix);
}
/** Returns a shader that generates a radial gradient given the start position, start radius, end position and end radius.
@@ -98,19 +110,30 @@
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
- */
- static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const SkColor colors[], const SkScalar pos[], int count,
+ @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,
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) {
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
+
+ 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) {
return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, NULL);
+ NULL, flags, localMatrix);
}
/**
@@ -119,18 +142,28 @@
* 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) {
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
+
+ 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) {
return CreateTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
- 0, NULL);
+ NULL, flags, localMatrix);
}
/** Returns a shader that generates a sweep gradient given a center.
@@ -147,14 +180,18 @@
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, SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0,
+ const SkMatrix* localMatrix = NULL);
+
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);
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateSweep(cx, cy, colors, pos, count, NULL, flags, localMatrix);
}
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
« no previous file with comments | « include/core/SkUnitMapper.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698