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) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * Copyright (C) 2013 Google Inc. All rights reserved. | 7 * Copyright (C) 2013 Google Inc. 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 bool FEComposite::setK4(float k4) | 108 bool FEComposite::setK4(float k4) |
109 { | 109 { |
110 if (m_k4 == k4) | 110 if (m_k4 == k4) |
111 return false; | 111 return false; |
112 m_k4 = k4; | 112 m_k4 = k4; |
113 return true; | 113 return true; |
114 } | 114 } |
115 | 115 |
116 FloatRect FEComposite::determineAbsolutePaintRect(const FloatRect& originalReque
stedRect) | 116 FloatRect FEComposite::determineAbsolutePaintRect(const FloatRect& originalReque
stedRect) const |
117 { | 117 { |
118 FloatRect requestedRect = originalRequestedRect; | 118 FloatRect requestedRect = originalRequestedRect; |
119 if (clipsToBounds()) | 119 if (clipsToBounds()) |
120 requestedRect.intersect(absoluteBounds()); | 120 requestedRect.intersect(absoluteBounds()); |
121 | 121 |
122 // We may be called multiple times if result is used more than once. Return | |
123 // quickly if nothing new is required. | |
124 if (absolutePaintRect().contains(enclosingIntRect(requestedRect))) | |
125 return requestedRect; | |
126 | |
127 // No mapPaintRect required for FEComposite. | 122 // No mapPaintRect required for FEComposite. |
128 FloatRect input1Rect = inputEffect(1)->determineAbsolutePaintRect(requestedR
ect); | 123 FloatRect input1Rect = inputEffect(1)->determineAbsolutePaintRect(requestedR
ect); |
129 FloatRect affectedRect; | 124 FloatRect affectedRect; |
130 switch (m_type) { | 125 switch (m_type) { |
131 case FECOMPOSITE_OPERATOR_IN: | 126 case FECOMPOSITE_OPERATOR_IN: |
132 // 'in' has output only in the intersection of both inputs. | 127 // 'in' has output only in the intersection of both inputs. |
133 affectedRect = intersection(input1Rect, inputEffect(0)->determineAbsolut
ePaintRect(input1Rect)); | 128 affectedRect = intersection(input1Rect, inputEffect(0)->determineAbsolut
ePaintRect(input1Rect)); |
134 break; | 129 break; |
135 case FECOMPOSITE_OPERATOR_ATOP: | 130 case FECOMPOSITE_OPERATOR_ATOP: |
136 // 'atop' has output only in the extents of the second input. | 131 // 'atop' has output only in the extents of the second input. |
(...skipping 22 matching lines...) Expand all Loading... |
159 break; | 154 break; |
160 } | 155 } |
161 // else fall through to use union | 156 // else fall through to use union |
162 default: | 157 default: |
163 // Take the union of both input effects. | 158 // Take the union of both input effects. |
164 affectedRect = unionRect(input1Rect, inputEffect(0)->determineAbsolutePa
intRect(requestedRect)); | 159 affectedRect = unionRect(input1Rect, inputEffect(0)->determineAbsolutePa
intRect(requestedRect)); |
165 break; | 160 break; |
166 } | 161 } |
167 | 162 |
168 affectedRect.intersect(requestedRect); | 163 affectedRect.intersect(requestedRect); |
169 addAbsolutePaintRect(affectedRect); | |
170 return affectedRect; | 164 return affectedRect; |
171 } | 165 } |
172 | 166 |
173 SkXfermode::Mode toXfermode(CompositeOperationType mode) | 167 SkXfermode::Mode toXfermode(CompositeOperationType mode) |
174 { | 168 { |
175 switch (mode) { | 169 switch (mode) { |
176 case FECOMPOSITE_OPERATOR_OVER: | 170 case FECOMPOSITE_OPERATOR_OVER: |
177 return SkXfermode::kSrcOver_Mode; | 171 return SkXfermode::kSrcOver_Mode; |
178 case FECOMPOSITE_OPERATOR_IN: | 172 case FECOMPOSITE_OPERATOR_IN: |
179 return SkXfermode::kSrcIn_Mode; | 173 return SkXfermode::kSrcIn_Mode; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ts << " operation=\"" << m_type << "\""; | 247 ts << " operation=\"" << m_type << "\""; |
254 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) | 248 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) |
255 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\
" k4=\"" << m_k4 << "\""; | 249 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\
" k4=\"" << m_k4 << "\""; |
256 ts << "]\n"; | 250 ts << "]\n"; |
257 inputEffect(0)->externalRepresentation(ts, indent + 1); | 251 inputEffect(0)->externalRepresentation(ts, indent + 1); |
258 inputEffect(1)->externalRepresentation(ts, indent + 1); | 252 inputEffect(1)->externalRepresentation(ts, indent + 1); |
259 return ts; | 253 return ts; |
260 } | 254 } |
261 | 255 |
262 } // namespace blink | 256 } // namespace blink |
OLD | NEW |