Chromium Code Reviews| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 FilterEffectBuilder::~FilterEffectBuilder() | 123 FilterEffectBuilder::~FilterEffectBuilder() |
| 124 { | 124 { |
| 125 } | 125 } |
| 126 | 126 |
| 127 DEFINE_TRACE(FilterEffectBuilder) | 127 DEFINE_TRACE(FilterEffectBuilder) |
| 128 { | 128 { |
| 129 visitor->trace(m_lastEffect); | 129 visitor->trace(m_lastEffect); |
| 130 visitor->trace(m_referenceFilters); | 130 visitor->trace(m_referenceFilters); |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat ions, float zoom) | 133 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat ions, float zoom, PassRefPtr<SkShader> fillShader, PassRefPtr<SkShader> strokeSh ader) |
| 134 { | 134 { |
| 135 // 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. | 135 // 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. |
| 136 RefPtrWillBeRawPtr<Filter> parentFilter = Filter::create(1.0f); | 136 RefPtrWillBeRawPtr<Filter> parentFilter = Filter::create(1.0f); |
| 137 RefPtrWillBeRawPtr<FilterEffect> previousEffect = parentFilter->sourceGraphi c(); | 137 RefPtrWillBeRawPtr<FilterEffect> previousEffect = parentFilter->sourceGraphi c(); |
| 138 for (size_t i = 0; i < operations.operations().size(); ++i) { | 138 for (size_t i = 0; i < operations.operations().size(); ++i) { |
| 139 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; | 139 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr; |
| 140 FilterOperation* filterOperation = operations.operations().at(i).get(); | 140 FilterOperation* filterOperation = operations.operations().at(i).get(); |
| 141 switch (filterOperation->type()) { | 141 switch (filterOperation->type()) { |
| 142 case FilterOperation::REFERENCE: { | 142 case FilterOperation::REFERENCE: { |
| 143 RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder: :build(zoom, element, previousEffect.get(), toReferenceFilterOperation(*filterOp eration)); | 143 RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder: :build(zoom, element, previousEffect.get(), toReferenceFilterOperation(*filterOp eration), fillShader, strokeShader); |
|
fs
2015/12/21 19:34:20
Won't this "lose" the shaders if there were more t
ajuma
2016/01/11 19:14:08
Good catch, thanks! This now uses a raw pointer to
| |
| 144 if (referenceFilter) { | 144 if (referenceFilter) { |
| 145 effect = referenceFilter->lastEffect(); | 145 effect = referenceFilter->lastEffect(); |
| 146 m_referenceFilters.append(referenceFilter); | 146 m_referenceFilters.append(referenceFilter); |
| 147 } | 147 } |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 case FilterOperation::GRAYSCALE: { | 150 case FilterOperation::GRAYSCALE: { |
| 151 Vector<float> inputParameters = grayscaleMatrix(toBasicColorMatrixFi lterOperation(filterOperation)->amount()); | 151 Vector<float> inputParameters = grayscaleMatrix(toBasicColorMatrixFi lterOperation(filterOperation)->amount()); |
| 152 effect = FEColorMatrix::create(parentFilter.get(), FECOLORMATRIX_TYP E_MATRIX, inputParameters); | 152 effect = FEColorMatrix::create(parentFilter.get(), FECOLORMATRIX_TYP E_MATRIX, inputParameters); |
| 153 break; | 153 break; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 | 251 |
| 252 // If we didn't make any effects, tell our caller we are not valid | 252 // If we didn't make any effects, tell our caller we are not valid |
| 253 if (!m_lastEffect.get()) | 253 if (!m_lastEffect.get()) |
| 254 return false; | 254 return false; |
| 255 | 255 |
| 256 return true; | 256 return true; |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace blink | 259 } // namespace blink |
| 260 | 260 |
| OLD | NEW |