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

Unified Diff: Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h

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, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h
diff --git a/Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h b/Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h
index 3cd842879b088c56403824ca0b9e782c50ae0421..c6e926355c8567284a28a395dd49405d5e4d901b 100644
--- a/Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h
+++ b/Source/platform/graphics/cpu/arm/filters/FEBlendNEON.h
@@ -166,6 +166,46 @@ void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* sr
}
}
+void FEBlend::applySoftwareInternalNEON()
+{
+ if (m_mode != WebBlendModeNormal
+ && m_mode != WebBlendModeMultiply
+ && m_mode != WebBlendModeScreen
+ && m_mode != WebBlendModeDarken
+ && m_mode != WebBlendModeLighten)
+ return applySoftwareInternal();
+
+ Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult();
+ if (!dstPixelArray)
+ return;
+
+ FilterEffect* in = inputEffect(0);
+ FilterEffect* in2 = inputEffect(1);
+
+ IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
+ RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect);
+
+ IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect());
+ RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect);
+
+ unsigned pixelArrayLength = srcPixelArrayA->length();
+ ASSERT(pixelArrayLength == srcPixelArrayB->length());
+
+ if (pixelArrayLength >= 8) {
+ platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength);
+ } else {
+ // If there is just one pixel we expand it to two.
+ ASSERT(pixelArrayLength > 0);
+ uint32_t sourceA[2] = {0, 0};
+ uint32_t sourceBAndDest[2] = {0, 0};
+
+ sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0];
+ sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0];
+ platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8);
+ reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0];
+ }
+}
+
} // namespace blink
#endif // HAVE(ARM_NEON_INTRINSICS)

Powered by Google App Engine
This is Rietveld 408576698