Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #define SIMD_COMPILE_SSE2 |
michael@0 | 7 | |
michael@0 | 8 | #include "FilterProcessingSIMD-inl.h" |
michael@0 | 9 | |
michael@0 | 10 | #ifndef USE_SSE2 |
michael@0 | 11 | static_assert(false, "If this file is built, FilterProcessing.h should know about it!"); |
michael@0 | 12 | #endif |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace gfx { |
michael@0 | 16 | |
michael@0 | 17 | void |
michael@0 | 18 | FilterProcessing::ExtractAlpha_SSE2(const IntSize& size, uint8_t* sourceData, int32_t sourceStride, uint8_t* alphaData, int32_t alphaStride) |
michael@0 | 19 | { |
michael@0 | 20 | ExtractAlpha_SIMD<__m128i>(size, sourceData, sourceStride, alphaData, alphaStride); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | TemporaryRef<DataSourceSurface> |
michael@0 | 24 | FilterProcessing::ConvertToB8G8R8A8_SSE2(SourceSurface* aSurface) |
michael@0 | 25 | { |
michael@0 | 26 | return ConvertToB8G8R8A8_SIMD<__m128i>(aSurface); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | TemporaryRef<DataSourceSurface> |
michael@0 | 30 | FilterProcessing::ApplyBlending_SSE2(DataSourceSurface* aInput1, DataSourceSurface* aInput2, |
michael@0 | 31 | BlendMode aBlendMode) |
michael@0 | 32 | { |
michael@0 | 33 | return ApplyBlending_SIMD<__m128i,__m128i,__m128i>(aInput1, aInput2, aBlendMode); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | void |
michael@0 | 37 | FilterProcessing::ApplyMorphologyHorizontal_SSE2(uint8_t* aSourceData, int32_t aSourceStride, |
michael@0 | 38 | uint8_t* aDestData, int32_t aDestStride, |
michael@0 | 39 | const IntRect& aDestRect, int32_t aRadius, |
michael@0 | 40 | MorphologyOperator aOp) |
michael@0 | 41 | { |
michael@0 | 42 | ApplyMorphologyHorizontal_SIMD<__m128i,__m128i>( |
michael@0 | 43 | aSourceData, aSourceStride, aDestData, aDestStride, aDestRect, aRadius, aOp); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | void |
michael@0 | 47 | FilterProcessing::ApplyMorphologyVertical_SSE2(uint8_t* aSourceData, int32_t aSourceStride, |
michael@0 | 48 | uint8_t* aDestData, int32_t aDestStride, |
michael@0 | 49 | const IntRect& aDestRect, int32_t aRadius, |
michael@0 | 50 | MorphologyOperator aOp) |
michael@0 | 51 | { |
michael@0 | 52 | ApplyMorphologyVertical_SIMD<__m128i,__m128i>( |
michael@0 | 53 | aSourceData, aSourceStride, aDestData, aDestStride, aDestRect, aRadius, aOp); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | TemporaryRef<DataSourceSurface> |
michael@0 | 57 | FilterProcessing::ApplyColorMatrix_SSE2(DataSourceSurface* aInput, const Matrix5x4 &aMatrix) |
michael@0 | 58 | { |
michael@0 | 59 | return ApplyColorMatrix_SIMD<__m128i,__m128i,__m128i>(aInput, aMatrix); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | void |
michael@0 | 63 | FilterProcessing::ApplyComposition_SSE2(DataSourceSurface* aSource, DataSourceSurface* aDest, |
michael@0 | 64 | CompositeOperator aOperator) |
michael@0 | 65 | { |
michael@0 | 66 | return ApplyComposition_SIMD<__m128i,__m128i,__m128i>(aSource, aDest, aOperator); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | void |
michael@0 | 70 | FilterProcessing::SeparateColorChannels_SSE2(const IntSize &size, uint8_t* sourceData, int32_t sourceStride, uint8_t* channel0Data, uint8_t* channel1Data, uint8_t* channel2Data, uint8_t* channel3Data, int32_t channelStride) |
michael@0 | 71 | { |
michael@0 | 72 | SeparateColorChannels_SIMD<__m128i>(size, sourceData, sourceStride, channel0Data, channel1Data, channel2Data, channel3Data, channelStride); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | void |
michael@0 | 76 | FilterProcessing::CombineColorChannels_SSE2(const IntSize &size, int32_t resultStride, uint8_t* resultData, int32_t channelStride, uint8_t* channel0Data, uint8_t* channel1Data, uint8_t* channel2Data, uint8_t* channel3Data) |
michael@0 | 77 | { |
michael@0 | 78 | CombineColorChannels_SIMD<__m128i>(size, resultStride, resultData, channelStride, channel0Data, channel1Data, channel2Data, channel3Data); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | void |
michael@0 | 82 | FilterProcessing::DoPremultiplicationCalculation_SSE2(const IntSize& aSize, |
michael@0 | 83 | uint8_t* aTargetData, int32_t aTargetStride, |
michael@0 | 84 | uint8_t* aSourceData, int32_t aSourceStride) |
michael@0 | 85 | { |
michael@0 | 86 | DoPremultiplicationCalculation_SIMD<__m128i,__m128i,__m128i>(aSize, aTargetData, aTargetStride, aSourceData, aSourceStride); |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | void |
michael@0 | 90 | FilterProcessing::DoUnpremultiplicationCalculation_SSE2( |
michael@0 | 91 | const IntSize& aSize, |
michael@0 | 92 | uint8_t* aTargetData, int32_t aTargetStride, |
michael@0 | 93 | uint8_t* aSourceData, int32_t aSourceStride) |
michael@0 | 94 | { |
michael@0 | 95 | DoUnpremultiplicationCalculation_SIMD<__m128i,__m128i>(aSize, aTargetData, aTargetStride, aSourceData, aSourceStride); |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | TemporaryRef<DataSourceSurface> |
michael@0 | 99 | FilterProcessing::RenderTurbulence_SSE2(const IntSize &aSize, const Point &aOffset, const Size &aBaseFrequency, |
michael@0 | 100 | int32_t aSeed, int aNumOctaves, TurbulenceType aType, bool aStitch, const Rect &aTileRect) |
michael@0 | 101 | { |
michael@0 | 102 | return RenderTurbulence_SIMD<__m128,__m128i,__m128i>(aSize, aOffset, aBaseFrequency, aSeed, aNumOctaves, aType, aStitch, aTileRect); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | TemporaryRef<DataSourceSurface> |
michael@0 | 106 | FilterProcessing::ApplyArithmeticCombine_SSE2(DataSourceSurface* aInput1, DataSourceSurface* aInput2, Float aK1, Float aK2, Float aK3, Float aK4) |
michael@0 | 107 | { |
michael@0 | 108 | return ApplyArithmeticCombine_SIMD<__m128i,__m128i,__m128i>(aInput1, aInput2, aK1, aK2, aK3, aK4); |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | } // namespace mozilla |
michael@0 | 112 | } // namespace gfx |