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

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 8 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 | « src/effects/SkTileImageFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index f4bde677dd060d359d1838e6c34ce17d42004ca1..6d753a9508d8c9b1d11ab5bcb0164d5e1ed4907a 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -12,7 +12,9 @@
#include "SkTwoPointConicalGradient.h"
#include "SkSweepGradient.h"
-SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc) {
+SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatrix* localMatrix)
+ : INHERITED(localMatrix)
+{
SkASSERT(desc.fCount > 1);
fMapper = desc.fMapper;
@@ -784,7 +786,8 @@ SkShader* SkGradientShader::CreateLinear(const SkPoint pts[2],
const SkScalar pos[], int colorCount,
SkShader::TileMode mode,
SkUnitMapper* mapper,
- uint32_t flags) {
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
if (NULL == pts || NULL == colors || colorCount < 1) {
return NULL;
}
@@ -792,7 +795,7 @@ SkShader* SkGradientShader::CreateLinear(const SkPoint pts[2],
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
- return SkNEW_ARGS(SkLinearGradient, (pts, desc));
+ return SkNEW_ARGS(SkLinearGradient, (pts, desc, localMatrix));
}
SkShader* SkGradientShader::CreateRadial(const SkPoint& center, SkScalar radius,
@@ -800,7 +803,8 @@ SkShader* SkGradientShader::CreateRadial(const SkPoint& center, SkScalar radius,
const SkScalar pos[], int colorCount,
SkShader::TileMode mode,
SkUnitMapper* mapper,
- uint32_t flags) {
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
if (radius <= 0 || NULL == colors || colorCount < 1) {
return NULL;
}
@@ -808,7 +812,7 @@ SkShader* SkGradientShader::CreateRadial(const SkPoint& center, SkScalar radius,
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
- return SkNEW_ARGS(SkRadialGradient, (center, radius, desc));
+ return SkNEW_ARGS(SkRadialGradient, (center, radius, desc, localMatrix));
}
SkShader* SkGradientShader::CreateTwoPointRadial(const SkPoint& start,
@@ -820,7 +824,8 @@ SkShader* SkGradientShader::CreateTwoPointRadial(const SkPoint& start,
int colorCount,
SkShader::TileMode mode,
SkUnitMapper* mapper,
- uint32_t flags) {
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) {
return NULL;
}
@@ -829,7 +834,7 @@ SkShader* SkGradientShader::CreateTwoPointRadial(const SkPoint& start,
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
return SkNEW_ARGS(SkTwoPointRadialGradient,
- (start, startRadius, end, endRadius, desc));
+ (start, startRadius, end, endRadius, desc, localMatrix));
}
SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
@@ -841,7 +846,8 @@ SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
int colorCount,
SkShader::TileMode mode,
SkUnitMapper* mapper,
- uint32_t flags) {
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) {
return NULL;
}
@@ -858,7 +864,7 @@ SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
if (!flipGradient) {
desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
return SkNEW_ARGS(SkTwoPointConicalGradient,
- (start, startRadius, end, endRadius, flipGradient, desc));
+ (start, startRadius, end, endRadius, flipGradient, desc, localMatrix));
} else {
SkAutoSTArray<8, SkColor> colorsNew(colorCount);
SkAutoSTArray<8, SkScalar> posNew(colorCount);
@@ -876,7 +882,7 @@ SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
}
return SkNEW_ARGS(SkTwoPointConicalGradient,
- (end, endRadius, start, startRadius, flipGradient, desc));
+ (end, endRadius, start, startRadius, flipGradient, desc, localMatrix));
}
}
@@ -884,7 +890,8 @@ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
const SkColor colors[],
const SkScalar pos[],
int colorCount, SkUnitMapper* mapper,
- uint32_t flags) {
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
if (NULL == colors || colorCount < 1) {
return NULL;
}
@@ -892,7 +899,7 @@ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
SkGradientShaderBase::Descriptor desc;
desc_init(&desc, colors, pos, colorCount, SkShader::kClamp_TileMode, mapper, flags);
- return SkNEW_ARGS(SkSweepGradient, (cx, cy, desc));
+ return SkNEW_ARGS(SkSweepGradient, (cx, cy, desc, localMatrix));
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader)
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698