提交 d5e14f88 编写于 作者: J jsjzju

IssueNo:#I3E7W2

Description:remove bufferRect and fix incorrect rendering area
Sig:graphic
Feture or Bufix:Bugfix
Binary Source:No

Change-Id: Iadc05aaa02a5c51d401c69ae730d9e971dee4064
上级 68f6f063
...@@ -396,8 +396,12 @@ void RootView::AddInvalidateRect(Rect& rect, UIView* view) ...@@ -396,8 +396,12 @@ void RootView::AddInvalidateRect(Rect& rect, UIView* view)
invalidRects[0].Join(invalidRects[0], commonRect); invalidRects[0].Join(invalidRects[0], commonRect);
} }
#else #else
invalidRect_.Join(invalidRect_, commonRect); if (!renderFlag_) {
renderFlag_ = true; invalidRect_ = commonRect;
renderFlag_ = true;
} else {
invalidRect_.Join(invalidRect_, commonRect);
}
#endif #endif
} }
} }
...@@ -456,13 +460,16 @@ void RootView::Render() ...@@ -456,13 +460,16 @@ void RootView::Render()
pthread_mutex_lock(&lock_); pthread_mutex_lock(&lock_);
#endif #endif
Rect mask;
#if LOCAL_RENDER #if LOCAL_RENDER
if (!invalidateMap_.empty()) { if (!invalidateMap_.empty()) {
RenderManager::RenderRect(GetRect(), this); mask = GetRect();
RenderManager::RenderRect(mask, this);
invalidateMap_.clear(); invalidateMap_.clear();
#else #else
if (renderFlag_) { if (renderFlag_) {
RenderManager::RenderRect(invalidRect_, this); mask = invalidRect_;
RenderManager::RenderRect(mask, this);
invalidRect_ = {0, 0, 0, 0}; invalidRect_ = {0, 0, 0, 0};
renderFlag_ = false; renderFlag_ = false;
#endif #endif
...@@ -473,7 +480,7 @@ void RootView::Render() ...@@ -473,7 +480,7 @@ void RootView::Render()
boundWindow_->Update(); boundWindow_->Update();
} }
#endif #endif
ScreenDeviceProxy::GetInstance()->OnRenderFinish(); ScreenDeviceProxy::GetInstance()->OnRenderFinish(mask);
} }
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__ #if defined __linux__ || defined __LITEOS__ || defined __APPLE__
......
...@@ -173,34 +173,12 @@ void RenderManager::RenderRect(const Rect& rect, RootView* rootView) ...@@ -173,34 +173,12 @@ void RenderManager::RenderRect(const Rect& rect, RootView* rootView)
mask.Intersect(rect, winRect); mask.Intersect(rect, winRect);
} }
#endif #endif
int32_t bufferHeight = ScreenDeviceProxy::GetInstance()->GetScreenArea() / mask.GetWidth();
if (bufferHeight > mask.GetHeight()) {
bufferHeight = mask.GetHeight();
}
Rect& bufferRect = ScreenDeviceProxy::GetInstance()->GetBufferRect();
bufferRect.SetLeft(mask.GetLeft());
bufferRect.SetRight(mask.GetRight());
int16_t bottom = mask.GetBottom();
for (int16_t bufferTop = mask.GetTop(); bufferTop <= bottom; bufferTop += bufferHeight) {
bufferRect.SetTop(bufferTop);
int16_t bufferBottom = bufferTop + bufferHeight - 1;
if (bufferBottom >= bottom) {
bufferRect.SetBottom(bottom);
} else {
bufferRect.SetBottom(bufferBottom);
}
#if LOCAL_RENDER #if LOCAL_RENDER
rootView->DrawInvalidMap(bufferRect); rootView->DrawInvalidMap(mask);
#else #else
UIView* topView = rootView->GetTopUIView(bufferRect); UIView* topView = rootView->GetTopUIView(mask);
rootView->DrawTop(topView, bufferRect); rootView->DrawTop(topView, mask);
#endif #endif
#if !ENABLE_WINDOW
ScreenDeviceProxy::GetInstance()->Flush();
#endif
}
} }
#if ENABLE_WINDOW #if ENABLE_WINDOW
......
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
{ {
} }
virtual void RenderFinish() {} virtual void RenderFinish(const Rect& mask) {}
}; };
} // namespace OHOS } // namespace OHOS
#endif // GRAPHIC_LITE_SCREEN_DEVICE_H #endif // GRAPHIC_LITE_SCREEN_DEVICE_H
\ No newline at end of file
...@@ -19,34 +19,17 @@ ...@@ -19,34 +19,17 @@
#include "securec.h" #include "securec.h"
namespace OHOS { namespace OHOS {
#if ENABLE_FRAME_BUFFER
void ScreenDeviceProxy::Flush() {} void ScreenDeviceProxy::Flush() {}
#else
void ScreenDeviceProxy::Flush()
{
flush_.Flushing();
if (device_ != nullptr) {
#if ENABLE_WINDOW
device_->Flush(bufferRect_.GetLeft(), bufferRect_.GetTop(), bufferRect_.GetRight(), bufferRect_.GetBottom(),
gfxAlloc_.virAddr, ARGB8888);
#else
device_->Flush(bufferRect_.GetLeft(), bufferRect_.GetTop(), bufferRect_.GetRight(), bufferRect_.GetBottom(),
buffer_, ARGB8888);
#endif
}
}
#endif
void ScreenDeviceProxy::OnFlushReady() void ScreenDeviceProxy::OnFlushReady()
{ {
flush_.Notify(); flush_.Notify();
} }
void ScreenDeviceProxy::OnRenderFinish() void ScreenDeviceProxy::OnRenderFinish(const Rect& mask)
{ {
if (device_ != nullptr) { if (device_ != nullptr) {
device_->RenderFinish(); device_->RenderFinish(mask);
} }
} }
...@@ -96,22 +79,6 @@ void ScreenDeviceProxy::SetScreenSize(uint16_t width, uint16_t height) ...@@ -96,22 +79,6 @@ void ScreenDeviceProxy::SetScreenSize(uint16_t width, uint16_t height)
} }
width_ = width; width_ = width;
height_ = height; height_ = height;
#if !ENABLE_WINDOW && !ENABLE_FRAME_BUFFER
if (buffer_ != nullptr) {
UIFree(buffer_);
}
uint32_t bufSize = width * height * DrawUtils::GetByteSizeByColorMode(ARGB8888);
buffer_ = static_cast<uint8_t*>(UIMalloc(bufSize));
if (buffer_ == nullptr) {
GRAPHIC_LOGE("screen buffer malloc failed.");
return;
}
if (memset_s(buffer_, bufSize, 0, bufSize) != EOK) {
GRAPHIC_LOGE("screen buffer memset failed.");
UIFree(reinterpret_cast<void*>(buffer_));
buffer_ = nullptr;
}
#endif
} }
uint8_t* ScreenDeviceProxy::GetBuffer() uint8_t* ScreenDeviceProxy::GetBuffer()
...@@ -122,23 +89,13 @@ uint8_t* ScreenDeviceProxy::GetBuffer() ...@@ -122,23 +89,13 @@ uint8_t* ScreenDeviceProxy::GetBuffer()
GRAPHIC_LOGE("Invalid param animatorBufferAddr_."); GRAPHIC_LOGE("Invalid param animatorBufferAddr_.");
return nullptr; return nullptr;
} }
int32_t offset = bufferRect_.GetTop() * animatorBufferWidth_ + bufferRect_.GetLeft(); return animatorBufferAddr_;
offset *= DrawUtils::GetByteSizeByColorMode(animatorBufferMode_);
return animatorBufferAddr_ + offset;
} }
#if ENABLE_FRAME_BUFFER
if (frameBufferAddr_ == nullptr) { if (frameBufferAddr_ == nullptr) {
GRAPHIC_LOGE("Invalid param frameBufferAddr_."); GRAPHIC_LOGE("Invalid param frameBufferAddr_.");
return nullptr; return nullptr;
} }
int32_t offset = bufferRect_.GetTop() * frameBufferWidth_ + bufferRect_.GetLeft(); return frameBufferAddr_;
offset *= DrawUtils::GetByteSizeByColorMode(frameBufferMode_);
return frameBufferAddr_ + offset;
#elif ENABLE_WINDOW
return gfxAlloc_.virAddr;
#else
return buffer_;
#endif
} }
ColorMode ScreenDeviceProxy::GetBufferMode() ColorMode ScreenDeviceProxy::GetBufferMode()
...@@ -146,10 +103,6 @@ ColorMode ScreenDeviceProxy::GetBufferMode() ...@@ -146,10 +103,6 @@ ColorMode ScreenDeviceProxy::GetBufferMode()
if (useAnimatorBuff_) { if (useAnimatorBuff_) {
return animatorBufferMode_; return animatorBufferMode_;
} }
#if ENABLE_FRAME_BUFFER
return frameBufferMode_; return frameBufferMode_;
#else
return ARGB8888;
#endif
} }
} // namespace OHOS } // namespace OHOS
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
void OnFlushReady(); void OnFlushReady();
void OnRenderFinish(); void OnRenderFinish(const Rect& mask);
bool HardwareFill(const Rect& fillArea, bool HardwareFill(const Rect& fillArea,
uint32_t color, uint32_t color,
...@@ -108,14 +108,12 @@ public: ...@@ -108,14 +108,12 @@ public:
} }
} }
#if ENABLE_FRAME_BUFFER
void SetFramebuffer(uint8_t* addr, ColorMode mode, uint16_t width) void SetFramebuffer(uint8_t* addr, ColorMode mode, uint16_t width)
{ {
frameBufferAddr_ = addr; frameBufferAddr_ = addr;
frameBufferWidth_ = width; frameBufferWidth_ = width;
frameBufferMode_ = mode; frameBufferMode_ = mode;
} }
#endif
void SetAnimatorbuffer(uint8_t* addr, ColorMode mode, uint16_t width) void SetAnimatorbuffer(uint8_t* addr, ColorMode mode, uint16_t width)
{ {
...@@ -160,18 +158,7 @@ public: ...@@ -160,18 +158,7 @@ public:
if (useAnimatorBuff_) { if (useAnimatorBuff_) {
return animatorBufferWidth_; return animatorBufferWidth_;
} }
#if ENABLE_FRAME_BUFFER
return frameBufferWidth_; return frameBufferWidth_;
#elif ENABLE_WINDOW
return gfxAlloc_.stride / sizeof(ColorType);
#else
return bufferRect_.GetWidth();
#endif
}
Rect& GetBufferRect()
{
return bufferRect_;
} }
void SetScreenSize(uint16_t width, uint16_t height); void SetScreenSize(uint16_t width, uint16_t height);
...@@ -208,14 +195,10 @@ private: ...@@ -208,14 +195,10 @@ private:
FlushSem flush_ = FlushSem(false); FlushSem flush_ = FlushSem(false);
uint16_t width_ = HORIZONTAL_RESOLUTION; uint16_t width_ = HORIZONTAL_RESOLUTION;
uint16_t height_ = VERTICAL_RESOLUTION; uint16_t height_ = VERTICAL_RESOLUTION;
uint8_t* buffer_ = nullptr;
Rect bufferRect_;
#if ENABLE_FRAME_BUFFER
uint8_t* frameBufferAddr_ = nullptr; uint8_t* frameBufferAddr_ = nullptr;
uint16_t frameBufferWidth_ = 0; uint16_t frameBufferWidth_ = 0;
ColorMode frameBufferMode_ = ARGB8888; ColorMode frameBufferMode_ = ARGB8888;
#endif
uint8_t* animatorBufferAddr_ = nullptr; uint8_t* animatorBufferAddr_ = nullptr;
uint16_t animatorBufferWidth_ = 0; uint16_t animatorBufferWidth_ = 0;
......
...@@ -48,8 +48,7 @@ namespace OHOS { ...@@ -48,8 +48,7 @@ namespace OHOS {
} \ } \
ColorMode bufferMode = ScreenDeviceProxy::GetInstance()->GetBufferMode(); \ ColorMode bufferMode = ScreenDeviceProxy::GetInstance()->GetBufferMode(); \
uint8_t bufferPxSize = GetByteSizeByColorMode(bufferMode); \ uint8_t bufferPxSize = GetByteSizeByColorMode(bufferMode); \
uint16_t screenBufferWidth = ScreenDeviceProxy::GetInstance()->GetBufferWidth(); \ uint16_t screenBufferWidth = ScreenDeviceProxy::GetInstance()->GetBufferWidth();
Rect bufferRect = ScreenDeviceProxy::GetInstance()->GetBufferRect();
/* cover mode, src alpha is 255 */ /* cover mode, src alpha is 255 */
#define COLOR_FILL_COVER(d, dm, r2, g2, b2, sm) \ #define COLOR_FILL_COVER(d, dm, r2, g2, b2, sm) \
...@@ -185,10 +184,6 @@ void DrawUtils::DrawColorArea(const Rect& area, const Rect& mask, const ColorTyp ...@@ -185,10 +184,6 @@ void DrawUtils::DrawColorArea(const Rect& area, const Rect& mask, const ColorTyp
if (!maskedArea.Intersect(area, mask)) { if (!maskedArea.Intersect(area, mask)) {
return; return;
} }
#if !ENABLE_WINDOW
maskedArea.SetRect(maskedArea.GetLeft() - bufferRect.GetLeft(), maskedArea.GetTop() - bufferRect.GetTop(),
maskedArea.GetRight() - bufferRect.GetLeft(), maskedArea.GetBottom() - bufferRect.GetTop());
#endif
#if ENABLE_HARDWARE_ACCELERATION #if ENABLE_HARDWARE_ACCELERATION
if (ScreenDeviceProxy::GetInstance()->HardwareFill(maskedArea, Color::ColorTo32(color), opa, screenBuffer, if (ScreenDeviceProxy::GetInstance()->HardwareFill(maskedArea, Color::ColorTo32(color), opa, screenBuffer,
screenBufferWidth * bufferPxSize, bufferMode)) { screenBufferWidth * bufferPxSize, bufferMode)) {
...@@ -270,11 +265,6 @@ void DrawUtils::DrawPixel(int16_t x, int16_t y, const Rect& mask, const ColorTyp ...@@ -270,11 +265,6 @@ void DrawUtils::DrawPixel(int16_t x, int16_t y, const Rect& mask, const ColorTyp
DRAW_UTILS_PREPROCESS(opa); DRAW_UTILS_PREPROCESS(opa);
#if !ENABLE_WINDOW
x -= bufferRect.GetLeft();
y -= bufferRect.GetTop();
#endif
Color32 fillColor; Color32 fillColor;
fillColor.full = Color::ColorTo32(color); fillColor.full = Color::ColorTo32(color);
...@@ -357,13 +347,8 @@ void DrawUtils::DrawLetter(const LabelLetterInfo& letterInfo) const ...@@ -357,13 +347,8 @@ void DrawUtils::DrawLetter(const LabelLetterInfo& letterInfo) const
letterWidthInByte++; letterWidthInByte++;
} }
#if ENABLE_WINDOW
int16_t dstPosX = posX + colStart; int16_t dstPosX = posX + colStart;
int16_t dstPosY = posY + rowStart; int16_t dstPosY = posY + rowStart;
#else
int16_t dstPosX = posX + colStart - bufferRect.GetLeft();
int16_t dstPosY = posY + rowStart - bufferRect.GetTop();
#endif
#if ENABLE_HARDWARE_ACCELERATION && ENABLE_HARDWARE_ACCELERATION_FOR_TEXT #if ENABLE_HARDWARE_ACCELERATION && ENABLE_HARDWARE_ACCELERATION_FOR_TEXT
Rect srcRect(colStart, rowStart, colEnd - 1, rowEnd - 1); Rect srcRect(colStart, rowStart, colEnd - 1, rowEnd - 1);
...@@ -428,20 +413,12 @@ void DrawUtils::DrawImage(const Rect& area, ...@@ -428,20 +413,12 @@ void DrawUtils::DrawImage(const Rect& area,
} }
DRAW_UTILS_PREPROCESS(opa); DRAW_UTILS_PREPROCESS(opa);
Rect maskedArea; Rect maskedArea;
Rect originMaskedArea; if (!maskedArea.Intersect(area, mask)) {
if (!originMaskedArea.Intersect(area, mask)) {
return; return;
} }
#if ENABLE_WINDOW
maskedArea = originMaskedArea;
#else
maskedArea.SetRect(
originMaskedArea.GetLeft() - bufferRect.GetLeft(), originMaskedArea.GetTop() - bufferRect.GetTop(),
originMaskedArea.GetRight() - bufferRect.GetLeft(), originMaskedArea.GetBottom() - bufferRect.GetTop());
#endif
int16_t mapWidth = area.GetWidth(); int16_t mapWidth = area.GetWidth();
int16_t imageX = originMaskedArea.GetLeft() - area.GetLeft(); int16_t imageX = maskedArea.GetLeft() - area.GetLeft();
int16_t imageY = originMaskedArea.GetTop() - area.GetTop(); int16_t imageY = maskedArea.GetTop() - area.GetTop();
uint32_t imageWidthInByte = (static_cast<uint32_t>(mapWidth) * pxBitSize) >> SHIFT_3; uint32_t imageWidthInByte = (static_cast<uint32_t>(mapWidth) * pxBitSize) >> SHIFT_3;
if ((mapWidth * pxBitSize) & 0x7) { // 0x7 : less than 1 byte is counted as 1 byte if ((mapWidth * pxBitSize) & 0x7) { // 0x7 : less than 1 byte is counted as 1 byte
imageWidthInByte++; imageWidthInByte++;
...@@ -680,14 +657,7 @@ void DrawUtils::DrawTriangleAlphaBilinear(const TriangleScanInfo& in) ...@@ -680,14 +657,7 @@ void DrawUtils::DrawTriangleAlphaBilinear(const TriangleScanInfo& in)
int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX); int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX);
in.init.verticalU += in.init.duHorizon * diffX; in.init.verticalU += in.init.duHorizon * diffX;
in.init.verticalV += in.init.dvHorizon * diffX; in.init.verticalV += in.init.dvHorizon * diffX;
#if ENABLE_WINDOW
uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize; uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize;
#else
uint8_t* screenBuffer =
in.screenBuffer +
(((y - in.screenBufferRect.GetTop()) * in.screenBufferWidth + (xMin - in.screenBufferRect.GetLeft())) *
in.bufferPxSize);
#endif
// parameters below are Q15 fixed-point number // parameters below are Q15 fixed-point number
int32_t u = in.init.verticalU; int32_t u = in.init.verticalU;
int32_t v = in.init.verticalV; int32_t v = in.init.verticalV;
...@@ -741,14 +711,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear565(const TriangleScanInfo& in) ...@@ -741,14 +711,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear565(const TriangleScanInfo& in)
for (int16_t y = in.yMin; y <= in.yMax; y++) { for (int16_t y = in.yMin; y <= in.yMax; y++) {
int16_t xMin = FO_TO_INTEGER(in.edge1.curX); int16_t xMin = FO_TO_INTEGER(in.edge1.curX);
int16_t xMax = FO_TO_INTEGER(in.edge2.curX); int16_t xMax = FO_TO_INTEGER(in.edge2.curX);
#if ENABLE_WINDOW
uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize; uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize;
#else
uint8_t* screenBuffer =
in.screenBuffer +
(((y - in.screenBufferRect.GetTop()) * in.screenBufferWidth + (xMin - in.screenBufferRect.GetLeft())) *
in.bufferPxSize);
#endif
// parameters below are Q15 fixed-point number // parameters below are Q15 fixed-point number
int32_t u = in.init.verticalU; int32_t u = in.init.verticalU;
int32_t v = in.init.verticalV; int32_t v = in.init.verticalV;
...@@ -822,14 +785,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear888(const TriangleScanInfo& in) ...@@ -822,14 +785,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear888(const TriangleScanInfo& in)
for (int16_t y = in.yMin; y <= in.yMax; y++) { for (int16_t y = in.yMin; y <= in.yMax; y++) {
int16_t xMin = FO_TO_INTEGER(in.edge1.curX); int16_t xMin = FO_TO_INTEGER(in.edge1.curX);
int16_t xMax = FO_TO_INTEGER(in.edge2.curX); int16_t xMax = FO_TO_INTEGER(in.edge2.curX);
#if ENABLE_WINDOW
uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize; uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize;
#else
uint8_t* screenBuffer =
in.screenBuffer +
(((y - in.screenBufferRect.GetTop()) * in.screenBufferWidth + (xMin - in.screenBufferRect.GetLeft())) *
in.bufferPxSize);
#endif
// parameters below are Q15 fixed-point number // parameters below are Q15 fixed-point number
int32_t u = in.init.verticalU; int32_t u = in.init.verticalU;
int32_t v = in.init.verticalV; int32_t v = in.init.verticalV;
...@@ -1104,14 +1060,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear8888(const TriangleScanInfo& in) ...@@ -1104,14 +1060,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear8888(const TriangleScanInfo& in)
int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX); int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX);
in.init.verticalU += in.init.duHorizon * diffX; in.init.verticalU += in.init.duHorizon * diffX;
in.init.verticalV += in.init.dvHorizon * diffX; in.init.verticalV += in.init.dvHorizon * diffX;
#if ENABLE_WINDOW
uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize; uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize;
#else
uint8_t* screenBuffer =
in.screenBuffer +
(((y - in.screenBufferRect.GetTop()) * in.screenBufferWidth + (xMin - in.screenBufferRect.GetLeft())) *
in.bufferPxSize);
#endif
#ifdef ARM_NEON_OPT #ifdef ARM_NEON_OPT
{ {
float u = static_cast<float>(in.init.verticalU) / FIXED_NUM_1; float u = static_cast<float>(in.init.verticalU) / FIXED_NUM_1;
...@@ -1152,14 +1101,7 @@ void DrawUtils::DrawTriangleTrueColorNearest(const TriangleScanInfo& in) ...@@ -1152,14 +1101,7 @@ void DrawUtils::DrawTriangleTrueColorNearest(const TriangleScanInfo& in)
int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX); int16_t diffX = xMin - FO_TO_INTEGER(in.edge1.curX);
in.init.verticalU += in.init.duHorizon * diffX; in.init.verticalU += in.init.duHorizon * diffX;
in.init.verticalV += in.init.dvHorizon * diffX; in.init.verticalV += in.init.dvHorizon * diffX;
#if ENABLE_WINDOW
uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize; uint8_t* screenBuffer = in.screenBuffer + (y * in.screenBufferWidth + xMin) * in.bufferPxSize;
#else
uint8_t* screenBuffer =
in.screenBuffer +
(((y - in.screenBufferRect.GetTop()) * in.screenBufferWidth + (xMin - in.screenBufferRect.GetLeft())) *
in.bufferPxSize);
#endif
// parameters below are Q15 fixed-point number // parameters below are Q15 fixed-point number
int32_t u = in.init.verticalU; int32_t u = in.init.verticalU;
int32_t v = in.init.verticalV; int32_t v = in.init.verticalV;
...@@ -1247,7 +1189,6 @@ void DrawUtils::DrawTriangleTransformPart(const TrianglePartInfo& part) ...@@ -1247,7 +1189,6 @@ void DrawUtils::DrawTriangleTransformPart(const TrianglePartInfo& part)
if (screenBuffer == nullptr) { if (screenBuffer == nullptr) {
return; return;
} }
Rect bufferRect = ScreenDeviceProxy::GetInstance()->GetBufferRect();
uint8_t pixelSize; uint8_t pixelSize;
DrawTriangleTransformFuc fuc; DrawTriangleTransformFuc fuc;
bool isTrueColor = (part.info.header.colorMode == ARGB8888) || (part.info.header.colorMode == RGB888) || bool isTrueColor = (part.info.header.colorMode == ARGB8888) || (part.info.header.colorMode == RGB888) ||
...@@ -1274,7 +1215,6 @@ void DrawUtils::DrawTriangleTransformPart(const TrianglePartInfo& part) ...@@ -1274,7 +1215,6 @@ void DrawUtils::DrawTriangleTransformPart(const TrianglePartInfo& part)
part.edge2, part.edge2,
screenBuffer, screenBuffer,
bufferPxSize, bufferPxSize,
bufferRect,
part.color, part.color,
part.opaScale, part.opaScale,
init, init,
...@@ -1491,14 +1431,6 @@ void DrawUtils::FillArea(const Rect& rect, const Rect& mask, bool isTransparent, ...@@ -1491,14 +1431,6 @@ void DrawUtils::FillArea(const Rect& rect, const Rect& mask, bool isTransparent,
int16_t top = maskedArea.GetTop(); int16_t top = maskedArea.GetTop();
int16_t bottom = maskedArea.GetBottom(); int16_t bottom = maskedArea.GetBottom();
#if !ENABLE_WINDOW
Rect bufferRect = ScreenDeviceProxy::GetInstance()->GetBufferRect();
maskedArea.SetLeft(left - bufferRect.GetLeft());
maskedArea.SetRight(right - bufferRect.GetLeft());
maskedArea.SetTop(top - bufferRect.GetTop());
maskedArea.SetBottom(bottom - bufferRect.GetTop());
#endif
uint16_t screenBufferWidth = ScreenDeviceProxy::GetInstance()->GetBufferWidth(); uint16_t screenBufferWidth = ScreenDeviceProxy::GetInstance()->GetBufferWidth();
uint8_t* mem = ScreenDeviceProxy::GetInstance()->GetBuffer(); uint8_t* mem = ScreenDeviceProxy::GetInstance()->GetBuffer();
ColorMode bufferMode = ScreenDeviceProxy::GetInstance()->GetBufferMode(); ColorMode bufferMode = ScreenDeviceProxy::GetInstance()->GetBufferMode();
...@@ -1547,15 +1479,11 @@ void DrawUtils::DrawAdjPixelInLine(int16_t x1, ...@@ -1547,15 +1479,11 @@ void DrawUtils::DrawAdjPixelInLine(int16_t x1,
Color32 result; Color32 result;
result.full = Color::ColorTo32(color); result.full = Color::ColorTo32(color);
if ((x1 >= mask.GetLeft()) && (x1 <= mask.GetRight()) && (y1 >= mask.GetTop()) && (y1 <= mask.GetBottom())) { if ((x1 >= mask.GetLeft()) && (x1 <= mask.GetRight()) && (y1 >= mask.GetTop()) && (y1 <= mask.GetBottom())) {
x1 -= bufferRect.GetLeft();
y1 -= bufferRect.GetTop();
screenBuffer += (y1 * screenBufferWidth + x1) * bufferPxSize; screenBuffer += (y1 * screenBufferWidth + x1) * bufferPxSize;
OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE; OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE;
COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa); COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa);
} }
if ((x2 >= mask.GetLeft()) && (x2 <= mask.GetRight()) && (y2 >= mask.GetTop()) && (y2 <= mask.GetBottom())) { if ((x2 >= mask.GetLeft()) && (x2 <= mask.GetRight()) && (y2 >= mask.GetTop()) && (y2 <= mask.GetBottom())) {
x2 -= bufferRect.GetLeft();
y2 -= bufferRect.GetTop();
screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer(); screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer();
screenBuffer += (y2 * screenBufferWidth + x2) * bufferPxSize; screenBuffer += (y2 * screenBufferWidth + x2) * bufferPxSize;
OpacityType fillOpa = weight * opa / OPA_OPAQUE; OpacityType fillOpa = weight * opa / OPA_OPAQUE;
...@@ -1574,8 +1502,6 @@ void DrawUtils::DrawPixelInLine(int16_t x, ...@@ -1574,8 +1502,6 @@ void DrawUtils::DrawPixelInLine(int16_t x,
Color32 result; Color32 result;
result.full = Color::ColorTo32(color); result.full = Color::ColorTo32(color);
if ((x >= mask.GetLeft()) && (x <= mask.GetRight()) && (y >= mask.GetTop()) && (y <= mask.GetBottom())) { if ((x >= mask.GetLeft()) && (x <= mask.GetRight()) && (y >= mask.GetTop()) && (y <= mask.GetBottom())) {
x -= bufferRect.GetLeft();
y -= bufferRect.GetTop();
screenBuffer += (y * screenBufferWidth + x) * bufferPxSize; screenBuffer += (y * screenBufferWidth + x) * bufferPxSize;
OpacityType fillOpa = weight * opa / OPA_OPAQUE; OpacityType fillOpa = weight * opa / OPA_OPAQUE;
COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa); COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa);
...@@ -1598,15 +1524,12 @@ void DrawUtils::DrawVerPixelInLine(int16_t x, ...@@ -1598,15 +1524,12 @@ void DrawUtils::DrawVerPixelInLine(int16_t x,
result.full = Color::ColorTo32(color); result.full = Color::ColorTo32(color);
int16_t x0 = x + dir; int16_t x0 = x + dir;
int16_t x1 = x - dir; int16_t x1 = x - dir;
y -= bufferRect.GetTop();
if ((x0 >= mask.GetLeft()) && (x0 <= mask.GetRight())) { if ((x0 >= mask.GetLeft()) && (x0 <= mask.GetRight())) {
x0 -= bufferRect.GetLeft();
screenBuffer += (y * screenBufferWidth + x0) * bufferPxSize; screenBuffer += (y * screenBufferWidth + x0) * bufferPxSize;
OpacityType fillOpa = weight * opa / OPA_OPAQUE; OpacityType fillOpa = weight * opa / OPA_OPAQUE;
COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa); COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa);
} }
if ((x >= mask.GetLeft()) && (x <= mask.GetRight())) { if ((x >= mask.GetLeft()) && (x <= mask.GetRight())) {
x -= bufferRect.GetLeft();
screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer(); screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer();
screenBuffer += (y * screenBufferWidth + x) * bufferPxSize; screenBuffer += (y * screenBufferWidth + x) * bufferPxSize;
if (opa == OPA_OPAQUE) { if (opa == OPA_OPAQUE) {
...@@ -1616,7 +1539,6 @@ void DrawUtils::DrawVerPixelInLine(int16_t x, ...@@ -1616,7 +1539,6 @@ void DrawUtils::DrawVerPixelInLine(int16_t x,
} }
} }
if ((x1 >= mask.GetLeft()) && (x1 <= mask.GetRight())) { if ((x1 >= mask.GetLeft()) && (x1 <= mask.GetRight())) {
x1 -= bufferRect.GetLeft();
screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer(); screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer();
screenBuffer += (y * screenBufferWidth + x1) * bufferPxSize; screenBuffer += (y * screenBufferWidth + x1) * bufferPxSize;
OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE; OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE;
...@@ -1640,15 +1562,12 @@ void DrawUtils::DrawHorPixelInLine(int16_t x, ...@@ -1640,15 +1562,12 @@ void DrawUtils::DrawHorPixelInLine(int16_t x,
result.full = Color::ColorTo32(color); result.full = Color::ColorTo32(color);
int16_t y0 = y + dir; int16_t y0 = y + dir;
int16_t y1 = y - dir; int16_t y1 = y - dir;
x -= bufferRect.GetLeft();
if ((y0 >= mask.GetTop()) && (y0 <= mask.GetBottom())) { if ((y0 >= mask.GetTop()) && (y0 <= mask.GetBottom())) {
y0 -= bufferRect.GetTop();
screenBuffer += (y0 * screenBufferWidth + x) * bufferPxSize; screenBuffer += (y0 * screenBufferWidth + x) * bufferPxSize;
OpacityType fillOpa = weight * opa / OPA_OPAQUE; OpacityType fillOpa = weight * opa / OPA_OPAQUE;
COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa); COLOR_FILL_BLEND(screenBuffer, bufferMode, &result, ARGB8888, fillOpa);
} }
if ((y >= mask.GetTop()) && (y <= mask.GetBottom())) { if ((y >= mask.GetTop()) && (y <= mask.GetBottom())) {
y -= bufferRect.GetTop();
screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer(); screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer();
screenBuffer += (y * screenBufferWidth + x) * bufferPxSize; screenBuffer += (y * screenBufferWidth + x) * bufferPxSize;
if (opa == OPA_OPAQUE) { if (opa == OPA_OPAQUE) {
...@@ -1658,7 +1577,6 @@ void DrawUtils::DrawHorPixelInLine(int16_t x, ...@@ -1658,7 +1577,6 @@ void DrawUtils::DrawHorPixelInLine(int16_t x,
} }
} }
if ((y1 >= mask.GetTop()) && (y1 <= mask.GetBottom())) { if ((y1 >= mask.GetTop()) && (y1 <= mask.GetBottom())) {
y1 -= bufferRect.GetTop();
screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer(); screenBuffer = ScreenDeviceProxy::GetInstance()->GetBuffer();
screenBuffer += (y1 * screenBufferWidth + x) * bufferPxSize; screenBuffer += (y1 * screenBufferWidth + x) * bufferPxSize;
OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE; OpacityType fillOpa = (weight ^ OPA_OPAQUE) * opa / OPA_OPAQUE;
......
...@@ -133,7 +133,6 @@ struct TriangleScanInfo { ...@@ -133,7 +133,6 @@ struct TriangleScanInfo {
TriangleEdge& edge2; TriangleEdge& edge2;
uint8_t* screenBuffer; uint8_t* screenBuffer;
uint8_t bufferPxSize; uint8_t bufferPxSize;
Rect screenBufferRect;
const ColorType& color; const ColorType& color;
const OpacityType opaScale; const OpacityType opaScale;
TransformInitState& init; TransformInitState& init;
......
...@@ -223,5 +223,6 @@ void WindowImpl::UpdateHalDisplayBuffer() ...@@ -223,5 +223,6 @@ void WindowImpl::UpdateHalDisplayBuffer()
gfxAlloc.width = config_.rect.GetWidth(); gfxAlloc.width = config_.rect.GetWidth();
gfxAlloc.height = config_.rect.GetHeight(); gfxAlloc.height = config_.rect.GetHeight();
gfxAlloc.pixelFormat = IMAGE_PIXEL_FORMAT_ARGB8888; gfxAlloc.pixelFormat = IMAGE_PIXEL_FORMAT_ARGB8888;
ScreenDeviceProxy::GetInstance()->SetFramebuffer(gfxAlloc.virAddr, ARGB8888, gfxAlloc.stride / sizeof(uint32_t));
} }
} // namespace OHOS } // namespace OHOS
...@@ -25,38 +25,11 @@ ...@@ -25,38 +25,11 @@
#include "mouse_input.h" #include "mouse_input.h"
namespace OHOS { namespace OHOS {
void Monitor::Flush(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const uint8_t* buffer, ColorMode mode)
{
if (buffer == nullptr) {
ScreenDeviceProxy::GetInstance()->OnFlushReady();
return;
}
if ((x1 < 0) || (y1 < 0) || (x2 > HORIZONTAL_RESOLUTION - 1) || (y2 > VERTICAL_RESOLUTION - 1)) {
ScreenDeviceProxy::GetInstance()->OnFlushReady();
return;
}
int32_t x, y;
if (mode == ARGB8888) {
const Color32* tmp = reinterpret_cast<const Color32*>(buffer);
for (y = y1; y <= y2; y++) {
for (x = x1; x <= x2; x++) {
tftFb_[y * HORIZONTAL_RESOLUTION + x] = tmp->full;
tmp++;
}
}
}
ScreenDeviceProxy::GetInstance()->OnFlushReady();
}
void Monitor::InitHal() void Monitor::InitHal()
{ {
ScreenDeviceProxy::GetInstance()->SetScreenSize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); ScreenDeviceProxy::GetInstance()->SetScreenSize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
#if ENABLE_FRAME_BUFFER
ScreenDeviceProxy::GetInstance()->SetFramebuffer(reinterpret_cast<uint8_t*>(tftFb_), ARGB8888, ScreenDeviceProxy::GetInstance()->SetFramebuffer(reinterpret_cast<uint8_t*>(tftFb_), ARGB8888,
HORIZONTAL_RESOLUTION); HORIZONTAL_RESOLUTION);
#endif
ScreenDeviceProxy::GetInstance()->SetAnimatorbuffer(reinterpret_cast<uint8_t*>(animaterBuffer_), ARGB8888, ScreenDeviceProxy::GetInstance()->SetAnimatorbuffer(reinterpret_cast<uint8_t*>(animaterBuffer_), ARGB8888,
HORIZONTAL_RESOLUTION); HORIZONTAL_RESOLUTION);
Monitor* display = Monitor::GetInstance(); Monitor* display = Monitor::GetInstance();
...@@ -73,7 +46,7 @@ void Monitor::InitHal() ...@@ -73,7 +46,7 @@ void Monitor::InitHal()
#endif #endif
} }
void Monitor::RenderFinish() void Monitor::RenderFinish(const Rect& mask)
{ {
UpdatePaint(tftFb_, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); UpdatePaint(tftFb_, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
} }
......
...@@ -31,7 +31,6 @@ public: ...@@ -31,7 +31,6 @@ public:
static Monitor instance; static Monitor instance;
return &instance; return &instance;
} }
void Flush(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const uint8_t* buffer, ColorMode mode) override;
void InitHal(); void InitHal();
void InitFontEngine(); void InitFontEngine();
void InitImageDecodeAbility(); void InitImageDecodeAbility();
...@@ -39,7 +38,7 @@ public: ...@@ -39,7 +38,7 @@ public:
void GUILoopStart() const; void GUILoopStart() const;
void GUIRefresh(); void GUIRefresh();
void GUILoopQuit() const; void GUILoopQuit() const;
void RenderFinish() override; void RenderFinish(const Rect& mask) override;
signals: signals:
void UpdatePaintSignal(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight); void UpdatePaintSignal(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册