OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 University of Szeged | 2 * Copyright (C) 2012 University of Szeged |
3 * Copyright (C) 2012 Gabor Rapcsanyi | 3 * Copyright (C) 2012 Gabor Rapcsanyi |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 dstPixelArray[colorOffset + 7] = alphaR2; | 159 dstPixelArray[colorOffset + 7] = alphaR2; |
160 | 160 |
161 colorOffset += 8; | 161 colorOffset += 8; |
162 if (colorOffset > colorArrayLength) { | 162 if (colorOffset > colorArrayLength) { |
163 ASSERT(colorOffset - 4 == colorArrayLength); | 163 ASSERT(colorOffset - 4 == colorArrayLength); |
164 colorOffset = colorArrayLength - 8; | 164 colorOffset = colorArrayLength - 8; |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
| 169 void FEBlend::applySoftwareInternalNEON() |
| 170 { |
| 171 if (m_mode != WebBlendModeNormal |
| 172 && m_mode != WebBlendModeMultiply |
| 173 && m_mode != WebBlendModeScreen |
| 174 && m_mode != WebBlendModeDarken |
| 175 && m_mode != WebBlendModeLighten) |
| 176 return applySoftwareInternal(); |
| 177 |
| 178 Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); |
| 179 if (!dstPixelArray) |
| 180 return; |
| 181 |
| 182 FilterEffect* in = inputEffect(0); |
| 183 FilterEffect* in2 = inputEffect(1); |
| 184 |
| 185 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePai
ntRect()); |
| 186 RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectAD
rawingRect); |
| 187 |
| 188 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePa
intRect()); |
| 189 RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectB
DrawingRect); |
| 190 |
| 191 unsigned pixelArrayLength = srcPixelArrayA->length(); |
| 192 ASSERT(pixelArrayLength == srcPixelArrayB->length()); |
| 193 |
| 194 if (pixelArrayLength >= 8) { |
| 195 platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPix
elArray->data(), pixelArrayLength); |
| 196 } else { |
| 197 // If there is just one pixel we expand it to two. |
| 198 ASSERT(pixelArrayLength > 0); |
| 199 uint32_t sourceA[2] = {0, 0}; |
| 200 uint32_t sourceBAndDest[2] = {0, 0}; |
| 201 |
| 202 sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; |
| 203 sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[
0]; |
| 204 platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<
uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); |
| 205 reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0
]; |
| 206 } |
| 207 } |
| 208 |
169 } // namespace blink | 209 } // namespace blink |
170 | 210 |
171 #endif // HAVE(ARM_NEON_INTRINSICS) | 211 #endif // HAVE(ARM_NEON_INTRINSICS) |
172 | 212 |
173 #endif // FEBlendNEON_h | 213 #endif // FEBlendNEON_h |
OLD | NEW |