Commit ff5e1daf authored by Csoregi Natalia's avatar Csoregi Natalia
Browse files

Backed out changeset bf981458da0c (bug 1616587) for bustage on DrawTargetCairo.cpp. CLOSED TREE

parent 9970ac54
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -290,29 +290,6 @@ class RadialGradientPattern : public Pattern {
  Matrix mMatrix;  //!< A matrix that transforms the pattern into user space
};

/**
 * This class is used for Conic Gradient Patterns, the gradient stops are
 * stored in a separate object and are backend dependent. This class itself
 * may be used on the stack.
 */
class ConicGradientPattern : public Pattern {
 public:
  /// For constructor parameter description, see member data documentation.
  ConicGradientPattern(const Point& aCenter, Float aAngle,
                       GradientStops* aStops, const Matrix& aMatrix = Matrix())
      : mCenter(aCenter), mAngle(aAngle), mStops(aStops), mMatrix(aMatrix) {}

  PatternType GetType() const override { return PatternType::CONIC_GRADIENT; }

  Point mCenter;  //!< Center of the gradient
  Float mAngle;   //!< Start angle of gradient
  RefPtr<GradientStops>
      mStops;      /**< GradientStops object for this gradient, this
                        should match the backend type of the draw target
                        this pattern will be used with. */
  Matrix mMatrix;  //!< A matrix that transforms the pattern into user space
};

/**
 * This class is used for Surface Patterns, they wrap a surface and a
 * repetition mode for the surface. This may be used on the stack.
+0 −5
Original line number Diff line number Diff line
@@ -68,10 +68,6 @@ class StoredPattern {
        new (mRadial) RadialGradientPattern(
            *static_cast<const RadialGradientPattern*>(&aPattern));
        return;
      case PatternType::CONIC_GRADIENT:
        new (mConic) ConicGradientPattern(
            *static_cast<const ConicGradientPattern*>(&aPattern));
        return;
    }
  }

@@ -102,7 +98,6 @@ class StoredPattern {
    char mColor[sizeof(ColorPattern)];
    char mLinear[sizeof(LinearGradientPattern)];
    char mRadial[sizeof(RadialGradientPattern)];
    char mConic[sizeof(ConicGradientPattern)];
    char mSurface[sizeof(SurfacePattern)];
  };
};
+0 −14
Original line number Diff line number Diff line
@@ -184,11 +184,6 @@ static bool PatternIsCompatible(const Pattern& aPattern) {
          static_cast<const RadialGradientPattern&>(aPattern);
      return pattern.mStops->GetBackendType() == BackendType::CAIRO;
    }
    case PatternType::CONIC_GRADIENT: {
      const ConicGradientPattern& pattern =
          static_cast<const ConicGradientPattern&>(aPattern);
      return pattern.mStops->GetBackendType() == BackendType::CAIRO;
    }
    default:
      return true;
  }
@@ -526,15 +521,6 @@ static cairo_pattern_t* GfxPatternToCairoPattern(const Pattern& aPattern,

      break;
    }
    case PatternType::CONIC_GRADIENT: {
      const ConicGradientPattern& pattern =
          static_cast<const ConicGradientPattern&>(aPattern);

      // XXX(ntim): bug 1617039 - implement conic-gradient for Cairo
      pat = cairo_pattern_create_rgba(0.0, 0.0, 0.0, 0.0);

      break;
    }
    default: {
      // We should support all pattern types!
      MOZ_ASSERT(false);
+0 −7
Original line number Diff line number Diff line
@@ -633,13 +633,6 @@ void DrawTargetRecording::EnsurePatternDependenciesStored(
              static_cast<const RadialGradientPattern*>(&aPattern)->mStops));
      return;
    }
    case PatternType::CONIC_GRADIENT: {
      MOZ_ASSERT_IF(
          static_cast<const ConicGradientPattern*>(&aPattern)->mStops,
          mRecorder->HasStoredObject(
              static_cast<const ConicGradientPattern*>(&aPattern)->mStops));
      return;
    }
    case PatternType::SURFACE: {
      const SurfacePattern* pat = static_cast<const SurfacePattern*>(&aPattern);
      EnsureSurfaceStoredRecording(mRecorder, pat->mSurface,
+0 −36
Original line number Diff line number Diff line
@@ -494,42 +494,6 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
      }
      break;
    }
    case PatternType::CONIC_GRADIENT: {
      const ConicGradientPattern& pat =
          static_cast<const ConicGradientPattern&>(aPattern);
      GradientStopsSkia* stops =
          static_cast<GradientStopsSkia*>(pat.mStops.get());
      if (!stops || stops->mCount < 2 || !pat.mCenter.IsFinite() ||
          !IsFinite(pat.mAngle)) {
        aPaint.setColor(SK_ColorTRANSPARENT);
      } else {
        SkMatrix mat;
        GfxMatrixToSkiaMatrix(pat.mMatrix, mat);
        if (aMatrix) {
          mat.postConcat(*aMatrix);
        }

        SkScalar cx = SkFloatToScalar(pat.mCenter.x);
        SkScalar cy = SkFloatToScalar(pat.mCenter.y);

        // Skia's sweep gradient angles are relative to the x-axis, not the
        // y-axis.
        Float angle = (pat.mAngle * 180.0 / M_PI) - 90.0;
        if (angle != 0.0) {
          mat.preRotate(angle, cx, cy);
        }

        sk_sp<SkShader> shader = SkGradientShader::MakeSweep(
            cx, cy, &stops->mColors.front(), &stops->mPositions.front(),
            stops->mCount, 0, &mat);
        if (shader) {
          aPaint.setShader(shader);
        } else {
          aPaint.setColor(SK_ColorTRANSPARENT);
        }
      }
      break;
    }
    case PatternType::SURFACE: {
      const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
      sk_sp<SkImage> image =
Loading