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

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

Issue 17115010: Add support for element blending to SVG (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added test files for webkit-svg-shadow Created 7 years, 5 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
« no previous file with comments | « LayoutTests/css3/compositing/svg-blend-soft-light-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 RenderStyle* style = m_object->style(); 96 RenderStyle* style = m_object->style();
97 ASSERT(style); 97 ASSERT(style);
98 98
99 const SVGRenderStyle* svgStyle = style->svgStyle(); 99 const SVGRenderStyle* svgStyle = style->svgStyle();
100 ASSERT(svgStyle); 100 ASSERT(svgStyle);
101 101
102 // Setup transparency layers before setting up SVG resources! 102 // Setup transparency layers before setting up SVG resources!
103 bool isRenderingMask = isRenderingMaskImage(m_object); 103 bool isRenderingMask = isRenderingMaskImage(m_object);
104 float opacity = isRenderingMask ? 1 : style->opacity(); 104 float opacity = isRenderingMask ? 1 : style->opacity();
105 BlendMode blendMode = isRenderingMask ? BlendModeNormal : style->blendMode() ;
105 const ShadowData* shadow = svgStyle->shadow(); 106 const ShadowData* shadow = svgStyle->shadow();
106 if (opacity < 1 || shadow) { 107 if (opacity < 1 || shadow || blendMode != BlendModeNormal) {
107 FloatRect repaintRect = m_object->repaintRectInLocalCoordinates(); 108 FloatRect repaintRect = m_object->repaintRectInLocalCoordinates();
108 109
109 if (opacity < 1) { 110 if (opacity < 1 || blendMode != BlendModeNormal) {
110 m_paintInfo->context->clip(repaintRect); 111 m_paintInfo->context->clip(repaintRect);
112 if (blendMode != BlendModeNormal) {
113 if (!(m_renderingFlags & RestoreGraphicsContext)) {
114 m_paintInfo->context->save();
115 m_renderingFlags |= RestoreGraphicsContext;
116 }
117 m_paintInfo->context->setCompositeOperation(CompositeSourceOver, blendMode);
118 }
111 m_paintInfo->context->beginTransparencyLayer(opacity); 119 m_paintInfo->context->beginTransparencyLayer(opacity);
112 m_renderingFlags |= EndOpacityLayer; 120 m_renderingFlags |= EndOpacityLayer;
113 } 121 }
114 122
115 if (shadow) { 123 if (shadow) {
116 m_paintInfo->context->clip(repaintRect); 124 m_paintInfo->context->clip(repaintRect);
117 m_paintInfo->context->setShadow(IntSize(roundToInt(shadow->x()), rou ndToInt(shadow->y())), shadow->blur(), shadow->color()); 125 m_paintInfo->context->setShadow(IntSize(roundToInt(shadow->x()), rou ndToInt(shadow->y())), shadow->blur(), shadow->color());
118 m_paintInfo->context->beginTransparencyLayer(1); 126 m_paintInfo->context->beginTransparencyLayer(1);
119 m_renderingFlags |= EndShadowLayer; 127 m_renderingFlags |= EndShadowLayer;
120 } 128 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 toRenderSVGImage(m_object)->paintForeground(bufferedInfo); 349 toRenderSVGImage(m_object)->paintForeground(bufferedInfo);
342 } else 350 } else
343 return false; 351 return false;
344 } 352 }
345 353
346 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); 354 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox);
347 return true; 355 return true;
348 } 356 }
349 357
350 } 358 }
OLDNEW
« no previous file with comments | « LayoutTests/css3/compositing/svg-blend-soft-light-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698