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

Unified Diff: src/effects/gradients/SkTwoPointConicalGradient.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
Index: src/effects/gradients/SkTwoPointConicalGradient.cpp
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 59a135a6427902cac236884d0848d6c21163710e..b0955a2583144e3f2a509360b0504f9802c0210d 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -32,7 +32,7 @@
// Return the number of distinct real roots, and write them into roots[] in
// ascending order
-static int find_quad_roots(float A, float B, float C, float roots[2], bool descendingOrder = false) {
+static int find_quad_roots(float A, float B, float C, float roots[2]) {
SkASSERT(roots);
if (A == 0) {
@@ -66,9 +66,6 @@
float r1 = C / Q;
roots[0] = r0 < r1 ? r0 : r1;
roots[1] = r0 > r1 ? r0 : r1;
- if (descendingOrder) {
- SkTSwap(roots[0], roots[1]);
- }
return 2;
}
@@ -79,8 +76,7 @@
static float sqr(float x) { return x * x; }
void TwoPtRadial::init(const SkPoint& center0, SkScalar rad0,
- const SkPoint& center1, SkScalar rad1,
- bool flipped) {
+ const SkPoint& center1, SkScalar rad1) {
fCenterX = SkScalarToFloat(center0.fX);
fCenterY = SkScalarToFloat(center0.fY);
fDCenterX = SkScalarToFloat(center1.fX) - fCenterX;
@@ -91,8 +87,6 @@
fA = sqr(fDCenterX) + sqr(fDCenterY) - sqr(fDRadius);
fRadius2 = sqr(fRadius);
fRDR = fRadius * fDRadius;
-
- fFlipped = flipped;
}
TwoPtRadialContext::TwoPtRadialContext(const TwoPtRadial& rec, SkScalar fx, SkScalar fy,
@@ -109,7 +103,7 @@
float roots[2];
float C = sqr(fRelX) + sqr(fRelY) - fRec.fRadius2;
- int countRoots = find_quad_roots(fRec.fA, fB, C, roots, fRec.fFlipped);
+ int countRoots = find_quad_roots(fRec.fA, fB, C, roots);
fRelX += fIncX;
fRelY += fIncY;
@@ -188,7 +182,7 @@
}
void SkTwoPointConicalGradient::init() {
- fRec.init(fCenter1, fRadius1, fCenter2, fRadius2, fFlippedGrad);
+ fRec.init(fCenter1, fRadius1, fCenter2, fRadius2);
fPtsToUnit.reset();
}
@@ -197,13 +191,12 @@
SkTwoPointConicalGradient::SkTwoPointConicalGradient(
const SkPoint& start, SkScalar startRadius,
const SkPoint& end, SkScalar endRadius,
- bool flippedGrad, const Descriptor& desc)
+ const Descriptor& desc)
: SkGradientShaderBase(desc),
fCenter1(start),
fCenter2(end),
fRadius1(startRadius),
- fRadius2(endRadius),
- fFlippedGrad(flippedGrad) {
+ fRadius2(endRadius) {
// this is degenerate, and should be caught by our caller
SkASSERT(fCenter1 != fCenter2 || fRadius1 != fRadius2);
this->init();
@@ -352,20 +345,6 @@
fCenter2(buffer.readPoint()),
fRadius1(buffer.readScalar()),
fRadius2(buffer.readScalar()) {
- if (buffer.pictureVersion() >= 24 || 0 == buffer.pictureVersion()) {
- fFlippedGrad = buffer.readBool();
- } else {
- // V23_COMPATIBILITY_CODE
- // Sort gradient by radius size for old pictures
- if (fRadius2 < fRadius1) {
- SkTSwap(fCenter1, fCenter2);
- SkTSwap(fRadius1, fRadius2);
- this->flipGradientColors();
- fFlippedGrad = true;
- } else {
- fFlippedGrad = false;
- }
- }
this->init();
};
@@ -376,7 +355,6 @@
buffer.writePoint(fCenter2);
buffer.writeScalar(fRadius1);
buffer.writeScalar(fRadius2);
- buffer.writeBool(fFlippedGrad);
}
#if SK_SUPPORT_GPU
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698