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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat ions, float zoom, const FloatSize* zoomedReferenceBoxSize, const SkPaint* fillPa int, const SkPaint* strokePaint) | 150 bool FilterEffectBuilder::build(Element* element, const FilterOperations& operat ions, float zoom, const FloatSize* zoomedReferenceBoxSize, const SkPaint* fillPa int, const SkPaint* strokePaint) |
151 { | 151 { |
152 // 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. | 152 // 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. |
153 Filter* parentFilter = Filter::create(1.0f); | 153 Filter* parentFilter = Filter::create(1.0f); |
154 FilterEffect* previousEffect = parentFilter->getSourceGraphic(); | 154 FilterEffect* previousEffect = parentFilter->getSourceGraphic(); |
155 for (size_t i = 0; i < operations.operations().size(); ++i) { | 155 for (size_t i = 0; i < operations.operations().size(); ++i) { |
156 FilterEffect* effect = nullptr; | 156 FilterEffect* effect = nullptr; |
157 FilterOperation* filterOperation = operations.operations().at(i).get(); | 157 FilterOperation* filterOperation = operations.operations().at(i).get(); |
158 switch (filterOperation->type()) { | 158 switch (filterOperation->type()) { |
159 case FilterOperation::REFERENCE: { | 159 case FilterOperation::REFERENCE: { |
160 if (!element) | |
esprehn
2016/09/12 20:53:12
In general core/paint is not thread safe, this cod
| |
161 break; | |
160 Filter* referenceFilter = buildReferenceFilter(toReferenceFilterOper ation(*filterOperation), zoomedReferenceBoxSize, fillPaint, strokePaint, *elemen t, previousEffect, zoom); | 162 Filter* referenceFilter = buildReferenceFilter(toReferenceFilterOper ation(*filterOperation), zoomedReferenceBoxSize, fillPaint, strokePaint, *elemen t, previousEffect, zoom); |
161 if (referenceFilter) | 163 if (referenceFilter) |
162 effect = referenceFilter->lastEffect(); | 164 effect = referenceFilter->lastEffect(); |
163 break; | 165 break; |
164 } | 166 } |
165 case FilterOperation::GRAYSCALE: { | 167 case FilterOperation::GRAYSCALE: { |
166 Vector<float> inputParameters = grayscaleMatrix(toBasicColorMatrixFi lterOperation(filterOperation)->amount()); | 168 Vector<float> inputParameters = grayscaleMatrix(toBasicColorMatrixFi lterOperation(filterOperation)->amount()); |
167 effect = FEColorMatrix::create(parentFilter, FECOLORMATRIX_TYPE_MATR IX, inputParameters); | 169 effect = FEColorMatrix::create(parentFilter, FECOLORMATRIX_TYPE_MATR IX, inputParameters); |
168 break; | 170 break; |
169 } | 171 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 Filter* result = Filter::create(referenceBox, filterRegion, zoom, unitScalin g); | 316 Filter* result = Filter::create(referenceBox, filterRegion, zoom, unitScalin g); |
315 if (!previousEffect) | 317 if (!previousEffect) |
316 previousEffect = result->getSourceGraphic(); | 318 previousEffect = result->getSourceGraphic(); |
317 SVGFilterBuilder builder(previousEffect, nodeMap, fillPaint, strokePaint); | 319 SVGFilterBuilder builder(previousEffect, nodeMap, fillPaint, strokePaint); |
318 builder.buildGraph(result, filterElement, referenceBox); | 320 builder.buildGraph(result, filterElement, referenceBox); |
319 result->setLastEffect(builder.lastEffect()); | 321 result->setLastEffect(builder.lastEffect()); |
320 return result; | 322 return result; |
321 } | 323 } |
322 | 324 |
323 } // namespace blink | 325 } // namespace blink |
324 | |
OLD | NEW |