OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
| 25 |
25 #include "config.h" | 26 #include "config.h" |
26 | |
27 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 27 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
28 | 28 |
29 #include "SkBlurImageFilter.h" | 29 #include "SkBlurImageFilter.h" |
30 #include "SkColorFilterImageFilter.h" | 30 #include "SkColorFilterImageFilter.h" |
31 #include "SkColorMatrixFilter.h" | 31 #include "SkColorMatrixFilter.h" |
32 #include "SkTableColorFilter.h" | 32 #include "SkTableColorFilter.h" |
33 #include "platform/graphics/ImageBuffer.h" | |
34 #include "platform/graphics/filters/FilterEffect.h" | 33 #include "platform/graphics/filters/FilterEffect.h" |
35 #include "platform/graphics/filters/FilterOperations.h" | 34 #include "platform/graphics/filters/FilterOperations.h" |
36 #include "platform/graphics/filters/SourceGraphic.h" | 35 #include "platform/graphics/filters/SourceGraphic.h" |
37 #include "platform/graphics/skia/SkiaUtils.h" | 36 #include "platform/graphics/skia/SkiaUtils.h" |
38 #include "public/platform/WebPoint.h" | 37 #include "public/platform/WebPoint.h" |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 SkiaImageFilterBuilder::SkiaImageFilterBuilder() | 41 SkiaImageFilterBuilder::SkiaImageFilterBuilder() |
43 : m_context(nullptr) | 42 : m_context(nullptr) |
(...skipping 26 matching lines...) Expand all Loading... |
70 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), effect-
>operatingColorSpace(), colorSpace); | 69 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), effect-
>operatingColorSpace(), colorSpace); |
71 effect->setImageFilter(colorSpace, requiresPMColorValidation, filter.get()); | 70 effect->setImageFilter(colorSpace, requiresPMColorValidation, filter.get()); |
72 if (filter.get() != origFilter.get()) | 71 if (filter.get() != origFilter.get()) |
73 effect->setImageFilter(effect->operatingColorSpace(), requiresPMColorVal
idation, origFilter.get()); | 72 effect->setImageFilter(effect->operatingColorSpace(), requiresPMColorVal
idation, origFilter.get()); |
74 return filter.release(); | 73 return filter.release(); |
75 } | 74 } |
76 | 75 |
77 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::transformColorSpace( | 76 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::transformColorSpace( |
78 SkImageFilter* input, ColorSpace srcColorSpace, ColorSpace dstColorSpace) { | 77 SkImageFilter* input, ColorSpace srcColorSpace, ColorSpace dstColorSpace) { |
79 | 78 |
80 RefPtr<SkColorFilter> colorFilter = ImageBuffer::createColorSpaceFilter(srcC
olorSpace, dstColorSpace); | 79 RefPtr<SkColorFilter> colorFilter = ColorSpaceUtilities::createColorSpaceFil
ter(srcColorSpace, dstColorSpace); |
81 if (!colorFilter) | 80 if (!colorFilter) |
82 return input; | 81 return input; |
83 | 82 |
84 return adoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), input)); | 83 return adoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), input)); |
85 } | 84 } |
86 | 85 |
87 void SkiaImageFilterBuilder::buildFilterOperations(const FilterOperations& opera
tions, WebFilterOperations* filters) | 86 void SkiaImageFilterBuilder::buildFilterOperations(const FilterOperations& opera
tions, WebFilterOperations* filters) |
88 { | 87 { |
89 ColorSpace currentColorSpace = ColorSpaceDeviceRGB; | 88 ColorSpace currentColorSpace = ColorSpaceDeviceRGB; |
90 SkImageFilter* const nullFilter = 0; | 89 SkImageFilter* const nullFilter = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 filters->appendReferenceFilter(filter.get()); | 182 filters->appendReferenceFilter(filter.get()); |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildTransform(const AffineTra
nsform& transform, SkImageFilter* input) | 186 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildTransform(const AffineTra
nsform& transform, SkImageFilter* input) |
188 { | 187 { |
189 return adoptRef(SkImageFilter::CreateMatrixFilter(affineTransformToSkMatrix(
transform), kHigh_SkFilterQuality, input)); | 188 return adoptRef(SkImageFilter::CreateMatrixFilter(affineTransformToSkMatrix(
transform), kHigh_SkFilterQuality, input)); |
190 } | 189 } |
191 | 190 |
192 } // namespace blink | 191 } // namespace blink |
OLD | NEW |