Changeset 271472 in webkit
- Timestamp:
- Jan 13, 2021, 4:07:24 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/Gradient.cpp (modified) (5 diffs)
-
platform/graphics/Gradient.h (modified) (7 diffs)
-
platform/graphics/GradientImage.h (modified) (1 diff)
-
platform/graphics/GraphicsContext.cpp (modified) (4 diffs)
-
platform/graphics/GraphicsContext.h (modified) (3 diffs)
-
platform/graphics/cairo/CairoOperations.cpp (modified) (2 diffs)
-
platform/graphics/cairo/GradientCairo.cpp (modified) (3 diffs)
-
platform/graphics/cairo/GraphicsContextImplCairo.cpp (modified) (1 diff)
-
platform/graphics/cg/GraphicsContextCG.cpp (modified) (8 diffs)
-
platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h (modified) (1 diff)
-
platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp (modified) (3 diffs)
-
platform/graphics/displaylists/DisplayListItems.cpp (modified) (3 diffs)
-
platform/graphics/displaylists/DisplayListItems.h (modified) (2 diffs)
-
platform/graphics/displaylists/DisplayListRecorder.cpp (modified) (1 diff)
-
platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp (modified) (1 diff)
-
rendering/svg/RenderSVGPath.cpp (modified) (1 diff)
-
rendering/svg/RenderSVGResourceGradient.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271471 r271472 1 2021-01-13 Said Abou-Hallawa <said@apple.com> 2 3 Move the space transform outside the Gradient class 4 https://bugs.webkit.org/show_bug.cgi?id=220079 5 6 Reviewed by Simon Fraser. 7 8 Move the SpaceTransform from the Gradient class to the GraphicsContextState. 9 The client will set it when calling GraphicsContext::setFillGradient() 10 and GraphicsContext::setFillGradient(). 11 12 * platform/graphics/Gradient.cpp: 13 (WebCore::Gradient::hash const): 14 (WebCore::Gradient::setGradientSpaceTransform): Deleted. 15 * platform/graphics/Gradient.h: 16 (WebCore::Gradient::encode const): 17 (WebCore::Gradient::decode): 18 (WebCore::Gradient::gradientSpaceTransform const): Deleted. 19 * platform/graphics/GradientImage.h: 20 Need to initialize m_cachedGeneratorHash. 21 22 * platform/graphics/GraphicsContext.cpp: 23 (WebCore::GraphicsContextStateChange::apply const): 24 (WebCore::GraphicsContext::setStrokeGradient): 25 (WebCore::GraphicsContext::setFillGradient): 26 * platform/graphics/GraphicsContext.h: 27 (WebCore::GraphicsContext::setStrokeGradient): 28 (WebCore::GraphicsContext::setFillGradient): 29 Clients of GraphicsContext have to send the Gradient and SpaceTransform 30 to setStrokeGradient() and setFillGradient(). 31 32 * platform/graphics/cairo/CairoOperations.cpp: 33 (WebCore::Cairo::FillSource::FillSource): 34 (WebCore::Cairo::StrokeSource::StrokeSource): 35 * platform/graphics/cairo/GradientCairo.cpp: 36 (WebCore::Gradient::createPattern): 37 (WebCore::Gradient::fill): 38 * platform/graphics/cairo/GraphicsContextImplCairo.cpp: 39 (WebCore::GraphicsContextImplCairo::fillRect): 40 For Cairo ports, Gradient::createPattern() will take SpaceTransform as 41 a new argument. Clients will get it from the GraphicsContextState since 42 the Gradient and the SpaceTransform are set in it in the same call. 43 44 * platform/graphics/cg/GraphicsContextCG.cpp: 45 (WebCore::GraphicsContext::fillPath): 46 (WebCore::GraphicsContext::strokePath): 47 (WebCore::GraphicsContext::fillRect): 48 (WebCore::GraphicsContext::strokeRect): 49 * platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h: 50 * platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp: 51 (WebCore::DisplayList::DrawGlyphsRecorder::populateInternalState): 52 (WebCore::DisplayList::DrawGlyphsRecorder::populateInternalContext): 53 * platform/graphics/displaylists/DisplayListItems.cpp: 54 (WebCore::DisplayList::SetInlineFillGradient::SetInlineFillGradient): 55 (WebCore::DisplayList::SetInlineFillGradient::gradient const): 56 (WebCore::DisplayList::SetInlineFillGradient::apply const): 57 * platform/graphics/displaylists/DisplayListItems.h: 58 * platform/graphics/displaylists/DisplayListRecorder.cpp: 59 (WebCore::DisplayList::Recorder::appendStateChangeItem): 60 * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: 61 (Nicosia::CairoOperationRecorder::fillRect): 62 * rendering/svg/RenderSVGPath.cpp: 63 (WebCore::useStrokeStyleToFill): 64 65 * rendering/svg/RenderSVGResourceGradient.cpp: 66 (WebCore::RenderSVGResourceGradient::applyResource): 67 (WebCore::RenderSVGResourceGradient::postApplyResource): 68 userspaceTransform is calculated inside the lambda of m_gradientMap.ensure(). 69 It is stored in GradientData. It is retrieved later to setStrokeGradient() 70 and setFillGradient(). 71 1 72 2021-01-13 Jer Noble <jer.noble@apple.com> 2 73 -
trunk/Source/WebCore/platform/graphics/Gradient.cpp
r264280 r271472 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008, 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 4 * … … 46 46 { 47 47 } 48 49 Gradient::~Gradient() = default;50 48 51 49 void Gradient::adjustParametersForTiledDrawing(FloatSize& size, FloatRect& srcRect, const FloatSize& spacing) … … 128 126 } 129 127 130 void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)131 {132 if (m_gradientSpaceTransformation == gradientSpaceTransformation)133 return;134 m_gradientSpaceTransformation = gradientSpaceTransformation;135 m_cachedHash = 0;136 }137 138 128 // FIXME: Instead of these add(Hasher) functions, consider using encode functions to compute the hash. 139 129 … … 147 137 { 148 138 add(hasher, point.x(), point.y()); 149 }150 151 static void add(Hasher& hasher, const AffineTransform& transform)152 {153 add(hasher, transform.a(), transform.b(), transform.c(), transform.d(), transform.e(), transform.f());154 139 } 155 140 … … 178 163 if (!m_cachedHash) { 179 164 sortStops(); 180 m_cachedHash = computeHash(m_data, m_spreadMethod, m_ gradientSpaceTransformation, m_stops);165 m_cachedHash = computeHash(m_data, m_spreadMethod, m_stops); 181 166 } 182 167 return m_cachedHash; -
trunk/Source/WebCore/platform/graphics/Gradient.h
r264510 r271472 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008, 2011, 2012, 2013Apple Inc. All rights reserved.2 * Copyright (C) 2006-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 4 * Copyright (C) 2008 Torch Mobile, Inc. … … 105 105 WEBCORE_EXPORT static Ref<Gradient> create(Data&&); 106 106 107 WEBCORE_EXPORT ~Gradient();108 109 107 bool isZeroSize() const; 110 108 … … 119 117 GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } 120 118 121 WEBCORE_EXPORT void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation);122 const AffineTransform& gradientSpaceTransform() const { return m_gradientSpaceTransformation; }123 124 119 void fill(GraphicsContext&, const FloatRect&); 125 120 void adjustParametersForTiledDrawing(FloatSize&, FloatRect&, const FloatSize& spacing); … … 128 123 129 124 #if USE(CAIRO) 130 RefPtr<cairo_pattern_t> createPattern(float globalAlpha );125 RefPtr<cairo_pattern_t> createPattern(float globalAlpha, const AffineTransform&); 131 126 #endif 132 127 … … 158 153 GradientSpreadMethod m_spreadMethod { GradientSpreadMethod::Pad }; 159 154 mutable unsigned m_cachedHash { 0 }; 160 AffineTransform m_gradientSpaceTransformation;161 155 162 156 #if USE(CG) … … 277 271 encoder << m_stopsSorted; 278 272 encoder << m_spreadMethod; 279 encoder << m_gradientSpaceTransformation;280 273 } 281 274 … … 308 301 gradient->setSpreadMethod(spreadMethod); 309 302 310 Optional<AffineTransform> gradientSpaceTransformation;311 decoder >> gradientSpaceTransformation;312 if (!gradientSpaceTransformation)313 return WTF::nullopt;314 gradient->setGradientSpaceTransform(WTFMove(*gradientSpaceTransformation));315 316 303 return gradient; 317 304 } -
trunk/Source/WebCore/platform/graphics/GradientImage.h
r249217 r271472 55 55 RefPtr<Image> m_cachedImage; 56 56 FloatSize m_cachedAdjustedSize; 57 unsigned m_cachedGeneratorHash ;57 unsigned m_cachedGeneratorHash { 0 }; 58 58 FloatSize m_cachedScaleFactor; 59 59 }; -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r271295 r271472 212 212 { 213 213 if (m_changeFlags.contains(GraphicsContextState::StrokeGradientChange)) 214 context.setStrokeGradient(*m_state.strokeGradient );214 context.setStrokeGradient(*m_state.strokeGradient, m_state.strokeGradientSpaceTransform); 215 215 216 216 if (m_changeFlags.contains(GraphicsContextState::StrokePatternChange)) … … 218 218 219 219 if (m_changeFlags.contains(GraphicsContextState::FillGradientChange)) 220 context.setFillGradient(*m_state.fillGradient );220 context.setFillGradient(*m_state.fillGradient, m_state.fillGradientSpaceTransform); 221 221 222 222 if (m_changeFlags.contains(GraphicsContextState::FillPatternChange)) … … 621 621 } 622 622 623 void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient )623 void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient, const AffineTransform& strokeGradientSpaceTransform) 624 624 { 625 625 m_state.strokeColor = { }; 626 626 m_state.strokeGradient = WTFMove(gradient); 627 m_state.strokeGradientSpaceTransform = strokeGradientSpaceTransform; 627 628 m_state.strokePattern = nullptr; 628 629 if (m_impl) … … 637 638 } 638 639 639 void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient )640 void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient, const AffineTransform& fillGradientSpaceTransform) 640 641 { 641 642 m_state.fillColor = { }; 642 643 m_state.fillGradient = WTFMove(gradient); 644 m_state.fillGradientSpaceTransform = fillGradientSpaceTransform; 643 645 m_state.fillPattern = nullptr; 644 646 if (m_impl) -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r270221 r271472 213 213 Color shadowColor; 214 214 215 AffineTransform strokeGradientSpaceTransform; 216 AffineTransform fillGradientSpaceTransform; 217 215 218 StrokeStyle strokeStyle { SolidStroke }; 216 219 WindRule fillRule { WindRule::NonZero }; … … 304 307 Pattern* strokePattern() const { return m_state.strokePattern.get(); } 305 308 306 void setStrokeGradient(Ref<Gradient>&& );309 void setStrokeGradient(Ref<Gradient>&&, const AffineTransform& = { }); 307 310 Gradient* strokeGradient() const { return m_state.strokeGradient.get(); } 308 311 … … 316 319 Pattern* fillPattern() const { return m_state.fillPattern.get(); } 317 320 318 WEBCORE_EXPORT void setFillGradient(Ref<Gradient>&& );321 WEBCORE_EXPORT void setFillGradient(Ref<Gradient>&&, const AffineTransform& = { }); 319 322 Gradient* fillGradient() const { return m_state.fillGradient.get(); } 320 323 -
trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
r269614 r271472 573 573 pattern.repeatY = state.fillPattern->repeatY(); 574 574 } else if (state.fillGradient) { 575 gradient.base = state.fillGradient->createPattern(1 );575 gradient.base = state.fillGradient->createPattern(1, state.fillGradientSpaceTransform); 576 576 if (state.alpha != 1) 577 gradient.alphaAdjusted = state.fillGradient->createPattern(state.alpha );577 gradient.alphaAdjusted = state.fillGradient->createPattern(state.alpha, state.fillGradientSpaceTransform); 578 578 } else 579 579 color = state.fillColor; … … 586 586 pattern = adoptRef(state.strokePattern->createPlatformPattern(AffineTransform())); 587 587 else if (state.strokeGradient) { 588 gradient.base = state.strokeGradient->createPattern(1 );588 gradient.base = state.strokeGradient->createPattern(1, state.strokeGradientSpaceTransform); 589 589 if (state.alpha != 1) 590 gradient.alphaAdjusted = state.strokeGradient->createPattern(state.alpha );590 gradient.alphaAdjusted = state.strokeGradient->createPattern(state.alpha, state.strokeGradientSpaceTransform); 591 591 } else 592 592 color = state.strokeColor; -
trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp
r264449 r271472 159 159 } 160 160 161 RefPtr<cairo_pattern_t> Gradient::createPattern(float globalAlpha )161 RefPtr<cairo_pattern_t> Gradient::createPattern(float globalAlpha, const AffineTransform& gradientSpaceTransform) 162 162 { 163 163 auto gradient = WTF::switchOn(m_data, … … 196 196 } 197 197 198 cairo_matrix_t matrix = toCairoMatrix( m_gradientSpaceTransformation);198 cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransform); 199 199 cairo_matrix_invert(&matrix); 200 200 cairo_pattern_set_matrix(gradient.get(), &matrix); … … 205 205 void Gradient::fill(GraphicsContext& context, const FloatRect& rect) 206 206 { 207 auto pattern = createPattern(1.0 );207 auto pattern = createPattern(1.0, context.state().fillGradientSpaceTransform); 208 208 if (!pattern) 209 209 return; -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp
r269753 r271472 155 155 void GraphicsContextImplCairo::fillRect(const FloatRect& rect, Gradient& gradient) 156 156 { 157 auto pattern = gradient.createPattern(1.0); 157 auto& state = graphicsContext().state(); 158 auto pattern = gradient.createPattern(1.0, state.fillGradientSpaceTransform); 158 159 if (!pattern) 159 160 return; -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r271089 r271472 683 683 CGContextBeginPath(layerContext); 684 684 CGContextAddPath(layerContext, path.platformPath()); 685 CGContextConcatCTM(layerContext, m_state.fillGradient ->gradientSpaceTransform());685 CGContextConcatCTM(layerContext, m_state.fillGradientSpaceTransform); 686 686 687 687 if (fillRule() == WindRule::EvenOdd) … … 697 697 CGContextAddPath(context, path.platformPath()); 698 698 CGContextStateSaver stateSaver(context); 699 CGContextConcatCTM(context, m_state.fillGradient ->gradientSpaceTransform());699 CGContextConcatCTM(context, m_state.fillGradientSpaceTransform); 700 700 701 701 if (fillRule() == WindRule::EvenOdd) … … 761 761 CGContextReplacePathWithStrokedPath(layerContext); 762 762 CGContextClip(layerContext); 763 CGContextConcatCTM(layerContext, m_state.strokeGradient ->gradientSpaceTransform());763 CGContextConcatCTM(layerContext, m_state.strokeGradientSpaceTransform); 764 764 m_state.strokeGradient->paint(layerContext); 765 765 … … 774 774 CGContextReplacePathWithStrokedPath(context); 775 775 CGContextClip(context); 776 CGContextConcatCTM(context, m_state.strokeGradient ->gradientSpaceTransform());776 CGContextConcatCTM(context, m_state.strokeGradientSpaceTransform); 777 777 m_state.strokeGradient->paint(*this); 778 778 } … … 826 826 CGContextClip(layerContext); 827 827 828 CGContextConcatCTM(layerContext, m_state.fillGradient ->gradientSpaceTransform());828 CGContextConcatCTM(layerContext, m_state.fillGradientSpaceTransform); 829 829 m_state.fillGradient->paint(layerContext); 830 830 CGContextDrawLayerInRect(context, rect, layer); … … 832 832 } else { 833 833 CGContextClipToRect(context, rect); 834 CGContextConcatCTM(context, m_state.fillGradient ->gradientSpaceTransform());834 CGContextConcatCTM(context, m_state.fillGradientSpaceTransform); 835 835 m_state.fillGradient->paint(*this); 836 836 } … … 1244 1244 CGContextReplacePathWithStrokedPath(layerContext); 1245 1245 CGContextClip(layerContext); 1246 CGContextConcatCTM(layerContext, m_state.strokeGradient ->gradientSpaceTransform());1246 CGContextConcatCTM(layerContext, m_state.strokeGradientSpaceTransform); 1247 1247 m_state.strokeGradient->paint(layerContext); 1248 1248 … … 1257 1257 CGContextReplacePathWithStrokedPath(context); 1258 1258 CGContextClip(context); 1259 CGContextConcatCTM(context, m_state.strokeGradient ->gradientSpaceTransform());1259 CGContextConcatCTM(context, m_state.strokeGradientSpaceTransform); 1260 1260 m_state.strokeGradient->paint(*this); 1261 1261 } -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h
r269497 r271472 99 99 Color color; 100 100 RefPtr<Gradient> gradient; 101 AffineTransform gradientSpaceTransform; 101 102 RefPtr<Pattern> pattern; 102 103 }; -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp
r270725 r271472 99 99 m_originalState.fillStyle.color = contextState.fillColor; 100 100 m_originalState.fillStyle.gradient = contextState.fillGradient; 101 m_originalState.fillStyle.gradientSpaceTransform = contextState.fillGradientSpaceTransform; 101 102 m_originalState.fillStyle.pattern = contextState.fillPattern; 102 103 103 104 m_originalState.strokeStyle.color = contextState.strokeColor; 104 105 m_originalState.strokeStyle.gradient = contextState.strokeGradient; 106 m_originalState.strokeStyle.gradientSpaceTransform = contextState.strokeGradientSpaceTransform; 105 107 m_originalState.strokeStyle.pattern = contextState.strokePattern; 106 108 … … 120 122 m_internalContext.setFillColor(m_originalState.fillStyle.color); 121 123 else if (m_originalState.fillStyle.gradient) 122 m_internalContext.setFillGradient(*m_originalState.fillStyle.gradient );124 m_internalContext.setFillGradient(*m_originalState.fillStyle.gradient, m_originalState.fillStyle.gradientSpaceTransform); 123 125 else { 124 126 ASSERT(m_originalState.fillStyle.pattern); … … 130 132 m_internalContext.setStrokeColor(m_originalState.strokeStyle.color); 131 133 else if (m_originalState.strokeStyle.gradient) 132 m_internalContext.setStrokeGradient(*m_originalState.strokeStyle.gradient );134 m_internalContext.setStrokeGradient(*m_originalState.strokeStyle.gradient, m_originalState.strokeStyle.gradientSpaceTransform); 133 135 else { 134 136 ASSERT(m_originalState.strokeStyle.pattern); -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
r270725 r271472 116 116 } 117 117 118 SetInlineFillGradient::SetInlineFillGradient(const Gradient& gradient )118 SetInlineFillGradient::SetInlineFillGradient(const Gradient& gradient, const AffineTransform& gradientSpaceTransform) 119 119 : m_data(gradient.data()) 120 , m_gradientSpaceTransform ation(gradient.gradientSpaceTransform())120 , m_gradientSpaceTransform(gradientSpaceTransform) 121 121 , m_spreadMethod(gradient.spreadMethod()) 122 122 , m_colorStopCount(static_cast<uint8_t>(gradient.stops().size())) … … 129 129 } 130 130 131 Ref<Gradient> SetInlineFillGradient::gradient() const 132 { 133 auto gradient = Gradient::create(Gradient::Data(m_data)); 134 for (uint8_t i = 0; i < m_colorStopCount; ++i) 135 gradient->addColorStop({ m_offsets[i], Color(m_colors[i]) }); 136 gradient->setSpreadMethod(m_spreadMethod); 137 gradient->setGradientSpaceTransform(m_gradientSpaceTransformation); 138 return gradient; 139 } 140 141 SetInlineFillGradient::SetInlineFillGradient(float offsets[maxColorStopCount], SRGBA<uint8_t> colors[maxColorStopCount], const Gradient::Data& data, const AffineTransform& gradientSpaceTransformation, GradientSpreadMethod spreadMethod, uint8_t colorStopCount) 131 SetInlineFillGradient::SetInlineFillGradient(float offsets[maxColorStopCount], SRGBA<uint8_t> colors[maxColorStopCount], const Gradient::Data& data, const AffineTransform& gradientSpaceTransform, GradientSpreadMethod spreadMethod, uint8_t colorStopCount) 142 132 : m_data(data) 143 , m_gradientSpaceTransform ation(gradientSpaceTransformation)133 , m_gradientSpaceTransform(gradientSpaceTransform) 144 134 , m_spreadMethod(spreadMethod) 145 135 , m_colorStopCount(colorStopCount) … … 152 142 } 153 143 144 Ref<Gradient> SetInlineFillGradient::gradient() const 145 { 146 auto gradient = Gradient::create(Gradient::Data(m_data)); 147 for (uint8_t i = 0; i < m_colorStopCount; ++i) 148 gradient->addColorStop({ m_offsets[i], Color(m_colors[i]) }); 149 gradient->setSpreadMethod(m_spreadMethod); 150 return gradient; 151 } 152 154 153 void SetInlineFillGradient::apply(GraphicsContext& context) const 155 154 { 156 155 if (m_colorStopCount <= maxColorStopCount) 157 context.setFillGradient(gradient() );156 context.setFillGradient(gradient(), m_gradientSpaceTransform); 158 157 } 159 158 -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
r270725 r271472 175 175 static constexpr uint8_t maxColorStopCount = 4; 176 176 177 SetInlineFillGradient(const Gradient&); 178 WEBCORE_EXPORT SetInlineFillGradient(float offsets[maxColorStopCount], SRGBA<uint8_t> colors[maxColorStopCount], const Gradient::Data&, 179 const AffineTransform& gradientSpaceTransformation, GradientSpreadMethod, uint8_t colorStopCount); 177 SetInlineFillGradient(const Gradient&, const AffineTransform& gradientSpaceTransform); 178 WEBCORE_EXPORT SetInlineFillGradient(float offsets[maxColorStopCount], SRGBA<uint8_t> colors[maxColorStopCount], const Gradient::Data&, const AffineTransform& gradientSpaceTransform, GradientSpreadMethod, uint8_t colorStopCount); 180 179 181 180 static bool isInline(const Gradient&); … … 188 187 SRGBA<uint8_t> m_colors[maxColorStopCount]; 189 188 Gradient::Data m_data; 190 AffineTransform m_gradientSpaceTransform ation;189 AffineTransform m_gradientSpaceTransform; 191 190 GradientSpreadMethod m_spreadMethod { GradientSpreadMethod::Pad }; 192 191 uint8_t m_colorStopCount { 0 }; -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
r271415 r271472 103 103 104 104 if (changeFlags.contains(GraphicsContextState::FillGradientChange)) 105 append<SetInlineFillGradient>(*changes.m_state.fillGradient );105 append<SetInlineFillGradient>(*changes.m_state.fillGradient, changes.m_state.fillGradientSpaceTransform); 106 106 } 107 107 -
trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
r269753 r271472 293 293 }; 294 294 295 append(createCommand<FillRect>(rect, gradient.createPattern(1.0))); 295 auto& state = graphicsContext().state(); 296 append(createCommand<FillRect>(rect, gradient.createPattern(1.0, state.fillGradientSpaceTransform))); 296 297 } 297 298 -
trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp
r264333 r271472 70 70 { 71 71 if (auto gradient = context.strokeGradient()) 72 context.setFillGradient(*gradient );72 context.setFillGradient(*gradient, context.state().strokeGradientSpaceTransform); 73 73 else if (Pattern* pattern = context.strokePattern()) 74 74 context.setFillPattern(*pattern); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp
r269323 r271472 146 146 } 147 147 148 gradient->setGradientSpaceTransform(userspaceTransform);149 150 148 return { WTFMove(gradient), userspaceTransform }; 151 149 }).iterator->value; … … 165 163 166 164 auto& svgStyle = style.svgStyle(); 165 auto userspaceTransform = gradientData.userspaceTransform; 167 166 168 167 if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) { 169 168 context->setAlpha(svgStyle.fillOpacity()); 170 context->setFillGradient(*gradientData.gradient );169 context->setFillGradient(*gradientData.gradient, userspaceTransform); 171 170 context->setFillRule(svgStyle.fillRule()); 172 171 } else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) { 173 172 if (svgStyle.vectorEffect() == VectorEffect::NonScalingStroke) 174 gradientData.gradient->setGradientSpaceTransform(transformOnNonScalingStroke(&renderer, gradientData.userspaceTransform));173 userspaceTransform = transformOnNonScalingStroke(&renderer, gradientData.userspaceTransform); 175 174 context->setAlpha(svgStyle.strokeOpacity()); 176 context->setStrokeGradient(*gradientData.gradient );175 context->setStrokeGradient(*gradientData.gradient, userspaceTransform); 177 176 SVGRenderSupport::applyStrokeStyleToContext(context, style, renderer); 178 177 } … … 198 197 199 198 FloatRect targetRect; 200 gradient.setGradientSpaceTransform(clipToTextMask(*context, m_imageBuffer, targetRect, &renderer, gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX, gradientTransform()));201 202 context->setFillGradient(gradient );199 AffineTransform userspaceTransform = clipToTextMask(*context, m_imageBuffer, targetRect, &renderer, gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX, gradientTransform()); 200 201 context->setFillGradient(gradient, userspaceTransform); 203 202 context->fillRect(targetRect); 204 203
Note:
See TracChangeset
for help on using the changeset viewer.