OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // Create a parent filter for shorthand filters. These have already been sca
led by the CSS code for page zoom, so scale is 1.0 here. | 79 // Create a parent filter for shorthand filters. These have already been sca
led by the CSS code for page zoom, so scale is 1.0 here. |
80 RefPtrWillBeRawPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1
.0f); | 80 RefPtrWillBeRawPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1
.0f); |
81 RefPtrWillBeRawPtr<FilterEffect> previousEffect = SourceGraphic::create(pare
ntFilter.get()); | 81 RefPtrWillBeRawPtr<FilterEffect> previousEffect = SourceGraphic::create(pare
ntFilter.get()); |
82 for (size_t i = 0; i < operations.operations().size(); ++i) { | 82 for (size_t i = 0; i < operations.operations().size(); ++i) { |
83 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; | 83 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; |
84 FilterOperation* filterOperation = operations.operations().at(i).get(); | 84 FilterOperation* filterOperation = operations.operations().at(i).get(); |
85 switch (filterOperation->type()) { | 85 switch (filterOperation->type()) { |
86 case FilterOperation::REFERENCE: { | 86 case FilterOperation::REFERENCE: { |
87 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
r::create(zoom); | 87 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
r::create(zoom); |
88 effect = ReferenceFilterBuilder::build(referenceFilter.get(), render
er, previousEffect.get(), toReferenceFilterOperation(filterOperation)); | 88 effect = ReferenceFilterBuilder::build(referenceFilter.get(), *rende
rer, previousEffect.get(), toReferenceFilterOperation(*filterOperation)); |
89 referenceFilter->setLastEffect(effect); | 89 referenceFilter->setLastEffect(effect); |
90 m_referenceFilters.append(referenceFilter); | 90 m_referenceFilters.append(referenceFilter); |
91 break; | 91 break; |
92 } | 92 } |
93 case FilterOperation::GRAYSCALE: { | 93 case FilterOperation::GRAYSCALE: { |
94 Vector<float> inputParameters; | 94 Vector<float> inputParameters; |
95 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); | 95 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); |
96 | 96 |
97 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g
rayscaleEquivalent | 97 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g
rayscaleEquivalent |
98 // for information on parameters. | 98 // for information on parameters. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 // If we didn't make any effects, tell our caller we are not valid | 239 // If we didn't make any effects, tell our caller we are not valid |
240 if (!m_lastEffect.get()) | 240 if (!m_lastEffect.get()) |
241 return false; | 241 return false; |
242 | 242 |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 } // namespace blink | 246 } // namespace blink |
247 | 247 |
OLD | NEW |