Commit a633d48d authored by Andrew Osmond's avatar Andrew Osmond
Browse files

Bug 1873701. a=RyanVM

parent db2f2f0e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3398,6 +3398,10 @@ void DrawTargetWebgl::DrawShadow(const Path* aPath, const Pattern& aPattern,
                                 const ShadowOptions& aShadow,
                                 const DrawOptions& aOptions,
                                 const StrokeOptions* aStrokeOptions) {
  if (!aPath || aPath->GetBackendType() != BackendType::SKIA) {
    return;
  }

  // If there is a WebGL context, then try to cache the path to avoid slow
  // fallbacks.
  if (ShouldAccelPath(aOptions, aStrokeOptions) &&
+11 −8
Original line number Diff line number Diff line
@@ -1690,7 +1690,8 @@ void DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp,
    const ConicGradientPattern* pat =
        static_cast<const ConicGradientPattern*>(&aPattern);

    if (!pat->mStops) {
    if (!pat->mStops ||
        pat->mStops->GetBackendType() != BackendType::DIRECT2D) {
      // Draw nothing because of no color stops
      return;
    }
@@ -1734,7 +1735,7 @@ void DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp,
    return;
  }

  if (!pat->mStops) {
  if (!pat->mStops || pat->mStops->GetBackendType() != BackendType::DIRECT2D) {
    // Draw nothing because of no color stops
    return;
  }
@@ -2077,9 +2078,8 @@ already_AddRefed<ID2D1Brush> DrawTargetD2D1::CreateBrushForPattern(
    const LinearGradientPattern* pat =
        static_cast<const LinearGradientPattern*>(&aPattern);

    GradientStopsD2D* stops = static_cast<GradientStopsD2D*>(pat->mStops.get());

    if (!stops) {
    if (!pat->mStops ||
        pat->mStops->GetBackendType() != BackendType::DIRECT2D) {
      gfxDebug() << "No stops specified for gradient pattern.";
      return CreateTransparentBlackBrush();
    }
@@ -2088,6 +2088,8 @@ already_AddRefed<ID2D1Brush> DrawTargetD2D1::CreateBrushForPattern(
      return CreateTransparentBlackBrush();
    }

    GradientStopsD2D* stops = static_cast<GradientStopsD2D*>(pat->mStops.get());

    mDC->CreateLinearGradientBrush(
        D2D1::LinearGradientBrushProperties(D2DPoint(pat->mBegin),
                                            D2DPoint(pat->mEnd)),
@@ -2106,9 +2108,8 @@ already_AddRefed<ID2D1Brush> DrawTargetD2D1::CreateBrushForPattern(
    const RadialGradientPattern* pat =
        static_cast<const RadialGradientPattern*>(&aPattern);

    GradientStopsD2D* stops = static_cast<GradientStopsD2D*>(pat->mStops.get());

    if (!stops) {
    if (!pat->mStops ||
        pat->mStops->GetBackendType() != BackendType::DIRECT2D) {
      gfxDebug() << "No stops specified for gradient pattern.";
      return CreateTransparentBlackBrush();
    }
@@ -2117,6 +2118,8 @@ already_AddRefed<ID2D1Brush> DrawTargetD2D1::CreateBrushForPattern(
      return CreateTransparentBlackBrush();
    }

    GradientStopsD2D* stops = static_cast<GradientStopsD2D*>(pat->mStops.get());

    // This will not be a complex radial gradient brush.
    mDC->CreateRadialGradientBrush(
        D2D1::RadialGradientBrushProperties(
+5 −5
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ already_AddRefed<FilterNode> DrawTargetRecording::CreateFilter(
    FilterType aType) {
  RefPtr<FilterNode> retNode = new FilterNodeRecording(mRecorder);

  mRecorder->RecordEvent(RecordedFilterNodeCreation(retNode, aType));
  mRecorder->RecordEvent(RecordedFilterNodeCreation(this, retNode, aType));

  return retNode.forget();
}
@@ -617,7 +617,7 @@ already_AddRefed<DrawTarget> DrawTargetRecording::CreateSimilarDrawTarget(
    similarDT =
        new DrawTargetRecording(this, IntRect(IntPoint(0, 0), aSize), aFormat);
    mRecorder->RecordEvent(
        RecordedCreateSimilarDrawTarget(similarDT.get(), aSize, aFormat));
        RecordedCreateSimilarDrawTarget(this, similarDT.get(), aSize, aFormat));
  } else if (XRE_IsContentProcess()) {
    // Crash any content process that calls this function with arguments that
    // would fail to create a similar draw target. We do this to root out bad
@@ -675,8 +675,8 @@ already_AddRefed<GradientStops> DrawTargetRecording::CreateGradientStops(
    GradientStop* aStops, uint32_t aNumStops, ExtendMode aExtendMode) const {
  RefPtr<GradientStops> retStops = new GradientStopsRecording(mRecorder);

  mRecorder->RecordEvent(
      RecordedGradientStopsCreation(retStops, aStops, aNumStops, aExtendMode));
  mRecorder->RecordEvent(RecordedGradientStopsCreation(this, retStops, aStops,
                                                       aNumStops, aExtendMode));

  return retStops.forget();
}
@@ -709,7 +709,7 @@ already_AddRefed<PathRecording> DrawTargetRecording::EnsurePathStored(
  // It's important that AddStoredObject or TryAddStoredObject is called before
  // this because that will run any pending processing required by recorded
  // objects that have been deleted off the main thread.
  mRecorder->RecordEvent(RecordedPathCreation(pathRecording.get()));
  mRecorder->RecordEvent(RecordedPathCreation(this, pathRecording.get()));
  pathRecording->mStoredRecorders.push_back(mRecorder);

  return pathRecording.forget();
+12 −3
Original line number Diff line number Diff line
@@ -474,7 +474,9 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
      const LinearGradientPattern& pat =
          static_cast<const LinearGradientPattern&>(aPattern);
      GradientStopsSkia* stops =
          static_cast<GradientStopsSkia*>(pat.mStops.get());
          pat.mStops && pat.mStops->GetBackendType() == BackendType::SKIA
              ? static_cast<GradientStopsSkia*>(pat.mStops.get())
              : nullptr;
      if (!stops || stops->mCount < 2 || !pat.mBegin.IsFinite() ||
          !pat.mEnd.IsFinite() || pat.mBegin == pat.mEnd) {
        aPaint.setColor(SK_ColorTRANSPARENT);
@@ -506,7 +508,9 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
      const RadialGradientPattern& pat =
          static_cast<const RadialGradientPattern&>(aPattern);
      GradientStopsSkia* stops =
          static_cast<GradientStopsSkia*>(pat.mStops.get());
          pat.mStops && pat.mStops->GetBackendType() == BackendType::SKIA
              ? static_cast<GradientStopsSkia*>(pat.mStops.get())
              : nullptr;
      if (!stops || stops->mCount < 2 || !pat.mCenter1.IsFinite() ||
          !std::isfinite(pat.mRadius1) || !pat.mCenter2.IsFinite() ||
          !std::isfinite(pat.mRadius2) ||
@@ -541,7 +545,9 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
      const ConicGradientPattern& pat =
          static_cast<const ConicGradientPattern&>(aPattern);
      GradientStopsSkia* stops =
          static_cast<GradientStopsSkia*>(pat.mStops.get());
          pat.mStops && pat.mStops->GetBackendType() == BackendType::SKIA
              ? static_cast<GradientStopsSkia*>(pat.mStops.get())
              : nullptr;
      if (!stops || stops->mCount < 2 || !pat.mCenter.IsFinite() ||
          !std::isfinite(pat.mAngle)) {
        aPaint.setColor(SK_ColorTRANSPARENT);
@@ -747,6 +753,9 @@ DrawTargetType DrawTargetSkia::GetType() const {
void DrawTargetSkia::DrawFilter(FilterNode* aNode, const Rect& aSourceRect,
                                const Point& aDestPoint,
                                const DrawOptions& aOptions) {
  if (!aNode || aNode->GetBackendType() != FILTER_BACKEND_SOFTWARE) {
    return;
  }
  FilterNodeSoftware* filter = static_cast<FilterNodeSoftware*>(aNode);
  filter->Draw(this, aSourceRect, aDestPoint, aOptions);
}
+3 −3
Original line number Diff line number Diff line
@@ -122,9 +122,9 @@ class Translator {
   * @return an already addrefed GradientStops for our DrawTarget type
   */
  virtual already_AddRefed<GradientStops> GetOrCreateGradientStops(
      GradientStop* aRawStops, uint32_t aNumStops, ExtendMode aExtendMode) {
    return GetReferenceDrawTarget()->CreateGradientStops(aRawStops, aNumStops,
                                                         aExtendMode);
      DrawTarget* aDrawTarget, GradientStop* aRawStops, uint32_t aNumStops,
      ExtendMode aExtendMode) {
    return aDrawTarget->CreateGradientStops(aRawStops, aNumStops, aExtendMode);
  }
  virtual void AddGradientStops(ReferencePtr aRefPtr, GradientStops* aPath) = 0;
  virtual void RemoveGradientStops(ReferencePtr aRefPtr) = 0;
Loading