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

Unified Diff: src/opts/SkBlitMask_opts_arm_neon.cpp

Issue 1278253003: Sk4px blit mask. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: note overflow Created 5 years, 4 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
« no previous file with comments | « src/opts/SkBlitMask_opts_arm_neon.h ('k') | src/opts/SkBlitMask_opts_none.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkBlitMask_opts_arm_neon.cpp
diff --git a/src/opts/SkBlitMask_opts_arm_neon.cpp b/src/opts/SkBlitMask_opts_arm_neon.cpp
index 3361a5d19dd777191700bbe8f4f6111ddb7c1d7a..ad12369db69a47c5e6504a1232b8b1a6195492d5 100644
--- a/src/opts/SkBlitMask_opts_arm_neon.cpp
+++ b/src/opts/SkBlitMask_opts_arm_neon.cpp
@@ -8,129 +8,6 @@
#include "SkBlitMask.h"
#include "SkColor_opts_neon.h"
-static void D32_A8_Black_neon(void* SK_RESTRICT dst, size_t dstRB,
- const void* SK_RESTRICT maskPtr, size_t maskRB,
- SkColor, int width, int height) {
- SkPMColor* SK_RESTRICT device = (SkPMColor*)dst;
- const uint8_t* SK_RESTRICT mask = (const uint8_t*)maskPtr;
-
- maskRB -= width;
- dstRB -= (width << 2);
- do {
- int w = width;
- while (w >= 8) {
- uint8x8_t vmask = vld1_u8(mask);
- uint16x8_t vscale = vsubw_u8(vdupq_n_u16(256), vmask);
- uint8x8x4_t vdevice = vld4_u8((uint8_t*)device);
-
- vdevice = SkAlphaMulQ_neon8(vdevice, vscale);
- vdevice.val[NEON_A] += vmask;
-
- vst4_u8((uint8_t*)device, vdevice);
-
- mask += 8;
- device += 8;
- w -= 8;
- }
- while (w-- > 0) {
- unsigned aa = *mask++;
- *device = (aa << SK_A32_SHIFT)
- + SkAlphaMulQ(*device, SkAlpha255To256(255 - aa));
- device += 1;
- };
- device = (uint32_t*)((char*)device + dstRB);
- mask += maskRB;
- } while (--height != 0);
-}
-
-template <bool isColor>
-static void D32_A8_Opaque_Color_neon(void* SK_RESTRICT dst, size_t dstRB,
- const void* SK_RESTRICT maskPtr, size_t maskRB,
- SkColor color, int width, int height) {
- SkPMColor pmc = SkPreMultiplyColor(color);
- SkPMColor* SK_RESTRICT device = (SkPMColor*)dst;
- const uint8_t* SK_RESTRICT mask = (const uint8_t*)maskPtr;
- uint8x8x4_t vpmc;
-
- maskRB -= width;
- dstRB -= (width << 2);
-
- if (width >= 8) {
- vpmc.val[NEON_A] = vdup_n_u8(SkGetPackedA32(pmc));
- vpmc.val[NEON_R] = vdup_n_u8(SkGetPackedR32(pmc));
- vpmc.val[NEON_G] = vdup_n_u8(SkGetPackedG32(pmc));
- vpmc.val[NEON_B] = vdup_n_u8(SkGetPackedB32(pmc));
- }
- do {
- int w = width;
- while (w >= 8) {
- uint8x8_t vmask = vld1_u8(mask);
- uint16x8_t vscale, vmask256 = SkAlpha255To256_neon8(vmask);
- if (isColor) {
- vscale = vsubw_u8(vdupq_n_u16(256),
- SkAlphaMul_neon8(vpmc.val[NEON_A], vmask256));
- } else {
- vscale = vsubw_u8(vdupq_n_u16(256), vmask);
- }
- uint8x8x4_t vdev = vld4_u8((uint8_t*)device);
-
- vdev.val[NEON_A] = SkAlphaMul_neon8(vpmc.val[NEON_A], vmask256)
- + SkAlphaMul_neon8(vdev.val[NEON_A], vscale);
- vdev.val[NEON_R] = SkAlphaMul_neon8(vpmc.val[NEON_R], vmask256)
- + SkAlphaMul_neon8(vdev.val[NEON_R], vscale);
- vdev.val[NEON_G] = SkAlphaMul_neon8(vpmc.val[NEON_G], vmask256)
- + SkAlphaMul_neon8(vdev.val[NEON_G], vscale);
- vdev.val[NEON_B] = SkAlphaMul_neon8(vpmc.val[NEON_B], vmask256)
- + SkAlphaMul_neon8(vdev.val[NEON_B], vscale);
-
- vst4_u8((uint8_t*)device, vdev);
-
- mask += 8;
- device += 8;
- w -= 8;
- }
-
- while (w--) {
- unsigned aa = *mask++;
- if (isColor) {
- *device = SkBlendARGB32(pmc, *device, aa);
- } else {
- *device = SkAlphaMulQ(pmc, SkAlpha255To256(aa))
- + SkAlphaMulQ(*device, SkAlpha255To256(255 - aa));
- }
- device += 1;
- };
-
- device = (uint32_t*)((char*)device + dstRB);
- mask += maskRB;
-
- } while (--height != 0);
-}
-
-static void D32_A8_Opaque_neon(void* SK_RESTRICT dst, size_t dstRB,
- const void* SK_RESTRICT maskPtr, size_t maskRB,
- SkColor color, int width, int height) {
- D32_A8_Opaque_Color_neon<false>(dst, dstRB, maskPtr, maskRB, color, width, height);
-}
-
-static void D32_A8_Color_neon(void* SK_RESTRICT dst, size_t dstRB,
- const void* SK_RESTRICT maskPtr, size_t maskRB,
- SkColor color, int width, int height) {
- D32_A8_Opaque_Color_neon<true>(dst, dstRB, maskPtr, maskRB, color, width, height);
-}
-
-SkBlitMask::ColorProc D32_A8_Factory_neon(SkColor color) {
- if (SK_ColorBLACK == color) {
- return D32_A8_Black_neon;
- } else if (0xFF == SkColorGetA(color)) {
- return D32_A8_Opaque_neon;
- } else {
- return D32_A8_Color_neon;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
void SkBlitLCD16OpaqueRow_neon(SkPMColor dst[], const uint16_t src[],
SkColor color, int width,
SkPMColor opaqueDst) {
« no previous file with comments | « src/opts/SkBlitMask_opts_arm_neon.h ('k') | src/opts/SkBlitMask_opts_none.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698