21 + } |
21 + } |
22 +} |
22 +} |
23 + |
23 + |
24 void ConvolutionFilter::ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst, |
24 void ConvolutionFilter::ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst, |
25 bool aHasAlpha) { |
25 bool aHasAlpha) { |
26 +#if MOZ_BIG_ENDIAN |
26 +#if MOZ_BIG_ENDIAN() |
27 + int outputSize = mFilter->numValues(); |
27 + int outputSize = mFilter->numValues(); |
28 + |
28 + |
29 + // Input size isn't handed in, so we have to calculate it quickly |
29 + // Input size isn't handed in, so we have to calculate it quickly |
30 + int inputSize = 0; |
30 + int inputSize = 0; |
31 + for (int xx = 0; xx < outputSize; ++xx) { |
31 + for (int xx = 0; xx < outputSize; ++xx) { |
38 + ByteSwapArray((uint8_t*)aSrc, inputSize); |
38 + ByteSwapArray((uint8_t*)aSrc, inputSize); |
39 +#endif |
39 +#endif |
40 + |
40 + |
41 SkOpts::convolve_horizontally(aSrc, *mFilter, aDst, aHasAlpha); |
41 SkOpts::convolve_horizontally(aSrc, *mFilter, aDst, aHasAlpha); |
42 + |
42 + |
43 +#if MOZ_BIG_ENDIAN |
43 +#if MOZ_BIG_ENDIAN() |
44 + ByteSwapArray((uint8_t*)aSrc, inputSize); |
44 + ByteSwapArray((uint8_t*)aSrc, inputSize); |
45 + ByteSwapArray(aDst, outputSize); |
45 + ByteSwapArray(aDst, outputSize); |
46 +#endif |
46 +#endif |
47 } |
47 } |
48 |
48 |
50 @@ -49,8 +78,26 @@ |
50 @@ -49,8 +78,26 @@ |
51 int32_t filterLength; |
51 int32_t filterLength; |
52 auto filterValues = |
52 auto filterValues = |
53 mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength); |
53 mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength); |
54 + |
54 + |
55 +#if MOZ_BIG_ENDIAN |
55 +#if MOZ_BIG_ENDIAN() |
56 + for (int filterY = 0; filterY < filterLength; filterY++) { |
56 + for (int filterY = 0; filterY < filterLength; filterY++) { |
57 + // Skia only knows LE, so we have to swizzle the input |
57 + // Skia only knows LE, so we have to swizzle the input |
58 + ByteSwapArray(aSrc[filterY], aRowSize); |
58 + ByteSwapArray(aSrc[filterY], aRowSize); |
59 + } |
59 + } |
60 +#endif |
60 +#endif |
61 + |
61 + |
62 SkOpts::convolve_vertically(filterValues, filterLength, aSrc, aRowSize, aDst, |
62 SkOpts::convolve_vertically(filterValues, filterLength, aSrc, aRowSize, aDst, |
63 aHasAlpha); |
63 aHasAlpha); |
64 + |
64 + |
65 +#if MOZ_BIG_ENDIAN |
65 +#if MOZ_BIG_ENDIAN() |
66 + // After skia is finished, we swizzle back to BE, in case |
66 + // After skia is finished, we swizzle back to BE, in case |
67 + // the input is used again somewhere else |
67 + // the input is used again somewhere else |
68 + for (int filterY = 0; filterY < filterLength; filterY++) { |
68 + for (int filterY = 0; filterY < filterLength; filterY++) { |
69 + ByteSwapArray(aSrc[filterY], aRowSize); |
69 + ByteSwapArray(aSrc[filterY], aRowSize); |
70 + } |
70 + } |