Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: Source/core/paint/SVGShapePainter.cpp

Issue 1129793005: Replace OwnPtr with WTF::Optional for optional recorders. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge with master Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/SVGShapePainter.h" 6 #include "core/paint/SVGShapePainter.h"
7 7
8 #include "core/layout/svg/LayoutSVGPath.h" 8 #include "core/layout/svg/LayoutSVGPath.h"
9 #include "core/layout/svg/LayoutSVGResourceMarker.h" 9 #include "core/layout/svg/LayoutSVGResourceMarker.h"
10 #include "core/layout/svg/LayoutSVGShape.h" 10 #include "core/layout/svg/LayoutSVGShape.h"
11 #include "core/layout/svg/SVGLayoutSupport.h" 11 #include "core/layout/svg/SVGLayoutSupport.h"
12 #include "core/layout/svg/SVGMarkerData.h" 12 #include "core/layout/svg/SVGMarkerData.h"
13 #include "core/layout/svg/SVGResources.h" 13 #include "core/layout/svg/SVGResources.h"
14 #include "core/layout/svg/SVGResourcesCache.h" 14 #include "core/layout/svg/SVGResourcesCache.h"
15 #include "core/paint/LayoutObjectDrawingRecorder.h" 15 #include "core/paint/LayoutObjectDrawingRecorder.h"
16 #include "core/paint/ObjectPainter.h" 16 #include "core/paint/ObjectPainter.h"
17 #include "core/paint/PaintInfo.h" 17 #include "core/paint/PaintInfo.h"
18 #include "core/paint/SVGContainerPainter.h" 18 #include "core/paint/SVGContainerPainter.h"
19 #include "core/paint/SVGPaintContext.h" 19 #include "core/paint/SVGPaintContext.h"
20 #include "core/paint/TransformRecorder.h" 20 #include "core/paint/TransformRecorder.h"
21 #include "platform/graphics/paint/DisplayItemListContextRecorder.h" 21 #include "platform/graphics/paint/DisplayItemListContextRecorder.h"
22 #include "third_party/skia/include/core/SkPaint.h" 22 #include "third_party/skia/include/core/SkPaint.h"
23 #include "third_party/skia/include/core/SkPicture.h" 23 #include "third_party/skia/include/core/SkPicture.h"
24 #include "wtf/Optional.h"
24 25
25 namespace blink { 26 namespace blink {
26 27
27 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph icsContextStateSaver& stateSaver) 28 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph icsContextStateSaver& stateSaver)
28 { 29 {
29 if (!strokeTransform.isInvertible()) 30 if (!strokeTransform.isInvertible())
30 return false; 31 return false;
31 32
32 stateSaver.save(); 33 stateSaver.save();
33 stateSaver.context()->concatCTM(strokeTransform.inverse()); 34 stateSaver.context()->concatCTM(strokeTransform.inverse());
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 DisplayItemListContextRecorder contextRecorder(*paintInfo.context); 214 DisplayItemListContextRecorder contextRecorder(*paintInfo.context);
214 PaintInfo markerPaintInfo(paintInfo); 215 PaintInfo markerPaintInfo(paintInfo);
215 markerPaintInfo.context = &contextRecorder.context(); 216 markerPaintInfo.context = &contextRecorder.context();
216 217
217 // It's expensive to track the transformed paint cull rect for each 218 // It's expensive to track the transformed paint cull rect for each
218 // marker so just disable culling. The shape paint call will already be 219 // marker so just disable culling. The shape paint call will already be
219 // culled if it is outside the paint info cull rect. 220 // culled if it is outside the paint info cull rect.
220 markerPaintInfo.rect = LayoutRect::infiniteIntRect(); 221 markerPaintInfo.rect = LayoutRect::infiniteIntRect();
221 222
222 TransformRecorder transformRecorder(*markerPaintInfo.context, marker, ma rker.markerTransformation(position.origin, position.angle, strokeWidth)); 223 TransformRecorder transformRecorder(*markerPaintInfo.context, marker, ma rker.markerTransformation(position.origin, position.angle, strokeWidth));
223 OwnPtr<FloatClipRecorder> clipRecorder; 224 Optional<FloatClipRecorder> clipRecorder;
224 if (SVGLayoutSupport::isOverflowHidden(&marker)) 225 if (SVGLayoutSupport::isOverflowHidden(&marker))
225 clipRecorder = adoptPtr(new FloatClipRecorder(*markerPaintInfo.conte xt, marker, markerPaintInfo.phase, marker.viewport())); 226 clipRecorder.emplace(*markerPaintInfo.context, marker, markerPaintIn fo.phase, marker.viewport());
226 227
227 SVGContainerPainter(marker).paint(markerPaintInfo); 228 SVGContainerPainter(marker).paint(markerPaintInfo);
228 } 229 }
229 } 230 }
230 231
231 void SVGShapePainter::strokeZeroLengthLineCaps(GraphicsContext* context, const S kPaint& strokePaint) 232 void SVGShapePainter::strokeZeroLengthLineCaps(GraphicsContext* context, const S kPaint& strokePaint)
232 { 233 {
233 const Vector<FloatPoint>* zeroLengthLineCaps = m_layoutSVGShape.zeroLengthLi neCaps(); 234 const Vector<FloatPoint>* zeroLengthLineCaps = m_layoutSVGShape.zeroLengthLi neCaps();
234 if (!zeroLengthLineCaps || zeroLengthLineCaps->isEmpty()) 235 if (!zeroLengthLineCaps || zeroLengthLineCaps->isEmpty())
235 return; 236 return;
(...skipping 17 matching lines...) Expand all
253 // This open-codes LayoutSVGShape::nonScalingStrokePath, because the 254 // This open-codes LayoutSVGShape::nonScalingStrokePath, because the
254 // requirements here differ (we have a temporary path that we can 255 // requirements here differ (we have a temporary path that we can
255 // mutate.) 256 // mutate.)
256 if (m_layoutSVGShape.hasNonScalingStroke()) 257 if (m_layoutSVGShape.hasNonScalingStroke())
257 tempPath.transform(nonScalingTransform); 258 tempPath.transform(nonScalingTransform);
258 context->drawPath(tempPath.skPath(), fillPaint); 259 context->drawPath(tempPath.skPath(), fillPaint);
259 } 260 }
260 } 261 }
261 262
262 } // namespace blink 263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698