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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGClipPainter.cpp

Issue 1841833002: Deal gracefully with null {GraphicsContext,SkPictureBuilder}.endRecording() results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't end recording twice in DrawingRecorder. Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/paint/SVGClipPainter.h" 5 #include "core/paint/SVGClipPainter.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/layout/svg/LayoutSVGResourceClipper.h" 8 #include "core/layout/svg/LayoutSVGResourceClipper.h"
9 #include "core/layout/svg/SVGLayoutSupport.h" 9 #include "core/layout/svg/SVGLayoutSupport.h"
10 #include "core/layout/svg/SVGResources.h" 10 #include "core/layout/svg/SVGResources.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 { 120 {
121 AffineTransform contentTransform; 121 AffineTransform contentTransform;
122 if (m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUN DINGBOX) { 122 if (m_clip.clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUN DINGBOX) {
123 contentTransform.translate(targetBoundingBox.x(), targetBounding Box.y()); 123 contentTransform.translate(targetBoundingBox.x(), targetBounding Box.y());
124 contentTransform.scaleNonUniform(targetBoundingBox.width(), targ etBoundingBox.height()); 124 contentTransform.scaleNonUniform(targetBoundingBox.width(), targ etBoundingBox.height());
125 } 125 }
126 SubtreeContentTransformScope contentTransformScope(contentTransform) ; 126 SubtreeContentTransformScope contentTransformScope(contentTransform) ;
127 127
128 TransformRecorder contentTransformRecorder(maskContext, layoutObject , contentTransform); 128 TransformRecorder contentTransformRecorder(maskContext, layoutObject , contentTransform);
129 RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPic ture(); 129 RefPtr<const SkPicture> clipContentPicture = m_clip.createContentPic ture();
130 maskContext.getPaintController().createAndAppend<DrawingDisplayItem> (layoutObject, DisplayItem::SVGClip, clipContentPicture.get()); 130 if (clipContentPicture)
131 maskContext.getPaintController().createAndAppend<DrawingDisplayI tem>(layoutObject, DisplayItem::SVGClip, clipContentPicture.get());
131 } 132 }
132 133
133 if (clipPathClipper) 134 if (clipPathClipper)
134 SVGClipPainter(*clipPathClipper).finishEffect(m_clip, maskContext, c lipPathClipperState); 135 SVGClipPainter(*clipPathClipper).finishEffect(m_clip, maskContext, c lipPathClipperState);
135 } 136 }
136 137
137 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGClip, targetPaintInvalidationRect); 138 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGClip, targetPaintInvalidationRect);
138 RefPtr<SkPicture> maskPicture = maskPictureBuilder.endRecording(); 139 RefPtr<SkPicture> maskPicture = maskPictureBuilder.endRecording();
139 context.drawPicture(maskPicture.get()); 140 if (maskPicture)
141 context.drawPicture(maskPicture.get());
140 return true; 142 return true;
141 } 143 }
142 144
143 } // namespace blink 145 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698