| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 FilterTypeSaturate, | 42 FilterTypeSaturate, |
| 43 FilterTypeHueRotate, | 43 FilterTypeHueRotate, |
| 44 FilterTypeInvert, | 44 FilterTypeInvert, |
| 45 FilterTypeBrightness, | 45 FilterTypeBrightness, |
| 46 FilterTypeContrast, | 46 FilterTypeContrast, |
| 47 FilterTypeOpacity, | 47 FilterTypeOpacity, |
| 48 FilterTypeBlur, | 48 FilterTypeBlur, |
| 49 FilterTypeDropShadow, | 49 FilterTypeDropShadow, |
| 50 FilterTypeColorMatrix, | 50 FilterTypeColorMatrix, |
| 51 FilterTypeZoom, | 51 FilterTypeZoom, |
| 52 FilterTypeSaturatingBrightness, // Not used in CSS/SVG. |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 FilterType type() const { return m_type; } | 55 FilterType type() const { return m_type; } |
| 55 | 56 |
| 56 float amount() const | 57 float amount() const |
| 57 { | 58 { |
| 58 WEBKIT_ASSERT(m_type == FilterTypeGrayscale | 59 WEBKIT_ASSERT(m_type == FilterTypeGrayscale |
| 59 || m_type == FilterTypeSepia | 60 || m_type == FilterTypeSepia |
| 60 || m_type == FilterTypeSaturate | 61 || m_type == FilterTypeSaturate |
| 61 || m_type == FilterTypeHueRotate | 62 || m_type == FilterTypeHueRotate |
| 62 || m_type == FilterTypeInvert | 63 || m_type == FilterTypeInvert |
| 63 || m_type == FilterTypeBrightness | 64 || m_type == FilterTypeBrightness |
| 64 || m_type == FilterTypeContrast | 65 || m_type == FilterTypeContrast |
| 65 || m_type == FilterTypeOpacity | 66 || m_type == FilterTypeOpacity |
| 66 || m_type == FilterTypeBlur | 67 || m_type == FilterTypeBlur |
| 67 || m_type == FilterTypeDropShadow | 68 || m_type == FilterTypeDropShadow |
| 68 || m_type == FilterTypeZoom); | 69 || m_type == FilterTypeZoom |
| 70 || m_type == FilterTypeSaturatingBrightness); |
| 69 return m_amount; | 71 return m_amount; |
| 70 } | 72 } |
| 71 WebPoint dropShadowOffset() const | 73 WebPoint dropShadowOffset() const |
| 72 { | 74 { |
| 73 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); | 75 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); |
| 74 return m_dropShadowOffset; | 76 return m_dropShadowOffset; |
| 75 } | 77 } |
| 76 WebColor dropShadowColor() const | 78 WebColor dropShadowColor() const |
| 77 { | 79 { |
| 78 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); | 80 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 static WebFilterOperation createSaturateFilter(float amount) { return WebFil
terOperation(FilterTypeSaturate, amount); } | 97 static WebFilterOperation createSaturateFilter(float amount) { return WebFil
terOperation(FilterTypeSaturate, amount); } |
| 96 static WebFilterOperation createHueRotateFilter(float amount) { return WebFi
lterOperation(FilterTypeHueRotate, amount); } | 98 static WebFilterOperation createHueRotateFilter(float amount) { return WebFi
lterOperation(FilterTypeHueRotate, amount); } |
| 97 static WebFilterOperation createInvertFilter(float amount) { return WebFilte
rOperation(FilterTypeInvert, amount); } | 99 static WebFilterOperation createInvertFilter(float amount) { return WebFilte
rOperation(FilterTypeInvert, amount); } |
| 98 static WebFilterOperation createBrightnessFilter(float amount) { return WebF
ilterOperation(FilterTypeBrightness, amount); } | 100 static WebFilterOperation createBrightnessFilter(float amount) { return WebF
ilterOperation(FilterTypeBrightness, amount); } |
| 99 static WebFilterOperation createContrastFilter(float amount) { return WebFil
terOperation(FilterTypeContrast, amount); } | 101 static WebFilterOperation createContrastFilter(float amount) { return WebFil
terOperation(FilterTypeContrast, amount); } |
| 100 static WebFilterOperation createOpacityFilter(float amount) { return WebFilt
erOperation(FilterTypeOpacity, amount); } | 102 static WebFilterOperation createOpacityFilter(float amount) { return WebFilt
erOperation(FilterTypeOpacity, amount); } |
| 101 static WebFilterOperation createBlurFilter(float amount) { return WebFilterO
peration(FilterTypeBlur, amount); } | 103 static WebFilterOperation createBlurFilter(float amount) { return WebFilterO
peration(FilterTypeBlur, amount); } |
| 102 static WebFilterOperation createDropShadowFilter(WebPoint offset, float stdD
eviation, WebColor color) { return WebFilterOperation(FilterTypeDropShadow, offs
et, stdDeviation, color); } | 104 static WebFilterOperation createDropShadowFilter(WebPoint offset, float stdD
eviation, WebColor color) { return WebFilterOperation(FilterTypeDropShadow, offs
et, stdDeviation, color); } |
| 103 static WebFilterOperation createColorMatrixFilter(SkScalar matrix[20]) { ret
urn WebFilterOperation(FilterTypeColorMatrix, matrix); } | 105 static WebFilterOperation createColorMatrixFilter(SkScalar matrix[20]) { ret
urn WebFilterOperation(FilterTypeColorMatrix, matrix); } |
| 104 static WebFilterOperation createZoomFilter(WebRect rect, int inset) { return
WebFilterOperation(FilterTypeZoom, rect, inset); } | 106 static WebFilterOperation createZoomFilter(WebRect rect, int inset) { return
WebFilterOperation(FilterTypeZoom, rect, inset); } |
| 107 static WebFilterOperation createSaturatingBrightnessFilter(float amount) { r
eturn WebFilterOperation(FilterTypeSaturatingBrightness, amount); } |
| 105 | 108 |
| 106 bool equals(const WebFilterOperation& other) const; | 109 bool equals(const WebFilterOperation& other) const; |
| 107 | 110 |
| 108 // Methods for restoring a WebFilterOperation. | 111 // Methods for restoring a WebFilterOperation. |
| 109 static WebFilterOperation createEmptyFilter() { return WebFilterOperation(Fi
lterTypeGrayscale, 0.0); } | 112 static WebFilterOperation createEmptyFilter() { return WebFilterOperation(Fi
lterTypeGrayscale, 0.0); } |
| 110 void setType(FilterType type) { m_type = type; } | 113 void setType(FilterType type) { m_type = type; } |
| 111 void setAmount(float amount) | 114 void setAmount(float amount) |
| 112 { | 115 { |
| 113 WEBKIT_ASSERT(m_type == FilterTypeGrayscale | 116 WEBKIT_ASSERT(m_type == FilterTypeGrayscale |
| 114 || m_type == FilterTypeSepia | 117 || m_type == FilterTypeSepia |
| 115 || m_type == FilterTypeSaturate | 118 || m_type == FilterTypeSaturate |
| 116 || m_type == FilterTypeHueRotate | 119 || m_type == FilterTypeHueRotate |
| 117 || m_type == FilterTypeInvert | 120 || m_type == FilterTypeInvert |
| 118 || m_type == FilterTypeBrightness | 121 || m_type == FilterTypeBrightness |
| 119 || m_type == FilterTypeContrast | 122 || m_type == FilterTypeContrast |
| 120 || m_type == FilterTypeOpacity | 123 || m_type == FilterTypeOpacity |
| 121 || m_type == FilterTypeBlur | 124 || m_type == FilterTypeBlur |
| 122 || m_type == FilterTypeDropShadow | 125 || m_type == FilterTypeDropShadow |
| 123 || m_type == FilterTypeZoom); | 126 || m_type == FilterTypeZoom |
| 127 || m_type == FilterTypeSaturatingBrightness); |
| 124 m_amount = amount; | 128 m_amount = amount; |
| 125 } | 129 } |
| 126 void setDropShadowOffset(WebPoint offset) | 130 void setDropShadowOffset(WebPoint offset) |
| 127 { | 131 { |
| 128 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); | 132 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); |
| 129 m_dropShadowOffset = offset; | 133 m_dropShadowOffset = offset; |
| 130 } | 134 } |
| 131 void setDropShadowColor(WebColor color) | 135 void setDropShadowColor(WebColor color) |
| 132 { | 136 { |
| 133 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); | 137 WEBKIT_ASSERT(m_type == FilterTypeDropShadow); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 192 } |
| 189 | 193 |
| 190 inline bool operator!=(const WebFilterOperation& a, const WebFilterOperation& b) | 194 inline bool operator!=(const WebFilterOperation& a, const WebFilterOperation& b) |
| 191 { | 195 { |
| 192 return !(a == b); | 196 return !(a == b); |
| 193 } | 197 } |
| 194 | 198 |
| 195 } | 199 } |
| 196 | 200 |
| 197 #endif | 201 #endif |
| OLD | NEW |