OLD | NEW |
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 29 matching lines...) Expand all Loading... |
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 { |
48 } | 48 } |
49 | 49 |
50 FEImage::FEImage(Filter* filter, Document* document, const String& href, const S
VGPreserveAspectRatio& preserveAspectRatio) | 50 FEImage::FEImage(Filter* filter, Document& document, const String& href, const S
VGPreserveAspectRatio& preserveAspectRatio) |
51 : FilterEffect(filter) | 51 : FilterEffect(filter) |
52 , m_document(document) | 52 , m_document(&document) |
53 , m_href(href) | 53 , m_href(href) |
54 , m_preserveAspectRatio(preserveAspectRatio) | 54 , m_preserveAspectRatio(preserveAspectRatio) |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 PassRefPtr<FEImage> FEImage::createWithImage(Filter* filter, PassRefPtr<Image> i
mage, const SVGPreserveAspectRatio& preserveAspectRatio) | 58 PassRefPtr<FEImage> FEImage::createWithImage(Filter* filter, PassRefPtr<Image> i
mage, const SVGPreserveAspectRatio& preserveAspectRatio) |
59 { | 59 { |
60 return adoptRef(new FEImage(filter, image, preserveAspectRatio)); | 60 return adoptRef(new FEImage(filter, image, preserveAspectRatio)); |
61 } | 61 } |
62 | 62 |
63 PassRefPtr<FEImage> FEImage::createWithIRIReference(Filter* filter, Document* do
cument, const String& href, const SVGPreserveAspectRatio& preserveAspectRatio) | 63 PassRefPtr<FEImage> FEImage::createWithIRIReference(Filter* filter, Document& do
cument, const String& href, const SVGPreserveAspectRatio& preserveAspectRatio) |
64 { | 64 { |
65 return adoptRef(new FEImage(filter, document, href, preserveAspectRatio)); | 65 return adoptRef(new FEImage(filter, document, href, preserveAspectRatio)); |
66 } | 66 } |
67 | 67 |
68 void FEImage::determineAbsolutePaintRect() | 68 void FEImage::determineAbsolutePaintRect() |
69 { | 69 { |
70 FloatRect paintRect = filter()->absoluteTransform().mapRect(filterPrimitiveS
ubregion()); | 70 FloatRect paintRect = filter()->absoluteTransform().mapRect(filterPrimitiveS
ubregion()); |
71 FloatRect srcRect; | 71 FloatRect srcRect; |
72 if (m_image) { | 72 if (m_image) { |
73 srcRect.setSize(m_image->size()); | 73 srcRect.setSize(m_image->size()); |
74 m_preserveAspectRatio.transformRect(paintRect, srcRect); | 74 m_preserveAspectRatio.transformRect(paintRect, srcRect); |
75 } else if (RenderObject* renderer = referencedRenderer()) | 75 } else if (RenderObject* renderer = referencedRenderer()) |
76 srcRect = filter()->absoluteTransform().mapRect(renderer->repaintRectInL
ocalCoordinates()); | 76 srcRect = filter()->absoluteTransform().mapRect(renderer->repaintRectInL
ocalCoordinates()); |
77 | 77 |
78 if (clipsToBounds()) | 78 if (clipsToBounds()) |
79 paintRect.intersect(maxEffectRect()); | 79 paintRect.intersect(maxEffectRect()); |
80 else | 80 else |
81 paintRect.unite(maxEffectRect()); | 81 paintRect.unite(maxEffectRect()); |
82 setAbsolutePaintRect(enclosingIntRect(paintRect)); | 82 setAbsolutePaintRect(enclosingIntRect(paintRect)); |
83 } | 83 } |
84 | 84 |
85 RenderObject* FEImage::referencedRenderer() const | 85 RenderObject* FEImage::referencedRenderer() const |
86 { | 86 { |
87 if (!m_document) | 87 if (!m_document) |
88 return 0; | 88 return 0; |
89 Element* hrefElement = SVGURIReference::targetElementFromIRIString(m_href, m
_document); | 89 Element* hrefElement = SVGURIReference::targetElementFromIRIString(m_href, *
m_document); |
90 if (!hrefElement || !hrefElement->isSVGElement()) | 90 if (!hrefElement || !hrefElement->isSVGElement()) |
91 return 0; | 91 return 0; |
92 return hrefElement->renderer(); | 92 return hrefElement->renderer(); |
93 } | 93 } |
94 | 94 |
95 void FEImage::applySoftware() | 95 void FEImage::applySoftware() |
96 { | 96 { |
97 RenderObject* renderer = referencedRenderer(); | 97 RenderObject* renderer = referencedRenderer(); |
98 if (!m_image && !renderer) | 98 if (!m_image && !renderer) |
99 return; | 99 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 adoptRef(new SkBitmapSource(m_image->nativeImageForCurrentFrame()->bi
tmap())); | 168 return adoptRef(new SkBitmapSource(m_image->nativeImageForCurrentFrame()->bi
tmap())); |
169 } | 169 } |
170 | 170 |
171 } // namespace WebCore | 171 } // namespace WebCore |
OLD | NEW |