| 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 | 68 |
| 69 FilterEffectRenderer::FilterEffectRenderer() | 69 FilterEffectRenderer::FilterEffectRenderer() |
| 70 { | 70 { |
| 71 } | 71 } |
| 72 | 72 |
| 73 FilterEffectRenderer::~FilterEffectRenderer() | 73 FilterEffectRenderer::~FilterEffectRenderer() |
| 74 { | 74 { |
| 75 } | 75 } |
| 76 | 76 |
| 77 void FilterEffectRenderer::trace(Visitor* visitor) |
| 78 { |
| 79 visitor->trace(m_lastEffect); |
| 80 visitor->trace(m_referenceFilters); |
| 81 } |
| 82 |
| 77 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations&
operations) | 83 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations&
operations) |
| 78 { | 84 { |
| 79 const RenderStyle* style = renderer->style(); | 85 const RenderStyle* style = renderer->style(); |
| 80 float zoom = style ? style->effectiveZoom() : 1.0f; | 86 float zoom = style ? style->effectiveZoom() : 1.0f; |
| 81 | 87 |
| 82 // 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. | 88 // 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. |
| 83 RefPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1.0f); | 89 RefPtrWillBeRawPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1
.0f); |
| 84 RefPtr<FilterEffect> previousEffect = SourceGraphic::create(parentFilter.get
()); | 90 RefPtrWillBeRawPtr<FilterEffect> previousEffect = SourceGraphic::create(pare
ntFilter.get()); |
| 85 for (size_t i = 0; i < operations.operations().size(); ++i) { | 91 for (size_t i = 0; i < operations.operations().size(); ++i) { |
| 86 RefPtr<FilterEffect> effect; | 92 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; |
| 87 FilterOperation* filterOperation = operations.operations().at(i).get(); | 93 FilterOperation* filterOperation = operations.operations().at(i).get(); |
| 88 switch (filterOperation->type()) { | 94 switch (filterOperation->type()) { |
| 89 case FilterOperation::REFERENCE: { | 95 case FilterOperation::REFERENCE: { |
| 90 RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create(zo
om); | 96 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
r::create(zoom); |
| 91 effect = ReferenceFilterBuilder::build(referenceFilter.get(), render
er, previousEffect.get(), toReferenceFilterOperation(filterOperation)); | 97 effect = ReferenceFilterBuilder::build(referenceFilter.get(), render
er, previousEffect.get(), toReferenceFilterOperation(filterOperation)); |
| 92 referenceFilter->setLastEffect(effect); | 98 referenceFilter->setLastEffect(effect); |
| 93 m_referenceFilters.append(referenceFilter); | 99 m_referenceFilters.append(referenceFilter); |
| 94 break; | 100 break; |
| 95 } | 101 } |
| 96 case FilterOperation::GRAYSCALE: { | 102 case FilterOperation::GRAYSCALE: { |
| 97 Vector<float> inputParameters; | 103 Vector<float> inputParameters; |
| 98 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); | 104 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio
n(filterOperation)->amount(), 0.0, 1.0); |
| 99 | 105 |
| 100 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g
rayscaleEquivalent | 106 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g
rayscaleEquivalent |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 254 |
| 249 void FilterEffectRenderer::clearIntermediateResults() | 255 void FilterEffectRenderer::clearIntermediateResults() |
| 250 { | 256 { |
| 251 if (m_lastEffect.get()) | 257 if (m_lastEffect.get()) |
| 252 m_lastEffect->clearResultsRecursive(); | 258 m_lastEffect->clearResultsRecursive(); |
| 253 } | 259 } |
| 254 | 260 |
| 255 | 261 |
| 256 } // namespace blink | 262 } // namespace blink |
| 257 | 263 |
| OLD | NEW |