提交 cf71ee3a 编写于 作者: O openharmony_ci 提交者: Gitee

!193 支持A4\A8、LUT8、TSC图片格式作为输入

Merge pull request !193 from wangtiantian/A4A8
......@@ -130,7 +130,6 @@ public:
* @param srcStride Indicates the number of bytes in a single row of source memory
* @param srcLineNumber Indicates the number of source memory rows
* @param srcColorMode Indicates the source memory color format
* @param srcLutColorMode Indicates the source memory lut(Lookup Table) color format
* @param color 32-bit XRGB8888 value
* (valid when the source memory is in a format with only alph information such as A1)
* @param opa Indicates the transparency
......@@ -148,7 +147,6 @@ public:
uint32_t srcStride,
uint32_t srcLineNumber,
ColorMode srcColorMode,
LutColorMode srcLutColorMode,
uint32_t color,
OpacityType opa,
uint8_t* dst,
......
......@@ -62,7 +62,6 @@ public:
uint32_t srcStride,
uint32_t srcLineNumber,
ColorMode srcColorMode,
LutColorMode srcLutColorMode,
uint32_t color,
OpacityType opa,
uint8_t* dst,
......@@ -72,7 +71,7 @@ public:
uint32_t y)
{
if (device_ != nullptr) {
return device_->HardwareBlend(src, srcRect, srcStride, srcLineNumber, srcColorMode, srcLutColorMode,
return device_->HardwareBlend(src, srcRect, srcStride, srcLineNumber, srcColorMode,
color, opa, dst, dstStride, dstColorMode, x, y);
}
return false;
......
......@@ -28,32 +28,8 @@ void DrawImage::DrawCommon(BufferInfo& gfxDstBuffer, const Rect& coords, const R
}
OpacityType opa = DrawUtils::GetMixOpacity(opaScale, style.imageOpa_);
uint8_t pxBitSize = DrawUtils::GetPxSizeByColorMode(img->header.colorMode);
LutColorMode lutColorMode = LUT_UNKNOW;
uint8_t size = 0;
switch (img->header.colorMode) {
case L1:
// One index represents 1 bit, 8 : convert to bytes, 1 : 2 color values
size = (img->dataSize - (img->header.width * img->header.height / 8)) >> 1;
break;
case L2:
// One index represents 2 bit, 4 : convert to bytes, 2 : 4 color values
size = (img->dataSize - (img->header.width * img->header.height / 4)) >> 2;
break;
case L4:
// One index represents 4 bit, 2 : convert to bytes, 4 : 16 color values
size = (img->dataSize - (img->header.width * img->header.height / 2)) >> 4;
break;
case L8:
// One index represents 8 bit, 8 : 256 color values
size = (img->dataSize - (img->header.width * img->header.height)) >> 8;
break;
default:
size = 0;
break;
}
lutColorMode = DrawUtils::GetLutColorModeBySize(size);
DrawUtils::GetInstance()->DrawImage(gfxDstBuffer, coords, mask, img->data, opa, pxBitSize,
static_cast<ColorMode>(img->header.colorMode), lutColorMode);
static_cast<ColorMode>(img->header.colorMode));
}
void DrawImage::DrawCommon(BufferInfo& gfxDstBuffer, const Rect& coords, const Rect& mask,
......
......@@ -244,20 +244,6 @@ uint8_t DrawUtils::GetByteSizeByColorMode(uint8_t colorMode)
}
}
LutColorMode DrawUtils::GetLutColorModeBySize(uint8_t size)
{
switch (size) {
case 2: // 2: 2 Byte
return LUT_RGB565;
case 3: // 3: 3 Byte
return LUT_RGB888;
case 4: // 4: 4 Byte
return LUT_ARGB8888;
default:
return LUT_UNKNOW;
}
}
void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer,
int16_t x,
int16_t y,
......@@ -420,8 +406,7 @@ void DrawUtils::DrawImage(BufferInfo& gfxDstBuffer,
const uint8_t* image,
OpacityType opa,
uint8_t pxBitSize,
ColorMode colorMode,
LutColorMode LutColorMode) const
ColorMode colorMode) const
{
if (image == nullptr) {
return;
......
......@@ -175,8 +175,7 @@ public:
void DrawLetter(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const;
void DrawImage(BufferInfo& gfxDstBuffer, const Rect& area, const Rect& mask,
const uint8_t* image, OpacityType opa, uint8_t pxBitSize,
ColorMode colorMode, LutColorMode lutColorMode = LUT_UNKNOW) const;
const uint8_t* image, OpacityType opa, uint8_t pxBitSize, ColorMode colorMode) const;
static void
GetXAxisErrForJunctionLine(bool ignoreJunctionPoint, bool isRightPart, int16_t& xMinErr, int16_t& xMaxErr);
......@@ -210,8 +209,6 @@ public:
static uint8_t GetByteSizeByColorMode(uint8_t colorMode);
static LutColorMode GetLutColorModeBySize(uint8_t size);
static OpacityType GetMixOpacity(OpacityType opa1, OpacityType opa2)
{
// 8: Shift right 8 bits
......
......@@ -52,7 +52,6 @@ public:
uint32_t srcStride,
uint32_t srcLineNumber,
ColorMode srcColorMode,
LutColorMode srcLutColorMode,
uint32_t color,
OpacityType opa,
uint8_t* dst,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册