OLD | NEW |
---|---|
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 Loading... | |
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) { |
pdr.
2013/07/18 22:24:47
What happens if we have blending + shadow or blend
| |
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 } |
121 } | 129 } |
122 | 130 |
123 ClipPathOperation* clipPathOperation = style->clipPath(); | 131 ClipPathOperation* clipPathOperation = style->clipPath(); |
124 if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOp eration::SHAPE) { | 132 if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOp eration::SHAPE) { |
125 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>( clipPathOperation); | 133 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>( clipPathOperation); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 } |
OLD | NEW |