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

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: Address reviewer comments 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, const RenderStyle& style, RenderObject& renderer , RenderSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ erTransform) 402 bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, const RenderStyle& style, RenderObject& renderer , RenderSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ erTransform)
403 { 403 {
404 ASSERT(paintInfo.context == stateSaver.context()); 404 ASSERT(paintInfo.context == stateSaver.context());
405 405
406 GraphicsContext* context = paintInfo.context; 406 GraphicsContext* context = paintInfo.context;
407 if (paintInfo.isRenderingClipPathAsMaskImage()) { 407 if (paintInfo.isRenderingClipPathAsMaskImage()) {
408 if (resourceMode == ApplyToStrokeMode) 408 if (resourceMode == ApplyToStrokeMode)
409 return false; 409 return false;
410 context->setAlphaAsFloat(1);
411 context->setFillColor(SVGRenderStyle::initialFillPaintColor()); 410 context->setFillColor(SVGRenderStyle::initialFillPaintColor());
412 return true; 411 return true;
413 } 412 }
414 413
415 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st yle, resourceMode); 414 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st yle, resourceMode);
416 if (!paintServer.isValid()) 415 if (!paintServer.isValid())
417 return false; 416 return false;
418 417
419 if (additionalPaintServerTransform && paintServer.isTransformDependent()) 418 if (additionalPaintServerTransform && paintServer.isTransformDependent())
420 paintServer.prependTransform(*additionalPaintServerTransform); 419 paintServer.prependTransform(*additionalPaintServerTransform);
421 420
422 paintServer.apply(*context, resourceMode, &stateSaver); 421 const SVGRenderStyle& svgStyle = style.svgStyle();
422 float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity() : svgStyle.strokeOpacity();
423 paintServer.apply(*context, resourceMode, paintAlpha, stateSaver);
423 424
424 const SVGRenderStyle& svgStyle = style.svgStyle(); 425 if (resourceMode == ApplyToFillMode)
426 context->setFillRule(svgStyle.fillRule());
427 else
428 applyStrokeStyleToContext(context, style, &renderer);
425 429
426 if (resourceMode == ApplyToFillMode) {
427 context->setAlphaAsFloat(svgStyle.fillOpacity());
428 context->setFillRule(svgStyle.fillRule());
429 } else {
430 context->setAlphaAsFloat(svgStyle.strokeOpacity());
431 applyStrokeStyleToContext(context, style, &renderer);
432 }
433 return true; 430 return true;
434 } 431 }
435 432
436 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) 433 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object)
437 { 434 {
438 ASSERT(object->isText()); 435 ASSERT(object->isText());
439 // <br> is marked as text, but is not handled by the SVG rendering code-path . 436 // <br> is marked as text, but is not handled by the SVG rendering code-path .
440 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text(); 437 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty Text();
441 } 438 }
442 439
(...skipping 14 matching lines...) Expand all
457 return false; 454 return false;
458 return willIsolateBlendingDescendantsForStyle(object->style()); 455 return willIsolateBlendingDescendantsForStyle(object->style());
459 } 456 }
460 457
461 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) 458 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object)
462 { 459 {
463 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants(); 460 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol atedBlendingDescendants();
464 } 461 }
465 462
466 } 463 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourcePaintServer.cpp ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698