1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _MOZILLA_GFX_IMAGESCALING_H
8 #define _MOZILLA_GFX_IMAGESCALING_H
18 class ImageHalfScaler
{
20 ImageHalfScaler(uint8_t* aData
, int32_t aStride
, const IntSize
& aSize
)
24 mDataStorage(nullptr),
28 ~ImageHalfScaler() { delete[] mDataStorage
; }
30 void ScaleForSize(const IntSize
& aSize
);
32 uint8_t* GetScaledData() const { return mData
; }
33 IntSize
GetSize() const { return mSize
; }
34 uint32_t GetStride() const { return mStride
; }
37 void HalfImage2D(uint8_t* aSource
, int32_t aSourceStride
,
38 const IntSize
& aSourceSize
, uint8_t* aDest
,
39 uint32_t aDestStride
);
40 void HalfImageVertical(uint8_t* aSource
, int32_t aSourceStride
,
41 const IntSize
& aSourceSize
, uint8_t* aDest
,
42 uint32_t aDestStride
);
43 void HalfImageHorizontal(uint8_t* aSource
, int32_t aSourceStride
,
44 const IntSize
& aSourceSize
, uint8_t* aDest
,
45 uint32_t aDestStride
);
47 // This is our SSE2 scaling function. Our destination must always be 16-byte
48 // aligned and use a 16-byte aligned stride.
49 void HalfImage2D_SSE2(uint8_t* aSource
, int32_t aSourceStride
,
50 const IntSize
& aSourceSize
, uint8_t* aDest
,
51 uint32_t aDestStride
);
52 void HalfImageVertical_SSE2(uint8_t* aSource
, int32_t aSourceStride
,
53 const IntSize
& aSourceSize
, uint8_t* aDest
,
54 uint32_t aDestStride
);
55 void HalfImageHorizontal_SSE2(uint8_t* aSource
, int32_t aSourceStride
,
56 const IntSize
& aSourceSize
, uint8_t* aDest
,
57 uint32_t aDestStride
);
59 void HalfImage2D_C(uint8_t* aSource
, int32_t aSourceStride
,
60 const IntSize
& aSourceSize
, uint8_t* aDest
,
61 uint32_t aDestStride
);
62 void HalfImageVertical_C(uint8_t* aSource
, int32_t aSourceStride
,
63 const IntSize
& aSourceSize
, uint8_t* aDest
,
64 uint32_t aDestStride
);
65 void HalfImageHorizontal_C(uint8_t* aSource
, int32_t aSourceStride
,
66 const IntSize
& aSourceSize
, uint8_t* aDest
,
67 uint32_t aDestStride
);
73 uint8_t* mDataStorage
;
74 // Guaranteed 16-byte aligned
77 // Guaranteed 16-byte aligned
82 } // namespace mozilla