| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 DEFINE_TRACE(FilterEffectBuilder) | 68 DEFINE_TRACE(FilterEffectBuilder) |
| 69 { | 69 { |
| 70 visitor->trace(m_lastEffect); | 70 visitor->trace(m_lastEffect); |
| 71 visitor->trace(m_referenceFilters); | 71 visitor->trace(m_referenceFilters); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat
ions, float zoom) | 74 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat
ions, float zoom) |
| 75 { | 75 { |
| 76 // 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. | 76 // 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. |
| 77 RefPtrWillBeRawPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1
.0f); | 77 RefPtrWillBeRawPtr<Filter> parentFilter = Filter::create(1.0f); |
| 78 RefPtrWillBeRawPtr<FilterEffect> previousEffect = SourceGraphic::create(pare
ntFilter.get()); | 78 RefPtrWillBeRawPtr<FilterEffect> previousEffect = parentFilter->sourceGraphi
c(); |
| 79 for (size_t i = 0; i < operations.operations().size(); ++i) { | 79 for (size_t i = 0; i < operations.operations().size(); ++i) { |
| 80 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; | 80 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; |
| 81 FilterOperation* filterOperation = operations.operations().at(i).get(); | 81 FilterOperation* filterOperation = operations.operations().at(i).get(); |
| 82 switch (filterOperation->type()) { | 82 switch (filterOperation->type()) { |
| 83 case FilterOperation::REFERENCE: { | 83 case FilterOperation::REFERENCE: { |
| 84 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
rBuilder::build(zoom, element, previousEffect.get(), toReferenceFilterOperation(
*filterOperation)); | 84 RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder:
:build(zoom, element, previousEffect.get(), toReferenceFilterOperation(*filterOp
eration)); |
| 85 if (referenceFilter) { | 85 if (referenceFilter) { |
| 86 effect = referenceFilter->lastEffect(); | 86 effect = referenceFilter->lastEffect(); |
| 87 m_referenceFilters.append(referenceFilter); | 87 m_referenceFilters.append(referenceFilter); |
| 88 } | 88 } |
| 89 break; | 89 break; |
| 90 } | 90 } |
| 91 case FilterOperation::GRAYSCALE: { | 91 case FilterOperation::GRAYSCALE: { |
| 92 Vector<float> inputParameters; | 92 Vector<float> inputParameters; |
| 93 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); | 93 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); |
| 94 | 94 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 // If we didn't make any effects, tell our caller we are not valid | 237 // If we didn't make any effects, tell our caller we are not valid |
| 238 if (!m_lastEffect.get()) | 238 if (!m_lastEffect.get()) |
| 239 return false; | 239 return false; |
| 240 | 240 |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| 245 | 245 |
| OLD | NEW |