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

Side by Side Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 17390003: CSS Background Blending doesn't work for svg layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « LayoutTests/platform/chromium-mac/css3/compositing/background-blend-mode-svg-color-expected.txt ('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) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zo omedContainerRect, CompositeSourceOver, BlendModeNormal); 183 drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zo omedContainerRect, CompositeSourceOver, BlendModeNormal);
184 RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore, Unscaled); 184 RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore, Unscaled);
185 185
186 // Adjust the source rect and transform due to the image buffer's scaling. 186 // Adjust the source rect and transform due to the image buffer's scaling.
187 FloatRect scaledSrcRect = srcRect; 187 FloatRect scaledSrcRect = srcRect;
188 scaledSrcRect.scale(imageBufferScale.width(), imageBufferScale.height()); 188 scaledSrcRect.scale(imageBufferScale.width(), imageBufferScale.height());
189 189
190 image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, composite Op, dstRect); 190 image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, composite Op, dstRect);
191 } 191 }
192 192
193 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl oatRect& srcRect, CompositeOperator compositeOp, BlendMode) 193 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl oatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode)
194 { 194 {
195 if (!m_page) 195 if (!m_page)
196 return; 196 return;
197 197
198 FrameView* view = frameView(); 198 FrameView* view = frameView();
199 199
200 GraphicsContextStateSaver stateSaver(*context); 200 GraphicsContextStateSaver stateSaver(*context);
201 context->setCompositeOperation(compositeOp); 201 context->setCompositeOperation(compositeOp, blendMode);
202 context->clip(enclosingIntRect(dstRect)); 202 context->clip(enclosingIntRect(dstRect));
203 if (compositeOp != CompositeSourceOver) 203 if (compositeOp != CompositeSourceOver)
204 context->beginTransparencyLayer(1); 204 context->beginTransparencyLayer(1);
205 205
206 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRec t.height()); 206 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRec t.height());
207 207
208 // We can only draw the entire frame, clipped to the rect we want. So comput e where the top left 208 // We can only draw the entire frame, clipped to the rect we want. So comput e where the top left
209 // of the image would be if we were drawing without clipping, and translate accordingly. 209 // of the image would be if we were drawing without clipping, and translate accordingly.
210 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.loca tion().y() * scale.height()); 210 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.loca tion().y() * scale.height());
211 FloatPoint destOffset = dstRect.location() - topLeftOffset; 211 FloatPoint destOffset = dstRect.location() - topLeftOffset;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void SVGImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 374 void SVGImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
375 { 375 {
376 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceImage); 376 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceImage);
377 Image::reportMemoryUsage(memoryObjectInfo); 377 Image::reportMemoryUsage(memoryObjectInfo);
378 info.addMember(m_chromeClient, "chromeClient"); 378 info.addMember(m_chromeClient, "chromeClient");
379 info.addMember(m_page, "page"); 379 info.addMember(m_page, "page");
380 } 380 }
381 381
382 } 382 }
383 383
OLDNEW
« no previous file with comments | « LayoutTests/platform/chromium-mac/css3/compositing/background-blend-mode-svg-color-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698