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

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

Issue 900463002: Make SVG painting independent of GraphicsContext's alpha state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 /* 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, RenderStyle* style, RenderObject& renderer, Rend erSVGResourceMode resourceMode, const AffineTransform* additionalPaintServerTran sform) 403 bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, RenderStyle* style, RenderObject& renderer, Rend erSVGResourceMode resourceMode, const AffineTransform* additionalPaintServerTran sform)
404 { 404 {
405 ASSERT(style); 405 ASSERT(style);
406 ASSERT(paintInfo.context == stateSaver.context()); 406 ASSERT(paintInfo.context == stateSaver.context());
407 407
408 GraphicsContext* context = paintInfo.context; 408 GraphicsContext* context = paintInfo.context;
409 if (paintInfo.isRenderingClipPathAsMaskImage()) { 409 if (paintInfo.isRenderingClipPathAsMaskImage()) {
410 if (resourceMode == ApplyToStrokeMode) 410 if (resourceMode == ApplyToStrokeMode)
411 return false; 411 return false;
412 context->setAlphaAsFloat(1);
413 context->setFillColor(SVGRenderStyle::initialFillPaintColor()); 412 context->setFillColor(SVGRenderStyle::initialFillPaintColor());
414 return true; 413 return true;
415 } 414 }
416 415
417 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st yle, resourceMode); 416 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st yle, resourceMode);
418 if (!paintServer.isValid()) 417 if (!paintServer.isValid())
419 return false; 418 return false;
420 419
421 if (additionalPaintServerTransform && paintServer.isTransformDependent()) 420 if (additionalPaintServerTransform && paintServer.isTransformDependent())
422 paintServer.prependTransform(*additionalPaintServerTransform); 421 paintServer.prependTransform(*additionalPaintServerTransform);
423 422
424 paintServer.apply(*context, resourceMode, &stateSaver); 423 const SVGRenderStyle& svgStyle = style->svgStyle();
424 paintServer.apply(*context, resourceMode, svgStyle, stateSaver);
425 425
426 const SVGRenderStyle& svgStyle = style->svgStyle(); 426 if (resourceMode == ApplyToFillMode)
427 context->setFillRule(svgStyle.fillRule());
428 else
429 applyStrokeStyleToContext(context, style, &renderer);
427 430
428 if (resourceMode == ApplyToFillMode) {
429 context->setAlphaAsFloat(svgStyle.fillOpacity());
430 context->setFillRule(svgStyle.fillRule());
431 } else {
432 context->setAlphaAsFloat(svgStyle.strokeOpacity());
433 applyStrokeStyleToContext(context, style, &renderer);
434 }
435 return true; 431 return true;
436 } 432 }
437 433
438 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) 434 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object)
439 { 435 {
440 ASSERT(object->isText()); 436 ASSERT(object->isText());
441 // <br> is marked as text, but is not handled by the SVG rendering code-path . 437 // <br> is marked as text, but is not handled by the SVG rendering code-path .
442 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text(); 438 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text();
443 } 439 }
444 440
(...skipping 14 matching lines...) Expand all
459 return false; 455 return false;
460 return willIsolateBlendingDescendantsForStyle(object->style()); 456 return willIsolateBlendingDescendantsForStyle(object->style());
461 } 457 }
462 458
463 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) 459 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object)
464 { 460 {
465 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants(); 461 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants();
466 } 462 }
467 463
468 } 464 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698