Ignore:
Timestamp:
Apr 16, 2021, 9:55:43 AM (4 years ago)
Author:
[email protected]
Message:

Refactor parameters to blending functions
https://bugs.webkit.org/show_bug.cgi?id=224433

Reviewed by Dean Jackson.

Reduce the number of parameters passed to the blending functions such that we package
the client and progress together and track whether the animation is discrete instead
of computing it several times. This information is now passed as a BlendingContext
parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation.

When we support composite operations, we'll just need to add a new member to that
struct instead of modifying all the method signatures.

Since we are modifying the method signatures, we also change the RenderStyle pointers
to references since we would never pass in a null value.

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::blendFunc):
(WebCore::blendFilterOperations):
(WebCore::blendFilter):
(WebCore::crossfadeBlend):
(WebCore::AnimationPropertyWrapperBase::canInterpolate const):
(WebCore::PropertyWrapperGetter::value const):
(WebCore::canInterpolateCaretColor):
(WebCore::CSSPropertyAnimation::blendProperties):
(WebCore::CSSPropertyAnimation::propertiesEqual):
(WebCore::CSSPropertyAnimation::canPropertyBeInterpolated):

  • animation/CSSPropertyAnimation.h:
  • animation/KeyframeEffect.cpp:

(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):

  • css/CSSCrossfadeValue.cpp:

(WebCore::blendFunc):
(WebCore::CSSCrossfadeValue::blend const):

  • css/CSSCrossfadeValue.h:
  • css/CSSGradientValue.cpp:

(WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::CSSGradientValue::computeStops):

  • platform/Length.cpp:

(WebCore::blendMixedTypes):
(WebCore::blend):

  • platform/Length.h:
  • platform/LengthPoint.h:

(WebCore::blend):

  • platform/LengthSize.h:

(WebCore::blend):

  • platform/animation/AnimationUtilities.h:

(WebCore::blend):

  • platform/graphics/ColorBlending.cpp:

(WebCore::blend):
(WebCore::blendWithoutPremultiply):

  • platform/graphics/ColorBlending.h:
  • platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:

(WebCore::PlatformCAFilters::colorMatrixValueForFilter):

  • platform/graphics/filters/FilterOperation.cpp:

(WebCore::BasicColorMatrixFilterOperation::blend):
(WebCore::BasicComponentTransferFilterOperation::blend):
(WebCore::InvertLightnessFilterOperation::blend):
(WebCore::BlurFilterOperation::blend):
(WebCore::DropShadowFilterOperation::blend):

  • platform/graphics/filters/FilterOperation.h:

(WebCore::FilterOperation::blend):

  • platform/graphics/transforms/IdentityTransformOperation.h:
  • platform/graphics/transforms/Matrix3DTransformOperation.cpp:

(WebCore::createOperation):
(WebCore::Matrix3DTransformOperation::blend):

  • platform/graphics/transforms/Matrix3DTransformOperation.h:
  • platform/graphics/transforms/MatrixTransformOperation.cpp:

(WebCore::MatrixTransformOperation::blend):

  • platform/graphics/transforms/MatrixTransformOperation.h:
  • platform/graphics/transforms/PerspectiveTransformOperation.cpp:

(WebCore::PerspectiveTransformOperation::blend):

  • platform/graphics/transforms/PerspectiveTransformOperation.h:
  • platform/graphics/transforms/RotateTransformOperation.cpp:

(WebCore::RotateTransformOperation::blend):

  • platform/graphics/transforms/RotateTransformOperation.h:
  • platform/graphics/transforms/ScaleTransformOperation.cpp:

(WebCore::ScaleTransformOperation::blend):

  • platform/graphics/transforms/ScaleTransformOperation.h:
  • platform/graphics/transforms/SkewTransformOperation.cpp:

(WebCore::SkewTransformOperation::blend):

  • platform/graphics/transforms/SkewTransformOperation.h:
  • platform/graphics/transforms/TransformOperation.h:
  • platform/graphics/transforms/TransformOperations.cpp:

(WebCore::TransformOperations::blendByMatchingOperations const):
(WebCore::TransformOperations::blendByUsingMatrixInterpolation const):
(WebCore::TransformOperations::blend const):

  • platform/graphics/transforms/TransformOperations.h:
  • platform/graphics/transforms/TranslateTransformOperation.cpp:

(WebCore::TranslateTransformOperation::blend):

  • platform/graphics/transforms/TranslateTransformOperation.h:
  • rendering/style/BasicShapes.cpp:

(WebCore::BasicShapeCircle::blend const):
(WebCore::BasicShapeEllipse::blend const):
(WebCore::BasicShapePolygon::blend const):
(WebCore::BasicShapePath::blend const):
(WebCore::BasicShapeInset::blend const):

  • rendering/style/BasicShapes.h:

(WebCore::BasicShapeCenterCoordinate::blend const):
(WebCore::BasicShapeRadius::blend const):

  • style/Styleable.cpp:

(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::updateCSSTransitionsForStyleableAndProperty):

  • svg/SVGLengthValue.cpp:

(WebCore::SVGLengthValue::blend):

  • svg/SVGPathBlender.cpp:

(WebCore::blendFloatPoint):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendArcToSegment):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r276002 r276141  
    2727#include "CSSGradientValue.h"
    2828
     29#include "AnimationUtilities.h"
    2930#include "CSSCalculationValue.h"
    3031#include "CSSToLengthConversionData.h"
     
    206207                float interStopProportion = -prevOffset / (nextOffset - prevOffset);
    207208                // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication.
    208                 Color blendedColor = blend(stops[firstZeroOrGreaterIndex - 1].color, stops[firstZeroOrGreaterIndex].color, interStopProportion);
     209                Color blendedColor = blend(stops[firstZeroOrGreaterIndex - 1].color, stops[firstZeroOrGreaterIndex].color, { interStopProportion });
    209210
    210211                // Clamp the positions to 0 and set the color.
     
    257258                float interStopProportion = -previousOffset / (nextOffset - previousOffset);
    258259                // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication.
    259                 Color blendedColor = blend(stops[index - 1].color, stops[index].color, interStopProportion);
     260                Color blendedColor = blend(stops[index - 1].color, stops[index].color, { interStopProportion });
    260261
    261262                // Clamp the positions to 0 and set the color.
     
    287288                float interStopProportion = (1 - previousOffset) / (nextOffset - previousOffset);
    288289                // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication.
    289                 Color blendedColor = blend(stops[index].color, stops[index + 1].color, interStopProportion);
     290                Color blendedColor = blend(stops[index].color, stops[index + 1].color, { interStopProportion });
    290291
    291292                // Clamp the positions to 1 and set the color.
     
    486487            float multiplier = std::pow(relativeOffset, std::log(.5f) / std::log(midpoint));
    487488            // FIXME: Why not premultiply here?
    488             newStops[y].color = blendWithoutPremultiply(color1, color2, multiplier);
     489            newStops[y].color = blendWithoutPremultiply(color1, color2, { multiplier });
    489490        }
    490491
Note: See TracChangeset for help on using the changeset viewer.