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

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

Issue 239993006: Revert of Add flipped gradient branch to two point conical gradient (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « include/core/SkPicture.h ('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 36d690ac090f2ac811da1e724e5938c3ef0e1b07..3547fbec94f4e372c5ee3dc70e7c0bd4a03effdd 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -201,25 +201,6 @@
}
}
buffer.writeMatrix(fPtsToUnit);
-}
-
-// V23_COMPATIBILITY_CODE
-void SkGradientShaderBase::flipGradientColors() {
- SkAutoSTArray<8, SkColor> colorsTemp(fColorCount);
- for (int i = 0; i < fColorCount; ++i) {
- int offset = fColorCount - i - 1;
- colorsTemp[i] = fOrigColors[offset];
- }
- if (fColorCount > 2) {
- SkAutoSTArray<8, Rec> recsTemp(fColorCount);
- for (int i = 0; i < fColorCount; ++i) {
- int offset = fColorCount - i - 1;
- recsTemp[i].fPos = 1 - fRecs[offset].fPos;
- recsTemp[i].fScale = fRecs[offset].fScale;
- }
- memcpy(fRecs, recsTemp.get(), fColorCount * sizeof(Rec));
- }
- memcpy(fOrigColors, colorsTemp.get(), fColorCount * sizeof(SkColor));
}
bool SkGradientShaderBase::isOpaque() const {
@@ -812,36 +793,12 @@
if (start == end && startRadius == endRadius) {
return SkNEW(SkEmptyShader);
}
-
EXPAND_1_COLOR(colorCount);
- bool flipGradient = startRadius > endRadius;
-
SkGradientShaderBase::Descriptor desc;
-
- if (!flipGradient) {
- desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
- return SkNEW_ARGS(SkTwoPointConicalGradient,
- (start, startRadius, end, endRadius, flipGradient, desc));
- } else {
- SkAutoSTArray<8, SkColor> colorsNew(colorCount);
- SkAutoSTArray<8, SkScalar> posNew(colorCount);
- for (int i = 0; i < colorCount; ++i) {
- colorsNew[i] = colors[colorCount - i - 1];
- }
-
- if (pos) {
- for (int i = 0; i < colorCount; ++i) {
- posNew[i] = 1 - pos[colorCount - i - 1];
- }
- desc_init(&desc, colorsNew.get(), posNew.get(), colorCount, mode, mapper, flags);
- } else {
- desc_init(&desc, colorsNew.get(), NULL, colorCount, mode, mapper, flags);
- }
-
- return SkNEW_ARGS(SkTwoPointConicalGradient,
- (end, endRadius, start, startRadius, flipGradient, desc));
- }
+ desc_init(&desc, colors, pos, colorCount, mode, mapper, flags);
+ return SkNEW_ARGS(SkTwoPointConicalGradient,
+ (start, startRadius, end, endRadius, desc));
}
SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
« no previous file with comments | « include/core/SkPicture.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698