Chromium Code Reviews| 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) const | 116 bool FEComposite::affectsTransparentPixels() const |
| 117 { | 117 { |
| 118 FloatRect requestedRect = originalRequestedRect; | 118 return k4() > 0; |
|
pdr.
2016/09/16 18:29:18
Can you add a comment explaining this line?
There
fs
2016/09/16 18:53:28
Sure.
fs
2016/09/16 20:16:21
Noticed that I should probably have checked m_type
| |
| 119 if (clipsToBounds()) | 119 } |
| 120 requestedRect.intersect(absoluteBounds()); | |
| 121 | 120 |
| 122 // No mapPaintRect required for FEComposite. | 121 FloatRect FEComposite::mapInputs(const FloatRect& rect) const |
| 123 FloatRect input1Rect = inputEffect(1)->determineAbsolutePaintRect(requestedR ect); | 122 { |
| 124 FloatRect affectedRect; | 123 FloatRect input1Rect = inputEffect(1)->mapRect(rect); |
| 125 switch (m_type) { | 124 switch (m_type) { |
| 126 case FECOMPOSITE_OPERATOR_IN: | 125 case FECOMPOSITE_OPERATOR_IN: |
| 127 // 'in' has output only in the intersection of both inputs. | 126 // 'in' has output only in the intersection of both inputs. |
| 128 affectedRect = intersection(input1Rect, inputEffect(0)->determineAbsolut ePaintRect(input1Rect)); | 127 return intersection(input1Rect, inputEffect(0)->mapRect(input1Rect)); |
| 129 break; | |
| 130 case FECOMPOSITE_OPERATOR_ATOP: | 128 case FECOMPOSITE_OPERATOR_ATOP: |
| 131 // 'atop' has output only in the extents of the second input. | 129 // 'atop' has output only in the extents of the second input. |
| 132 // Make sure first input knows where it needs to produce output. | 130 return input1Rect; |
| 133 inputEffect(0)->determineAbsolutePaintRect(input1Rect); | |
| 134 affectedRect = input1Rect; | |
| 135 break; | |
| 136 case FECOMPOSITE_OPERATOR_ARITHMETIC: | 131 case FECOMPOSITE_OPERATOR_ARITHMETIC: |
| 137 if (k4() > 0) { | 132 // Arithmetic with non-zero k4 may influnce the complete filter primitiv e |
|
pdr.
2016/09/16 18:29:18
Nit: "influence"
If possible, can you add comment
fs
2016/09/16 18:53:28
I'll see if can express this in a not too verbose
fs
2016/09/16 20:16:21
Comments added.
| |
| 138 // Make sure first input knows where it needs to produce output. | 133 // region. |
| 139 inputEffect(0)->determineAbsolutePaintRect(requestedRect); | 134 if (k4() > 0) |
| 140 // Arithmetic with non-zero k4 may influnce the complete filter prim itive | 135 return rect; |
| 141 // region. So we can't optimize the paint region here. | |
| 142 affectedRect = requestedRect; | |
| 143 break; | |
| 144 } | |
| 145 if (k2() <= 0) { | 136 if (k2() <= 0) { |
| 146 // Input 0 does not appear where input 1 is not present. | 137 // Input 0 does not appear where input 1 is not present. |
| 147 FloatRect input0Rect = inputEffect(0)->determineAbsolutePaintRect(in put1Rect); | 138 if (k3() > 0) |
| 148 if (k3() > 0) { | 139 return input1Rect; |
| 149 affectedRect = input1Rect; | 140 // Just k1 is positive. Use intersection. |
| 150 } else { | 141 return intersection(input1Rect, inputEffect(0)->mapRect(input1Rect)) ; |
| 151 // Just k1 is positive. Use intersection. | |
| 152 affectedRect = intersection(input1Rect, input0Rect); | |
| 153 } | |
| 154 break; | |
| 155 } | 142 } |
| 156 // else fall through to use union | 143 // else fall through to use union |
| 157 default: | 144 default: |
| 158 // Take the union of both input effects. | |
| 159 affectedRect = unionRect(input1Rect, inputEffect(0)->determineAbsolutePa intRect(requestedRect)); | |
| 160 break; | 145 break; |
| 161 } | 146 } |
| 162 | 147 // Take the union of both input effects. |
| 163 affectedRect.intersect(requestedRect); | 148 return unionRect(input1Rect, inputEffect(0)->mapRect(rect)); |
| 164 return affectedRect; | |
| 165 } | 149 } |
| 166 | 150 |
| 167 SkXfermode::Mode toXfermode(CompositeOperationType mode) | 151 SkXfermode::Mode toXfermode(CompositeOperationType mode) |
| 168 { | 152 { |
| 169 switch (mode) { | 153 switch (mode) { |
| 170 case FECOMPOSITE_OPERATOR_OVER: | 154 case FECOMPOSITE_OPERATOR_OVER: |
| 171 return SkXfermode::kSrcOver_Mode; | 155 return SkXfermode::kSrcOver_Mode; |
| 172 case FECOMPOSITE_OPERATOR_IN: | 156 case FECOMPOSITE_OPERATOR_IN: |
| 173 return SkXfermode::kSrcIn_Mode; | 157 return SkXfermode::kSrcIn_Mode; |
| 174 case FECOMPOSITE_OPERATOR_OUT: | 158 case FECOMPOSITE_OPERATOR_OUT: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 ts << " operation=\"" << m_type << "\""; | 231 ts << " operation=\"" << m_type << "\""; |
| 248 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) | 232 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) |
| 249 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\ " k4=\"" << m_k4 << "\""; | 233 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\ " k4=\"" << m_k4 << "\""; |
| 250 ts << "]\n"; | 234 ts << "]\n"; |
| 251 inputEffect(0)->externalRepresentation(ts, indent + 1); | 235 inputEffect(0)->externalRepresentation(ts, indent + 1); |
| 252 inputEffect(1)->externalRepresentation(ts, indent + 1); | 236 inputEffect(1)->externalRepresentation(ts, indent + 1); |
| 253 return ts; | 237 return ts; |
| 254 } | 238 } |
| 255 | 239 |
| 256 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |