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

Side by Side Diff: Source/platform/graphics/filters/FEComposite.cpp

Issue 604373003: [WIP] Supporting arm_neon_optional flag for blink platform. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #include "platform/graphics/filters/FEComposite.h" 27 #include "platform/graphics/filters/FEComposite.h"
28 28
29 #include "SkArithmeticMode.h" 29 #include "SkArithmeticMode.h"
30 #include "SkXfermodeImageFilter.h" 30 #include "SkXfermodeImageFilter.h"
31 31
32 #include "platform/graphics/GraphicsContext.h" 32 #include "platform/graphics/GraphicsContext.h"
33 #if HAVE(ARM_NEON_INTRINSICS)
33 #include "platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h" 34 #include "platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h"
35 #endif
34 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
35 #include "platform/text/TextStream.h" 37 #include "platform/text/TextStream.h"
36 #include "third_party/skia/include/core/SkDevice.h" 38 #include "third_party/skia/include/core/SkDevice.h"
37 39
38 #include "wtf/Uint8ClampedArray.h" 40 #include "wtf/Uint8ClampedArray.h"
39 41
40 namespace blink { 42 namespace blink {
41 43
42 FEComposite::FEComposite(Filter* filter, const CompositeOperationType& type, flo at k1, float k2, float k3, float k4) 44 FEComposite::FEComposite(Filter* filter, const CompositeOperationType& type, flo at k1, float k2, float k3, float k4)
43 : FilterEffect(filter) 45 : FilterEffect(filter)
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 computeArithmeticPixels<0, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4); 218 computeArithmeticPixels<0, 0>(source, destination, pixelArrayLength, k1, k2, k3, k4);
217 } 219 }
218 } 220 }
219 221
220 inline void FEComposite::platformArithmeticSoftware(Uint8ClampedArray* source, U int8ClampedArray* destination, 222 inline void FEComposite::platformArithmeticSoftware(Uint8ClampedArray* source, U int8ClampedArray* destination,
221 float k1, float k2, float k3, float k4) 223 float k1, float k2, float k3, float k4)
222 { 224 {
223 int length = source->length(); 225 int length = source->length();
224 ASSERT(length == static_cast<int>(destination->length())); 226 ASSERT(length == static_cast<int>(destination->length()));
225 // The selection here eventually should happen dynamically. 227 // The selection here eventually should happen dynamically.
226 #if HAVE(ARM_NEON_INTRINSICS) 228 WTF_CPU_ARM_NEON_WRAP(arithmeticSoftware)(source->data(), destination->data( ), length, k1, k2, k3, k4);
227 ASSERT(!(length & 0x3));
228 platformArithmeticNeon(source->data(), destination->data(), length, k1, k2, k3, k4);
229 #else
230 arithmeticSoftware(source->data(), destination->data(), length, k1, k2, k3, k4);
231 #endif
232 } 229 }
233 230
234 FloatRect FEComposite::determineAbsolutePaintRect(const FloatRect& originalReque stedRect) 231 FloatRect FEComposite::determineAbsolutePaintRect(const FloatRect& originalReque stedRect)
235 { 232 {
236 FloatRect requestedRect = originalRequestedRect; 233 FloatRect requestedRect = originalRequestedRect;
237 if (clipsToBounds()) 234 if (clipsToBounds())
238 requestedRect.intersect(maxEffectRect()); 235 requestedRect.intersect(maxEffectRect());
239 236
240 // We may be called multiple times if result is used more than once. Return 237 // We may be called multiple times if result is used more than once. Return
241 // quickly if nothing new is required. 238 // quickly if nothing new is required.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 ts << " operation=\"" << m_type << "\""; 431 ts << " operation=\"" << m_type << "\"";
435 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) 432 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC)
436 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\ " k4=\"" << m_k4 << "\""; 433 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\ " k4=\"" << m_k4 << "\"";
437 ts << "]\n"; 434 ts << "]\n";
438 inputEffect(0)->externalRepresentation(ts, indent + 1); 435 inputEffect(0)->externalRepresentation(ts, indent + 1);
439 inputEffect(1)->externalRepresentation(ts, indent + 1); 436 inputEffect(1)->externalRepresentation(ts, indent + 1);
440 return ts; 437 return ts;
441 } 438 }
442 439
443 } // namespace blink 440 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/FEComposite.h ('k') | Source/platform/graphics/filters/FEGaussianBlur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698