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

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

Issue 1070703002: Explicitly use SkPaint(s) in SVGInlineTextBoxPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void SVGPaintContext::paintSubtree(GraphicsContext* context, LayoutObject* item) 190 void SVGPaintContext::paintSubtree(GraphicsContext* context, LayoutObject* item)
191 { 191 {
192 ASSERT(context); 192 ASSERT(context);
193 ASSERT(item); 193 ASSERT(item);
194 ASSERT(!item->needsLayout()); 194 ASSERT(!item->needsLayout());
195 195
196 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 196 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
197 item->paint(info, IntPoint()); 197 item->paint(info, IntPoint());
198 } 198 }
199 199
200 bool SVGPaintContext::paintForLayoutObject(const PaintInfo& paintInfo, const Com putedStyle& style, LayoutObject& layoutObject, LayoutSVGResourceMode resourceMod e, SkPaint& paint, const AffineTransform* additionalPaintServerTransform)
201 {
202 if (paintInfo.isRenderingClipPathAsMaskImage()) {
203 if (resourceMode == ApplyToStrokeMode)
204 return false;
205 paint.setColor(SVGComputedStyle::initialFillPaintColor().rgb());
206 paint.setShader(nullptr);
207 return true;
208 }
209
210 SVGPaintServer paintServer = SVGPaintServer::requestForLayoutObject(layoutOb ject, style, resourceMode);
211 if (!paintServer.isValid())
212 return false;
213
214 if (additionalPaintServerTransform && paintServer.isTransformDependent())
215 paintServer.prependTransform(*additionalPaintServerTransform);
216
217 const SVGComputedStyle& svgStyle = style.svgStyle();
218 float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity() : svgStyle.strokeOpacity();
219 paintServer.applyToSkPaint(paint, paintAlpha);
220
221 paint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(Interpol ationDefault));
222
223 // TODO(fs): The color filter can set when generating a picture for a mask -
224 // due to color-interpolation. We could also just apply the
225 // color-interpolation property from the the shape itself (which could mean
226 // the paintserver if it has it specified), since that would be more in line
227 // with the spec for color-interpolation. For now, just steal it from the GC
228 // though.
229 // Additionally, it's not really safe/guaranteed to be correct, as
230 // something down the paint pipe may want to farther tweak the color
231 // filter, which could yield incorrect results. (Consider just using
232 // saveLayer() w/ this color filter explicitly instead.)
233 paint.setColorFilter(paintInfo.context->colorFilter());
234 return true;
235 }
236
200 } // namespace blink 237 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698