Revert of r9902 (Consider conical shader opaque if it covers
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 9 Jul 2013 13:50:09 +0000 (13:50 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 9 Jul 2013 13:50:09 +0000 (13:50 +0000)
entire plane - https://chromiumcodereview.appspot.com/18533006) due to roll issues (https://codereview.chromium.org/18859007/)

git-svn-id: http://skia.googlecode.com/svn/trunk@9926 2bbb7eff-a529-9590-31e7-b0007b416f81

src/effects/gradients/SkTwoPointConicalGradient.cpp
src/effects/gradients/SkTwoPointConicalGradient.h
tests/GradientTest.cpp

index 7cb0943..37b49f0 100644 (file)
@@ -74,8 +74,6 @@ void TwoPtRadial::init(const SkPoint& center0, SkScalar rad0,
     fA = sqr(fDCenterX) + sqr(fDCenterY) - sqr(fDRadius);
     fRadius2 = sqr(fRadius);
     fRDR = fRadius * fDRadius;
-
-    fConeFillsPlane = rad0 != rad1 && SkMaxScalar(rad0, rad1) > SkPoint::Distance(center0, center1);
 }
 
 void TwoPtRadial::setup(SkScalar fx, SkScalar fy, SkScalar dfx, SkScalar dfy) {
@@ -191,7 +189,10 @@ SkTwoPointConicalGradient::SkTwoPointConicalGradient(
 }
 
 bool SkTwoPointConicalGradient::isOpaque() const {
-    return INHERITED::isOpaque() && this->fRec.fConeFillsPlane;
+    // Because areas outside the cone are left untouched, we cannot treat the
+    // shader as opaque even if the gradient itself is opaque.
+    // TODO(junov): Compute whether the cone fills the plane crbug.com/222380
+    return false;
 }
 
 void SkTwoPointConicalGradient::shadeSpan(int x, int y, SkPMColor* dstCParam,
index a788370..1358f0b 100644 (file)
@@ -23,7 +23,6 @@ struct TwoPtRadial {
     float   fA;
     float   fRadius2;
     float   fRDR;
-    bool    fConeFillsPlane;
 
     void init(const SkPoint& center0, SkScalar rad0,
               const SkPoint& center1, SkScalar rad1);
index b67cc05..cf8fbee 100644 (file)
@@ -126,34 +126,6 @@ static void conical_gradproc(skiatest::Reporter* reporter, const GradRec& rec) {
     rec.gradCheck(reporter, s, &info, SkShader::kConical_GradientType);
     REPORTER_ASSERT(reporter, !memcmp(info.fPoint, rec.fPoint, 2 * sizeof(SkPoint)));
     REPORTER_ASSERT(reporter, !memcmp(info.fRadius, rec.fRadius, 2 * sizeof(SkScalar)));
-    REPORTER_ASSERT(reporter, !s->isOpaque());
-}
-
-// 2-point radial gradient should behave as opaque when it extends to the entire plane
-static void conical_gradproc_opaque(skiatest::Reporter* reporter, const GradRec& rec) {
-    SkAutoTUnref<SkShader> s(SkGradientShader::CreateTwoPointConical(rec.fPoint[0],
-                                                                     rec.fRadius[0],
-                                                                     rec.fPoint[0],
-                                                                     rec.fRadius[1],
-                                                                     rec.fColors,
-                                                                     rec.fPos,
-                                                                     rec.fColorCount,
-                                                                     rec.fTileMode));
-    REPORTER_ASSERT(reporter, s->isOpaque());
-}
-
-// 2nd circle center lies on edge of first circle should not be considered opaque
-static void conical_gradproc_not_opaque(skiatest::Reporter* reporter, const GradRec& rec) {
-    SkScalar dist = SkPoint::Distance(rec.fPoint[0], rec.fPoint[1]);
-    SkAutoTUnref<SkShader> s(SkGradientShader::CreateTwoPointConical(rec.fPoint[0],
-                                                                     dist,
-                                                                     rec.fPoint[1],
-                                                                     rec.fRadius[1],
-                                                                     rec.fColors,
-                                                                     rec.fPos,
-                                                                     rec.fColorCount,
-                                                                     rec.fTileMode));
-    REPORTER_ASSERT(reporter, !s->isOpaque());
 }
 
 // Ensure that repeated color gradients behave like drawing a single color
@@ -213,8 +185,6 @@ static void TestGradientShaders(skiatest::Reporter* reporter) {
         radial2_gradproc,
         sweep_gradproc,
         conical_gradproc,
-        conical_gradproc_opaque,
-        conical_gradproc_not_opaque,
     };
 
     for (size_t i = 0; i < SK_ARRAY_COUNT(gProcs); ++i) {