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

Side by Side Diff: Source/core/rendering/svg/SVGRenderSupport.cpp

Issue 638933002: Introduce SVGPaintServer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Disambiguate. Created 6 years, 2 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return; 387 return;
388 388
389 DashArray dashArray; 389 DashArray dashArray;
390 size_t length = dashes->length(); 390 size_t length = dashes->length();
391 for (size_t i = 0; i < length; ++i) 391 for (size_t i = 0; i < length; ++i)
392 dashArray.append(dashes->at(i)->value(lengthContext)); 392 dashArray.append(dashes->at(i)->value(lengthContext));
393 393
394 strokeData->setLineDash(dashArray, svgStyle.strokeDashOffset()->value(length Context)); 394 strokeData->setLineDash(dashArray, svgStyle.strokeDashOffset()->value(length Context));
395 } 395 }
396 396
397 bool SVGRenderSupport::updateGraphicsContext(GraphicsContextStateSaver& stateSav er, RenderStyle* style, RenderObject& renderer, unsigned resourceModeFlags)
398 {
399 ASSERT(style);
400
401 RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(reso urceModeFlags & (ApplyToFillMode | ApplyToStrokeMode));
402 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode) ;
403
404 GraphicsContext* context = stateSaver.context();
405 if (isRenderingClipPathAsMaskImage(renderer)) {
406 if (resourceMode == ApplyToStrokeMode)
407 return false;
408 context->setAlphaAsFloat(1);
409 context->setFillColor(SVGRenderStyle::initialFillPaintColor());
410 return true;
411 }
412
413 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st yle, resourceModeFlags);
414 if (!paintServer.isValid())
415 return false;
416 paintServer.apply(*context, resourceMode, &stateSaver);
417
418 const SVGRenderStyle& svgStyle = style->svgStyle();
419
420 if (resourceMode == ApplyToFillMode) {
421 context->setAlphaAsFloat(svgStyle.fillOpacity());
422 context->setFillRule(svgStyle.fillRule());
423 } else {
424 context->setAlphaAsFloat(svgStyle.strokeOpacity());
425 applyStrokeStyleToContext(context, style, &renderer);
426 }
427 return true;
428 }
429
397 void SVGRenderSupport::fillOrStrokePath(GraphicsContext* context, unsigned short resourceMode, const Path& path) 430 void SVGRenderSupport::fillOrStrokePath(GraphicsContext* context, unsigned short resourceMode, const Path& path)
398 { 431 {
399 if (resourceMode & ApplyToFillMode) 432 if (resourceMode & ApplyToFillMode)
400 context->fillPath(path); 433 context->fillPath(path);
401 if (resourceMode & ApplyToStrokeMode) 434 if (resourceMode & ApplyToStrokeMode)
402 context->strokePath(path); 435 context->strokePath(path);
403 } 436 }
404 437
405 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) 438 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object)
406 { 439 {
407 ASSERT(object->isText()); 440 ASSERT(object->isText());
408 // <br> is marked as text, but is not handled by the SVG rendering code-path . 441 // <br> is marked as text, but is not handled by the SVG rendering code-path .
409 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text(); 442 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text();
410 } 443 }
411 444
412 } 445 }
OLDNEW
« Source/core/rendering/svg/RenderSVGResource.h ('K') | « Source/core/rendering/svg/SVGRenderSupport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698