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 21 matching lines...) Expand all Loading... |
32 #include "core/fetch/DocumentResourceReference.h" | 32 #include "core/fetch/DocumentResourceReference.h" |
33 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
34 #include "core/page/Page.h" | 34 #include "core/page/Page.h" |
35 #include "core/rendering/RenderObject.h" | 35 #include "core/rendering/RenderObject.h" |
36 #include "core/rendering/svg/ReferenceFilterBuilder.h" | 36 #include "core/rendering/svg/ReferenceFilterBuilder.h" |
37 #include "core/svg/SVGElement.h" | 37 #include "core/svg/SVGElement.h" |
38 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" | 38 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" |
39 #include "platform/FloatConversion.h" | 39 #include "platform/FloatConversion.h" |
40 #include "platform/LengthFunctions.h" | 40 #include "platform/LengthFunctions.h" |
41 #include "platform/graphics/ColorSpace.h" | 41 #include "platform/graphics/ColorSpace.h" |
42 #include "platform/graphics/GraphicsContext.h" | |
43 #include "platform/graphics/ImageFilter.h" | 42 #include "platform/graphics/ImageFilter.h" |
44 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 43 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
45 #include "platform/graphics/filters/FEColorMatrix.h" | 44 #include "platform/graphics/filters/FEColorMatrix.h" |
46 #include "platform/graphics/filters/FEComponentTransfer.h" | 45 #include "platform/graphics/filters/FEComponentTransfer.h" |
47 #include "platform/graphics/filters/FEDropShadow.h" | 46 #include "platform/graphics/filters/FEDropShadow.h" |
48 #include "platform/graphics/filters/FEGaussianBlur.h" | 47 #include "platform/graphics/filters/FEGaussianBlur.h" |
49 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | |
50 #include "platform/graphics/filters/SourceGraphic.h" | 48 #include "platform/graphics/filters/SourceGraphic.h" |
51 #include "wtf/MathExtras.h" | 49 #include "wtf/MathExtras.h" |
52 #include <algorithm> | 50 #include <algorithm> |
53 | 51 |
54 namespace blink { | 52 namespace blink { |
55 | 53 |
56 static inline void endMatrixRow(Vector<float>& parameters) | 54 static inline void endMatrixRow(Vector<float>& parameters) |
57 { | 55 { |
58 parameters.append(0); | 56 parameters.append(0); |
59 parameters.append(0); | 57 parameters.append(0); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 245 |
248 return true; | 246 return true; |
249 } | 247 } |
250 | 248 |
251 void FilterEffectRenderer::clearIntermediateResults() | 249 void FilterEffectRenderer::clearIntermediateResults() |
252 { | 250 { |
253 if (m_lastEffect.get()) | 251 if (m_lastEffect.get()) |
254 m_lastEffect->clearResultsRecursive(); | 252 m_lastEffect->clearResultsRecursive(); |
255 } | 253 } |
256 | 254 |
257 bool FilterEffectRenderer::beginFilterEffect(GraphicsContext* context, const Flo
atRect& filterBoxRect) | |
258 { | |
259 SkiaImageFilterBuilder builder(context); | |
260 m_lastEffect->determineFilterPrimitiveSubregion(MapRectForward); | |
261 RefPtr<ImageFilter> imageFilter = builder.build(m_lastEffect.get(), ColorSpa
ceDeviceRGB); | |
262 if (!imageFilter) | |
263 return false; | |
264 context->save(); | |
265 FloatRect boundaries = mapImageFilterRect(imageFilter.get(), filterBoxRect); | |
266 context->translate(filterBoxRect.x(), filterBoxRect.y()); | |
267 boundaries.move(-filterBoxRect.x(), -filterBoxRect.y()); | |
268 context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, im
ageFilter.get()); | |
269 context->translate(-filterBoxRect.x(), -filterBoxRect.y()); | |
270 return true; | |
271 } | |
272 | |
273 void FilterEffectRenderer::endFilterEffect(GraphicsContext* context) | |
274 { | |
275 context->endLayer(); | |
276 context->restore(); | |
277 } | |
278 | 255 |
279 } // namespace blink | 256 } // namespace blink |
280 | 257 |
OLD | NEW |