Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: Source/platform/graphics/filters/FilterEffect.h

Issue 134733016: Add support for converting Colors to linear RGB; Fix relevant filters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase; update TestExpectations Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23 #ifndef FilterEffect_h 23 #ifndef FilterEffect_h
24 #define FilterEffect_h 24 #define FilterEffect_h
25 25
26 #include "platform/PlatformExport.h" 26 #include "platform/PlatformExport.h"
27 #include "platform/geometry/FloatRect.h" 27 #include "platform/geometry/FloatRect.h"
28 #include "platform/geometry/IntRect.h" 28 #include "platform/geometry/IntRect.h"
29 #include "platform/graphics/Color.h"
29 #include "platform/graphics/ColorSpace.h" 30 #include "platform/graphics/ColorSpace.h"
30 31
31 #include "third_party/skia/include/core/SkImageFilter.h" 32 #include "third_party/skia/include/core/SkImageFilter.h"
32 33
33 #include "wtf/PassOwnPtr.h" 34 #include "wtf/PassOwnPtr.h"
34 #include "wtf/RefCounted.h" 35 #include "wtf/RefCounted.h"
35 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
36 #include "wtf/Uint8ClampedArray.h" 37 #include "wtf/Uint8ClampedArray.h"
37 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
38 39
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol uteRect); 177 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedAbsol uteRect);
177 virtual bool affectsTransparentPixels() { return false; } 178 virtual bool affectsTransparentPixels() { return false; }
178 179
179 protected: 180 protected:
180 FilterEffect(Filter*); 181 FilterEffect(Filter*);
181 182
182 ImageBuffer* createImageBufferResult(); 183 ImageBuffer* createImageBufferResult();
183 Uint8ClampedArray* createUnmultipliedImageResult(); 184 Uint8ClampedArray* createUnmultipliedImageResult();
184 Uint8ClampedArray* createPremultipliedImageResult(); 185 Uint8ClampedArray* createPremultipliedImageResult();
185 186
187 Color adaptColorToOperatingColorSpace(const Color& deviceColor);
188
186 // Return true if the filter will only operate correctly on valid RGBA value s, with 189 // Return true if the filter will only operate correctly on valid RGBA value s, with
187 // alpha in [0,255] and each color component in [0, alpha]. 190 // alpha in [0,255] and each color component in [0, alpha].
188 virtual bool requiresValidPreMultipliedPixels() { return true; } 191 virtual bool requiresValidPreMultipliedPixels() { return true; }
189 192
190 // If a pre-multiplied image, check every pixel for validity and correct if necessary. 193 // If a pre-multiplied image, check every pixel for validity and correct if necessary.
191 void forceValidPreMultipliedPixels(); 194 void forceValidPreMultipliedPixels();
192 SkImageFilter::CropRect getCropRect(const FloatSize& cropOffset) const; 195 SkImageFilter::CropRect getCropRect(const FloatSize& cropOffset) const;
193 196
194 void addAbsolutePaintRect(const FloatRect& absolutePaintRect); 197 void addAbsolutePaintRect(const FloatRect& absolutePaintRect);
195 198
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Should the effect clip to its primitive region, or expand to use the comb ined region of its inputs. 235 // Should the effect clip to its primitive region, or expand to use the comb ined region of its inputs.
233 bool m_clipsToBounds; 236 bool m_clipsToBounds;
234 237
235 ColorSpace m_operatingColorSpace; 238 ColorSpace m_operatingColorSpace;
236 ColorSpace m_resultColorSpace; 239 ColorSpace m_resultColorSpace;
237 }; 240 };
238 241
239 } // namespace WebCore 242 } // namespace WebCore
240 243
241 #endif // FilterEffect_h 244 #endif // FilterEffect_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/FELighting.cpp ('k') | Source/platform/graphics/filters/FilterEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698