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

Side by Side Diff: Source/core/svg/graphics/filters/SVGFEImage.cpp

Issue 21042009: [SVG2] Merge SVGStyledElement into SVGElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2013 Google Inc. All rights reserved. 6 * Copyright (C) 2013 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 15 matching lines...) Expand all
26 #include "core/svg/graphics/filters/SVGFEImage.h" 26 #include "core/svg/graphics/filters/SVGFEImage.h"
27 27
28 #include "SkBitmapSource.h" 28 #include "SkBitmapSource.h"
29 #include "core/platform/graphics/GraphicsContext.h" 29 #include "core/platform/graphics/GraphicsContext.h"
30 #include "core/platform/graphics/filters/Filter.h" 30 #include "core/platform/graphics/filters/Filter.h"
31 #include "core/platform/graphics/transforms/AffineTransform.h" 31 #include "core/platform/graphics/transforms/AffineTransform.h"
32 #include "core/platform/text/TextStream.h" 32 #include "core/platform/text/TextStream.h"
33 #include "core/rendering/RenderObject.h" 33 #include "core/rendering/RenderObject.h"
34 #include "core/rendering/RenderTreeAsText.h" 34 #include "core/rendering/RenderTreeAsText.h"
35 #include "core/rendering/svg/SVGRenderingContext.h" 35 #include "core/rendering/svg/SVGRenderingContext.h"
36 #include "core/svg/SVGElement.h"
36 #include "core/svg/SVGPreserveAspectRatio.h" 37 #include "core/svg/SVGPreserveAspectRatio.h"
37 #include "core/svg/SVGStyledElement.h"
38 #include "core/svg/SVGURIReference.h" 38 #include "core/svg/SVGURIReference.h"
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 FEImage::FEImage(Filter* filter, PassRefPtr<Image> image, const SVGPreserveAspec tRatio& preserveAspectRatio) 42 FEImage::FEImage(Filter* filter, PassRefPtr<Image> image, const SVGPreserveAspec tRatio& preserveAspectRatio)
43 : FilterEffect(filter) 43 : FilterEffect(filter)
44 , m_image(image) 44 , m_image(image)
45 , m_document(0) 45 , m_document(0)
46 , m_preserveAspectRatio(preserveAspectRatio) 46 , m_preserveAspectRatio(preserveAspectRatio)
47 { 47 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 IntPoint paintLocation = absolutePaintRect().location(); 115 IntPoint paintLocation = absolutePaintRect().location();
116 destRect.move(-paintLocation.x(), -paintLocation.y()); 116 destRect.move(-paintLocation.x(), -paintLocation.y());
117 117
118 // FEImage results are always in ColorSpaceDeviceRGB 118 // FEImage results are always in ColorSpaceDeviceRGB
119 setResultColorSpace(ColorSpaceDeviceRGB); 119 setResultColorSpace(ColorSpaceDeviceRGB);
120 120
121 if (renderer) { 121 if (renderer) {
122 SVGElement* contextNode = toSVGElement(renderer->node()); 122 SVGElement* contextNode = toSVGElement(renderer->node());
123 if (contextNode->isSVGStyledElement() && toSVGStyledElement(contextNode) ->hasRelativeLengths()) { 123 if (contextNode->hasRelativeLengths()) {
124 SVGLengthContext lengthContext(contextNode); 124 SVGLengthContext lengthContext(contextNode);
125 float width = 0; 125 float width = 0;
126 float height = 0; 126 float height = 0;
127 127
128 // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport. 128 // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport.
129 // Build up a transformation that maps from the viewport space to th e filter primitive subregion. 129 // Build up a transformation that maps from the viewport space to th e filter primitive subregion.
130 if (lengthContext.determineViewport(width, height)) 130 if (lengthContext.determineViewport(width, height))
131 resultImage->context()->concatCTM(makeMapBetweenRects(FloatRect( 0, 0, width, height), destRect)); 131 resultImage->context()->concatCTM(makeMapBetweenRects(FloatRect( 0, 0, width, height), destRect));
132 } else { 132 } else {
133 const AffineTransform& absoluteTransform = filter()->absoluteTransfo rm(); 133 const AffineTransform& absoluteTransform = filter()->absoluteTransfo rm();
(...skipping 28 matching lines...) Expand all
162 if (!m_image) 162 if (!m_image)
163 return 0; 163 return 0;
164 164
165 if (!m_image->nativeImageForCurrentFrame()) 165 if (!m_image->nativeImageForCurrentFrame())
166 return 0; 166 return 0;
167 167
168 return new SkBitmapSource(m_image->nativeImageForCurrentFrame()->bitmap()); 168 return new SkBitmapSource(m_image->nativeImageForCurrentFrame()->bitmap());
169 } 169 }
170 170
171 } // namespace WebCore 171 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/svg/SVGViewElement.cpp ('k') | Source/core/svg/properties/SVGAnimatedPropertyMacros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698