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 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 { | 46 { |
47 if (!effect) | 47 if (!effect) |
48 return nullptr; | 48 return nullptr; |
49 | 49 |
50 bool requiresPMColorValidation = effect->mayProduceInvalidPreMultipliedPixel
s() && destinationRequiresValidPreMultipliedPixels; | 50 bool requiresPMColorValidation = effect->mayProduceInvalidPreMultipliedPixel
s() && destinationRequiresValidPreMultipliedPixels; |
51 | 51 |
52 if (SkImageFilter* filter = effect->getImageFilter(colorSpace, requiresPMCol
orValidation)) | 52 if (SkImageFilter* filter = effect->getImageFilter(colorSpace, requiresPMCol
orValidation)) |
53 return filter; | 53 return filter; |
54 | 54 |
55 // Note that we may still need the color transform even if the filter is nul
l | 55 // Note that we may still need the color transform even if the filter is nul
l |
56 RefPtr<SkImageFilter> origFilter = requiresPMColorValidation ? effect->creat
eImageFilter(this) : effect->createImageFilterWithoutValidation(this); | 56 RefPtr<SkImageFilter> origFilter = requiresPMColorValidation ? effect->creat
eImageFilter(*this) : effect->createImageFilterWithoutValidation(*this); |
57 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), effect-
>operatingColorSpace(), colorSpace); | 57 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), effect-
>operatingColorSpace(), colorSpace); |
58 effect->setImageFilter(colorSpace, requiresPMColorValidation, filter.get()); | 58 effect->setImageFilter(colorSpace, requiresPMColorValidation, filter.get()); |
59 if (filter.get() != origFilter.get()) | 59 if (filter.get() != origFilter.get()) |
60 effect->setImageFilter(effect->operatingColorSpace(), requiresPMColorVal
idation, origFilter.get()); | 60 effect->setImageFilter(effect->operatingColorSpace(), requiresPMColorVal
idation, origFilter.get()); |
61 return filter.release(); | 61 return filter.release(); |
62 } | 62 } |
63 | 63 |
64 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::transformColorSpace( | 64 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::transformColorSpace( |
65 SkImageFilter* input, ColorSpace srcColorSpace, ColorSpace dstColorSpace) { | 65 SkImageFilter* input, ColorSpace srcColorSpace, ColorSpace dstColorSpace) { |
66 | 66 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 filters->appendReferenceFilter(filter.get()); | 171 filters->appendReferenceFilter(filter.get()); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildTransform(const AffineTra
nsform& transform, SkImageFilter* input) | 175 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildTransform(const AffineTra
nsform& transform, SkImageFilter* input) |
176 { | 176 { |
177 return adoptRef(SkImageFilter::CreateMatrixFilter(affineTransformToSkMatrix(
transform), kHigh_SkFilterQuality, input)); | 177 return adoptRef(SkImageFilter::CreateMatrixFilter(affineTransformToSkMatrix(
transform), kHigh_SkFilterQuality, input)); |
178 } | 178 } |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
OLD | NEW |