Migrate to TouchGFX 4.22.0

This commit is contained in:
2023-07-24 18:54:12 +02:00
parent 61729b302c
commit 90b55ffa1c
1032 changed files with 1754 additions and 111124 deletions

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -284,6 +284,32 @@ public:
*/
void enableTextureMapperA4_NearestNeighbor();
/**
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
* This allows drawing L4, RLE and LZW9 compressed L8 images.
*
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
*/
void enableDecompressorL8_All();
/**
* Enables the decompressor for L8 images compressed with the L4 algorithm.
* This allows drawing L4 compressed L8 images.
*/
void enableDecompressorL8_L4();
/**
* Enables the decompressor for L8 images compressed with the RLE algorithm.
* This allows drawing RLE compressed L8 images.
*/
void enableDecompressorL8_RLE();
/**
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
* This allows drawing LZW9 compressed L8 images.
*/
void enableDecompressorL8_LZW9();
protected:
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
@ -361,7 +387,7 @@ protected:
* @param alpha The alpha value to use for blending applied to the whole image (255 =
* solid, no blending)
*/
static void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
/**
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
@ -837,6 +863,61 @@ private:
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapStride, const uint8_t UFrac, const uint8_t VFrac) const;
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
};
class DecompressorL8Base
{
public:
virtual ~DecompressorL8Base()
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
};
class DecompressorL8_L4 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
uint16_t blendPixelRGB565(uint16_t imagePixel, uint16_t fbPixel, int alpha, int ialpha) const;
uint16_t blendPixelARGB8888(uint32_t imagePixel, uint16_t fbPixel, int alpha, uint8_t alphapix) const;
uint16_t blendPixelRGB888(const uint8_t* imagePixel, uint16_t fbPixel, uint8_t alpha, uint8_t ialpha) const;
};
class DecompressorL8_RLE : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t BLOCK_SIZE = 1024U;
};
class DecompressorL8_LZW9 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t MAX_DICT_SIZE = 512U;
static const uint16_t BLOCK_SIZE = 1024U;
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
};
DecompressorL8Base* decompressorL8_L4;
DecompressorL8Base* decompressorL8_RLE;
DecompressorL8Base* decompressorL8_LZW9;
};
} // namespace touchgfx

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -289,6 +289,32 @@ public:
*/
void enableTextureMapperA4_NearestNeighbor();
/**
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
* This allows drawing L4, RLE and LZW9 compressed L8 images.
*
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
*/
void enableDecompressorL8_All();
/**
* Enables the decompressor for L8 images compressed with the L4 algorithm.
* This allows drawing L4 compressed L8 images.
*/
void enableDecompressorL8_L4();
/**
* Enables the decompressor for L8 images compressed with the RLE algorithm.
* This allows drawing RLE compressed L8 images.
*/
void enableDecompressorL8_RLE();
/**
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
* This allows drawing LZW9 compressed L8 images.
*/
void enableDecompressorL8_LZW9();
protected:
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
@ -812,6 +838,109 @@ private:
FORCE_INLINE_FUNCTION void writePixel(uint16_t* const destBits, const uint16_t* const textureBits, const uint32_t offset, const int16_t bitmapWidth, const uint8_t UFrac, const uint8_t VFrac) const;
void writePixelOnEdge(uint16_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
};
class FlashDataProvider
{
public:
FlashDataProvider(FlashDataReader& _flashReader);
void initialize(const uint8_t* _sourceData, uint32_t _maxBytesToRead);
bool addressIsAddressable(const void* address) const;
void increment();
uint8_t getCurrent() const
{
return *currentBytePtr;
}
private:
void readFromFlash();
FlashDataReader& flashReader;
const uint8_t* sourceData;
uint32_t maxBytesToRead;
uint32_t bytesToRead;
const uint8_t* bufferEnd;
const uint8_t* currentBytePtr;
bool isAddressable;
static const uint16_t MAX_BYTES_TO_READ = 64;
};
class DecompressorL8Base
{
public:
virtual ~DecompressorL8Base()
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
};
class DecompressorL8_L4 : public DecompressorL8Base
{
public:
DecompressorL8_L4(FlashDataReader& _flashReader)
: flashReader(_flashReader)
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
uint16_t blendPixelRGB565(uint16_t imagePixel, uint16_t fbPixel, int alpha, int ialpha) const;
uint16_t blendPixelARGB8888(uint32_t imagePixel, uint16_t fbPixel, int alpha, uint8_t alphapix) const;
FlashDataReader& flashReader;
};
class DecompressorL8_RLE : public DecompressorL8Base
{
public:
DecompressorL8_RLE(FlashDataReader& _flashReader)
: flashDataProvider(_flashReader)
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
FlashDataProvider flashDataProvider;
static const uint16_t BLOCK_SIZE = 1024U;
};
class DecompressorL8_LZW9 : public DecompressorL8Base
{
public:
DecompressorL8_LZW9(FlashDataReader& _flashReader)
: flashDataProvider(_flashReader)
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
FlashDataProvider flashDataProvider;
static const uint16_t MAX_DICT_SIZE = 512U;
static const uint16_t BLOCK_SIZE = 1024U;
struct LZW9DictionaryEntry
{
uint8_t character; // Current character of the entry
uint8_t length; // Remaining length of the entry
uint16_t prefixIndex; // Index to previous character
};
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
};
DecompressorL8Base* decompressorL8_L4;
DecompressorL8Base* decompressorL8_RLE;
DecompressorL8Base* decompressorL8_LZW9;
};
} // namespace touchgfx

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -263,14 +263,14 @@ private:
uint8_t getNextHalfByte()
{
assert(data != 0 && "class bwRLEdata not properly initialized");
if (firstHalfByte) // Start of new byte, read data from BW_RLE stream
{
assert(data);
rleByte = *data++;
}
uint8_t len = rleByte & 0xF; // Read lower half
rleByte >>= 4; // Shift upper half down to make it ready
firstHalfByte = !firstHalfByte; // Toggle 'start of byte'
const uint8_t len = rleByte & 0xF; // Read lower half
rleByte >>= 4; // Shift upper half down to make it ready
firstHalfByte = !firstHalfByte; // Toggle 'start of byte'
return len;
}

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -26,6 +26,8 @@
namespace touchgfx
{
struct GlyphNode;
/**
* This class contains the various low-level drawing routines for drawing bitmaps, texts and
* rectangles on 16 bits per pixel displays.
@ -213,6 +215,32 @@ public:
*/
void enableTextureMapperA4_NearestNeighbor();
/**
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
* This allows drawing L4, RLE and LZW9 compressed L8 images.
*
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
*/
void enableDecompressorL8_All();
/**
* Enables the decompressor for L8 images compressed with the L4 algorithm.
* This allows drawing L4 compressed L8 images.
*/
void enableDecompressorL8_L4();
/**
* Enables the decompressor for L8 images compressed with the RLE algorithm.
* This allows drawing RLE compressed L8 images.
*/
void enableDecompressorL8_RLE();
/**
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
* This allows drawing LZW9 compressed L8 images.
*/
void enableDecompressorL8_LZW9();
protected:
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
@ -278,7 +306,7 @@ protected:
* @param alpha The alpha value to use for blending applied to the whole image (255 =
* solid, no blending)
*/
static void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
/**
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
@ -580,6 +608,63 @@ private:
FORCE_INLINE_FUNCTION void writePixel(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
void writePixelOnEdge(uint8_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
};
class DecompressorL8Base
{
public:
virtual ~DecompressorL8Base()
{
}
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
};
class DecompressorL8_L4 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
void blendPixelRGB888(const uint8_t* imagePixel, uint8_t* const fbPixel, int alpha) const;
void blendPixelARGB8888(const uint8_t* imagePixel, uint8_t* const fbPixel, int alpha, uint8_t alphapix) const;
};
class DecompressorL8_RLE : public DecompressorL8Base
{
public:
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t BLOCK_SIZE = 1024U;
};
class DecompressorL8_LZW9 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t MAX_DICT_SIZE = 512U;
static const uint16_t BLOCK_SIZE = 1024U;
struct LZW9DictionaryEntry
{
uint8_t character; // Current character of the entry
uint8_t length; // Remaining length of the entry
uint16_t prefixIndex; // Index to previous character
};
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
};
DecompressorL8Base* decompressorL8_L4;
DecompressorL8Base* decompressorL8_RLE;
DecompressorL8Base* decompressorL8_LZW9;
};
} // namespace touchgfx

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -279,6 +279,32 @@ public:
*/
void enableTextureMapperA4_NearestNeighbor();
/**
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
* This allows drawing L4, RLE and LZW9 compressed L8 images.
*
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
*/
void enableDecompressorL8_All();
/**
* Enables the decompressor for L8 images compressed with the L4 algorithm.
* This allows drawing L4 compressed L8 images.
*/
void enableDecompressorL8_L4();
/**
* Enables the decompressor for L8 images compressed with the RLE algorithm.
* This allows drawing RLE compressed L8 images.
*/
void enableDecompressorL8_RLE();
/**
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
* This allows drawing LZW9 compressed L8 images.
*/
void enableDecompressorL8_LZW9();
protected:
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
@ -344,7 +370,7 @@ protected:
* @param alpha The alpha value to use for blending applied to the whole image (255 =
* solid, no blending)
*/
static void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
/**
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
@ -897,6 +923,61 @@ private:
FORCE_INLINE_FUNCTION void writePixel(uint32_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
void writePixelOnEdge(uint32_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
};
class DecompressorL8Base
{
public:
virtual ~DecompressorL8Base()
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
};
class DecompressorL8_L4 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
void blendPixelRGB565(const uint16_t imagePixel, uint32_t* fbPixel, const uint8_t alpha) const;
void blendPixelARGB8888(const uint8_t* imagePixel, uint32_t* fbPixel, const uint8_t alpha, const uint8_t alphapix) const;
void blendPixelRGB888(const uint8_t* imagePixel, uint32_t* fbPixel, const uint8_t alpha) const;
};
class DecompressorL8_RLE : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t BLOCK_SIZE = 1024U;
};
class DecompressorL8_LZW9 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t MAX_DICT_SIZE = 512U;
static const uint16_t BLOCK_SIZE = 1024U;
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
};
DecompressorL8Base* decompressorL8_L4;
DecompressorL8Base* decompressorL8_RLE;
DecompressorL8Base* decompressorL8_LZW9;
};
} // namespace touchgfx

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@ -381,6 +381,32 @@ public:
return blendRGBwithXrgb8888(r | (r >> 5), g | (g >> 6), b | (b >> 5), bgXRGB8888, fgAlpha, bgAlpha);
}
/**
* Enables all the decompressors available for L8 images (L4, RLE and LZW9).
* This allows drawing L4, RLE and LZW9 compressed L8 images.
*
* @see enableDecompressorL8_L4, enableDecompressorL8_RLE, enableDecompressorL8_LZW9
*/
void enableDecompressorL8_All();
/**
* Enables the decompressor for L8 images compressed with the L4 algorithm.
* This allows drawing L4 compressed L8 images.
*/
void enableDecompressorL8_L4();
/**
* Enables the decompressor for L8 images compressed with the RLE algorithm.
* This allows drawing RLE compressed L8 images.
*/
void enableDecompressorL8_RLE();
/**
* Enables the decompressor for L8 images compressed with the LZW9 algorithm.
* This allows drawing LZW9 compressed L8 images.
*/
void enableDecompressorL8_LZW9();
protected:
virtual DrawTextureMapScanLineBase* getTextureMapperDrawScanLine(const TextureSurface& texture, RenderingVariant renderVariant, uint8_t alpha);
@ -446,7 +472,7 @@ protected:
* @param alpha The alpha value to use for blending applied to the whole image (255 =
* solid, no blending)
*/
static void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
void blitCopyL8(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
/**
* Blits a 2D indexed 8-bit source to the framebuffer performing alpha-blending per
@ -884,6 +910,61 @@ private:
FORCE_INLINE_FUNCTION void writePixel(uint32_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
void writePixelOnEdge(uint32_t* const destBits, const uint16_t* const textureBits, const int16_t bitmapStride, const int16_t bitmapWidth, const int16_t bitmapHeight, const int UInt, const int VInt, const uint8_t UFrac, const uint8_t VFrac) const;
};
class DecompressorL8Base
{
public:
virtual ~DecompressorL8Base()
{
}
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha) = 0;
};
class DecompressorL8_L4 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
void blendPixelRGB565(const uint16_t imagePixel, uint32_t* fbPixel, const uint8_t alpha, const uint8_t ialpha) const;
void blendPixelARGB8888(const uint8_t* imagePixel, uint32_t* fbPixel, const uint8_t alpha) const;
void blendPixelRGB888(const uint8_t* imagePixel, uint32_t* fbPixel, const uint8_t alpha, const uint8_t ialpha) const;
};
class DecompressorL8_RLE : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t BLOCK_SIZE = 1024U;
};
class DecompressorL8_LZW9 : public DecompressorL8Base
{
public:
virtual void blitCopyRGB565(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyRGB888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
virtual void blitCopyARGB8888(const uint8_t* sourceData, const uint8_t* clutData, const Rect& source, const Rect& blitRect, uint8_t alpha);
private:
static const uint16_t MAX_DICT_SIZE = 512U;
static const uint16_t BLOCK_SIZE = 1024U;
LZW9DictionaryEntry lzw9Dictionary[MAX_DICT_SIZE];
uint8_t entryBuffer[64]; // Having 64byte max entry sizes entails 1 + 2 + ... + 63 + 64 = 2080px size image blocks
};
DecompressorL8Base* decompressorL8_L4;
DecompressorL8Base* decompressorL8_RLE;
DecompressorL8Base* decompressorL8_LZW9;
};
} // namespace touchgfx

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2018(-2023) STMicroelectronics.
* All rights reserved.
*
* This file is part of the TouchGFX 4.21.2 distribution.
* This file is part of the TouchGFX 4.22.0 distribution.
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.