From 6b19319fa2ee8248caa4959478fc32836e84c965 Mon Sep 17 00:00:00 2001 From: niulihua Date: Tue, 11 May 2021 09:59:51 +0800 Subject: [PATCH] fix codex and review --- frameworks/common/image.cpp | 6 +- frameworks/common/screen.cpp | 12 +-- frameworks/components/root_view.cpp | 63 ++++++--------- frameworks/components/ui_analog_clock.cpp | 10 ++- frameworks/components/ui_arc_label.cpp | 2 +- frameworks/components/ui_axis.cpp | 9 ++- frameworks/components/ui_box_progress.cpp | 26 ++++--- frameworks/components/ui_button.cpp | 3 +- frameworks/components/ui_canvas.cpp | 36 +++++---- frameworks/components/ui_chart.cpp | 6 +- frameworks/components/ui_checkbox.cpp | 14 +++- frameworks/components/ui_circle_progress.cpp | 4 +- frameworks/components/ui_image_view.cpp | 4 +- frameworks/components/ui_label.cpp | 3 +- frameworks/components/ui_label_button.cpp | 3 +- frameworks/components/ui_radio_button.cpp | 9 ++- frameworks/components/ui_toggle_button.cpp | 8 +- frameworks/components/ui_view.cpp | 7 +- frameworks/core/render_manager.cpp | 1 - frameworks/dock/screen_device.h | 8 +- frameworks/dock/screen_device_proxy.cpp | 6 +- frameworks/draw/draw_arc.cpp | 12 ++- frameworks/draw/draw_arc.h | 7 +- frameworks/draw/draw_curve.h | 2 +- frameworks/draw/draw_label.cpp | 3 +- frameworks/draw/draw_label.h | 10 ++- frameworks/draw/draw_line.cpp | 44 ++++++----- frameworks/draw/draw_line.h | 2 +- frameworks/draw/draw_rect.cpp | 2 +- frameworks/draw/draw_rect.h | 2 +- frameworks/draw/draw_triangle.cpp | 7 +- frameworks/draw/draw_triangle.h | 2 +- frameworks/draw/draw_utils.cpp | 26 +++++-- frameworks/draw/draw_utils.h | 2 +- frameworks/engines/gfx/gfx_engine_manager.cpp | 40 ++++++---- .../engines/gfx/hi3516/hi3516_engine.cpp | 8 +- frameworks/window/window_impl.cpp | 1 - frameworks/window/window_impl.h | 13 +++- .../engines/gfx/gfx_engine_manager.h | 28 ++----- interfaces/kits/common/image.h | 8 +- interfaces/kits/components/root_view.h | 34 +++++++- interfaces/kits/components/ui_box_progress.h | 17 +++- interfaces/kits/components/ui_canvas.h | 77 ++++++++++++++----- interfaces/kits/components/ui_checkbox.h | 12 ++- interfaces/kits/components/ui_view.h | 3 +- .../ui_test_view_scale_rotate.cpp | 1 - .../ui_test_view_scale_rotate.h | 11 +-- .../qt/simulator/drivers/display/monitor.cpp | 9 ++- tools/qt/simulator/drivers/display/monitor.h | 11 ++- tools/qt/simulator/libui/libui.pro | 2 - tools/qt/simulator/uitest/UITest.pro | 5 +- 51 files changed, 405 insertions(+), 236 deletions(-) diff --git a/frameworks/common/image.cpp b/frameworks/common/image.cpp index 0c5fad3..e88e5fc 100755 --- a/frameworks/common/image.cpp +++ b/frameworks/common/image.cpp @@ -224,7 +224,11 @@ bool Image::SetSrc(const ImageInfo* src) return true; } -void Image::DrawImage(BufferInfo& gfxDstBuffer, const Rect& coords, const Rect& mask, const Style& style, uint8_t opaScale) const +void Image::DrawImage(BufferInfo& gfxDstBuffer, + const Rect& coords, + const Rect& mask, + const Style& style, + uint8_t opaScale) const { if (srcType_ == IMG_SRC_VARIABLE) { DrawImage::DrawCommon(gfxDstBuffer, coords, mask, imageInfo_, style, opaScale); diff --git a/frameworks/common/screen.cpp b/frameworks/common/screen.cpp index f3fc006..84d027e 100755 --- a/frameworks/common/screen.cpp +++ b/frameworks/common/screen.cpp @@ -15,8 +15,8 @@ #include "common/screen.h" #include "core/render_manager.h" -#include "engines/gfx/gfx_engine_manager.h" #include "draw/draw_utils.h" +#include "engines/gfx/gfx_engine_manager.h" #include "gfx_utils/mem_api.h" #include "securec.h" @@ -34,9 +34,12 @@ uint16_t Screen::GetHeight() bool Screen::GetCurrentScreenBitmap(ImageInfo& info) { BufferInfo* bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo(); + if (bufferInfo == nullptr) { + return false; + } uint16_t screenWidth = BaseGfxEngine::GetInstance()->GetScreenWidth(); uint16_t screenHeight = BaseGfxEngine::GetInstance()->GetScreenHeight(); - info.header.colorMode = bufferInfo->mode;; + info.header.colorMode = bufferInfo->mode; info.dataSize = screenWidth * screenHeight * DrawUtils::GetByteSizeByColorMode(info.header.colorMode); info.data = reinterpret_cast(ImageCacheMalloc(info)); info.header.width = screenWidth; @@ -44,12 +47,11 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info) info.header.reserved = 0; info.header.compressMode = 0; - if (memcpy_s(screenBitmapBuffer, info.dataSize, bufferInfo->virAddr, info.dataSize) != EOK) { + if (memcpy_s(static_cast(const_cast(info.data)), info.dataSize, + bufferInfo->virAddr, info.dataSize) != EOK) { ImageCacheFree(info); return false; } - - info.data = screenBitmapBuffer; return true; } } // namespace OHOS diff --git a/frameworks/components/root_view.cpp b/frameworks/components/root_view.cpp index f6993b5..c3a83fb 100755 --- a/frameworks/components/root_view.cpp +++ b/frameworks/components/root_view.cpp @@ -17,8 +17,8 @@ #include "common/screen.h" #include "core/render_manager.h" -#include "gfx_utils/graphic_log.h" #include "draw/draw_utils.h" +#include "gfx_utils/graphic_log.h" #if ENABLE_WINDOW #include "window/window_impl.h" #endif @@ -510,8 +510,8 @@ void RootView::BlitMapBuffer(Rect& curViewRect, TransformMap& transMap, const Re imageInfo.data = reinterpret_cast(dc_.mapBufferInfo->virAddr); TransformDataInfo imageTranDataInfo = {imageInfo.header, imageInfo.data, pxSize, LEVEL0, BILINEAR}; - dc_.gfxEngine->DrawTransform(*dc_.bufferInfo, invalidRect, {0, 0}, Color::Black(), - OPA_OPAQUE, transMap, imageTranDataInfo); + BaseGfxEngine::GetInstance()->DrawTransform(*dc_.bufferInfo, invalidRect, {0, 0}, Color::Black(), + OPA_OPAQUE, transMap, imageTranDataInfo); } } @@ -690,44 +690,35 @@ bool RootView::FindSubView(const UIView& parentView, const UIView* subView) void RootView::InitMapBufferInfo(BufferInfo* bufferInfo) { uint32_t bufferSize = bufferInfo->width * bufferInfo->height * - (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); + (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); // 3: Shift right 3 bits dc_.mapBufferInfo = new BufferInfo(); - (void)memcpy_s(dc_.mapBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo)); - dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr = - dc_.gfxEngine->AllocBuffer(bufferSize, BUFFER_MAP_SURFACE); + if (dc_.mapBufferInfo == nullptr) { + return; + } - dc_.snapShotBufferInfo = new BufferInfo(); - (void)memcpy_s(dc_.snapShotBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo)); - dc_.snapShotBufferInfo->virAddr = dc_.snapShotBufferInfo->phyAddr = - dc_.gfxEngine->AllocBuffer(bufferSize, BUFFER_SNAPSHOT_SURFACE); + if (memcpy_s(dc_.mapBufferInfo, sizeof(BufferInfo), bufferInfo, sizeof(BufferInfo)) != EOK) { + delete dc_.mapBufferInfo; + dc_.mapBufferInfo = nullptr; + return; + } + dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr = + BaseGfxEngine::GetInstance()->AllocBuffer(bufferSize, BUFFER_MAP_SURFACE); } void RootView::DestroyMapBufferInfo() { - if (dc_.gfxEngine == nullptr) { - return; - } - if (dc_.mapBufferInfo != nullptr) { - dc_.gfxEngine->FreeBuffer(static_cast(dc_.mapBufferInfo->virAddr)); + BaseGfxEngine::GetInstance()->FreeBuffer(static_cast(dc_.mapBufferInfo->virAddr)); dc_.mapBufferInfo->virAddr = dc_.mapBufferInfo->phyAddr = nullptr; delete dc_.mapBufferInfo; dc_.mapBufferInfo = nullptr; } - - if (dc_.snapShotBufferInfo != nullptr) { - dc_.gfxEngine->FreeBuffer(static_cast(dc_.snapShotBufferInfo->virAddr)); - dc_.snapShotBufferInfo->virAddr = dc_.snapShotBufferInfo->phyAddr = nullptr; - delete dc_.snapShotBufferInfo; - dc_.snapShotBufferInfo = nullptr; - } } void RootView::InitDrawContext() { - dc_.gfxEngine = BaseGfxEngine::GetInstance(); - dc_.bufferInfo = dc_.gfxEngine->GetBufferInfo(); + dc_.bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo(); if (dc_.bufferInfo != nullptr) { InitMapBufferInfo(dc_.bufferInfo); @@ -739,19 +730,19 @@ void RootView::DestroyDrawContext() DestroyMapBufferInfo(); } -void RootView::UpdateBufferInfo(BufferInfo* bufferInfo) +void RootView::UpdateBufferInfo(BufferInfo* fbBufferInfo) { if (dc_.bufferInfo == nullptr) { - dc_.bufferInfo = bufferInfo; - InitMapBufferInfo(bufferInfo); + dc_.bufferInfo = fbBufferInfo; + InitMapBufferInfo(fbBufferInfo); } else { - if (dc_.bufferInfo->width != bufferInfo->width || - dc_.bufferInfo->height != bufferInfo->height || - dc_.bufferInfo->mode != bufferInfo->mode) { + if (dc_.bufferInfo->width != fbBufferInfo->width || + dc_.bufferInfo->height != fbBufferInfo->height || + dc_.bufferInfo->mode != fbBufferInfo->mode) { DestroyMapBufferInfo(); - InitMapBufferInfo(bufferInfo); + InitMapBufferInfo(fbBufferInfo); } - dc_.bufferInfo = bufferInfo; + dc_.bufferInfo = fbBufferInfo; } } @@ -762,9 +753,6 @@ void RootView::SaveDrawContext() bakDc_.mapBufferInfo = dc_.mapBufferInfo; dc_.mapBufferInfo = nullptr; - - bakDc_.snapShotBufferInfo = dc_.snapShotBufferInfo; - dc_.snapShotBufferInfo = nullptr; } void RootView::RestoreDrawContext() @@ -776,8 +764,5 @@ void RootView::RestoreDrawContext() dc_.mapBufferInfo = bakDc_.mapBufferInfo; bakDc_.mapBufferInfo = nullptr; - - dc_.snapShotBufferInfo = bakDc_.snapShotBufferInfo; - bakDc_.snapShotBufferInfo = nullptr; } } // namespace OHOS diff --git a/frameworks/components/ui_analog_clock.cpp b/frameworks/components/ui_analog_clock.cpp index 8438be2..bb63e94 100755 --- a/frameworks/components/ui_analog_clock.cpp +++ b/frameworks/components/ui_analog_clock.cpp @@ -16,11 +16,11 @@ #include "components/ui_analog_clock.h" #include "components/ui_image_view.h" #include "draw/draw_image.h" +#include "engines/gfx/gfx_engine_manager.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/style.h" #include "imgdecode/cache_manager.h" #include "themes/theme.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { UIAnalogClock::UIAnalogClock() @@ -273,7 +273,10 @@ void UIAnalogClock::DrawHand(BufferInfo& gfxDstBuffer, const Rect& current, cons } } -void UIAnalogClock::DrawHandImage(BufferInfo& gfxDstBuffer, const Rect& current, const Rect& invalidatedArea, Hand& hand) +void UIAnalogClock::DrawHandImage(BufferInfo& gfxDstBuffer, + const Rect& current, + const Rect& invalidatedArea, + Hand& hand) { uint8_t pxSize = DrawUtils::GetPxSizeByColorMode(hand.imageInfo_.header.colorMode); TransformDataInfo imageTranDataInfo = { @@ -315,7 +318,8 @@ void UIAnalogClock::DrawHandLine(BufferInfo& gfxDstBuffer, const Rect& invalidat end.x = xlength + curCenter.x; end.y = ylength + curCenter.y; - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, hand.width_, hand.color_, hand.opacity_); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, + hand.width_, hand.color_, hand.opacity_); } void UIAnalogClock::SetWorkMode(WorkMode newMode) diff --git a/frameworks/components/ui_arc_label.cpp b/frameworks/components/ui_arc_label.cpp index 8cd0cdf..b87f636 100755 --- a/frameworks/components/ui_arc_label.cpp +++ b/frameworks/components/ui_arc_label.cpp @@ -16,9 +16,9 @@ #include "components/ui_arc_label.h" #include "common/typed_text.h" #include "draw/draw_label.h" +#include "engines/gfx/gfx_engine_manager.h" #include "font/ui_font.h" #include "themes/theme_manager.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { UIArcLabel::UIArcLabel() diff --git a/frameworks/components/ui_axis.cpp b/frameworks/components/ui_axis.cpp index 6d1cd16..8227ed9 100755 --- a/frameworks/components/ui_axis.cpp +++ b/frameworks/components/ui_axis.cpp @@ -93,7 +93,8 @@ void UIXAxis::TranslateToPixel(int16_t& value) void UIAxis::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) { - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start_, end_, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start_, end_, invalidatedArea, style_->lineWidth_, + style_->lineColor_, style_->lineOpa_); DrawAxisMark(gfxDstBuffer, invalidatedArea); } @@ -108,7 +109,8 @@ void UIXAxis::DrawAxisMark(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea end.y = enableReverse_ ? (start.y + AXIS_DEFAULT_MARK_LENGTH) : (start.y - AXIS_DEFAULT_MARK_LENGTH); end.x = start.x; - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, + style_->lineWidth_, style_->lineColor_, style_->lineOpa_); index++; } } @@ -190,7 +192,8 @@ void UIYAxis::DrawAxisMark(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea end.x = start.x + AXIS_DEFAULT_MARK_LENGTH; end.y = start.y; - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, style_->lineWidth_, style_->lineColor_, style_->lineOpa_); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, + style_->lineWidth_, style_->lineColor_, style_->lineOpa_); index++; } } diff --git a/frameworks/components/ui_box_progress.cpp b/frameworks/components/ui_box_progress.cpp index f85532c..506e799 100755 --- a/frameworks/components/ui_box_progress.cpp +++ b/frameworks/components/ui_box_progress.cpp @@ -15,8 +15,8 @@ #include "components/ui_box_progress.h" #include "draw/draw_utils.h" -#include "gfx_utils/graphic_log.h" #include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_log.h" namespace OHOS { UIBoxProgress::UIBoxProgress() @@ -131,22 +131,26 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer, arcInfo.center = leftTop; arcInfo.startAngle = THREE_QUARTER_IN_DEGREE; arcInfo.endAngle = 0; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); arcInfo.center = leftBottom; arcInfo.startAngle = SEMICIRCLE_IN_DEGREE; arcInfo.endAngle = THREE_QUARTER_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); arcInfo.center = rightTop; arcInfo.startAngle = 0; arcInfo.endAngle = QUARTER_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); arcInfo.center = rightBottom; arcInfo.startAngle = QUARTER_IN_DEGREE; arcInfo.endAngle = SEMICIRCLE_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); } else { switch (direction_) { case Direction::DIR_LEFT_TO_RIGHT: @@ -154,12 +158,14 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer, arcInfo.center = leftTop; arcInfo.startAngle = SEMICIRCLE_IN_DEGREE; arcInfo.endAngle = 0; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); arcInfo.center = leftBottom; arcInfo.startAngle = 0; arcInfo.endAngle = SEMICIRCLE_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); break; } @@ -168,12 +174,14 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer, arcInfo.center = leftTop; arcInfo.startAngle = THREE_QUARTER_IN_DEGREE; arcInfo.endAngle = QUARTER_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); arcInfo.center = leftBottom; arcInfo.startAngle = QUARTER_IN_DEGREE; arcInfo.endAngle = THREE_QUARTER_IN_DEGREE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, capStyle, opaScale_, + CapType::CAP_NONE); break; } default: diff --git a/frameworks/components/ui_button.cpp b/frameworks/components/ui_button.cpp index 9330c4e..27c27b0 100755 --- a/frameworks/components/ui_button.cpp +++ b/frameworks/components/ui_button.cpp @@ -14,15 +14,14 @@ */ #include "components/ui_button.h" - #include "animator/interpolation.h" #include "common/image.h" #include "draw/draw_image.h" +#include "engines/gfx/gfx_engine_manager.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/style.h" #include "imgdecode/cache_manager.h" #include "themes/theme_manager.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { UIButton::UIButton() diff --git a/frameworks/components/ui_canvas.cpp b/frameworks/components/ui_canvas.cpp index 29f9114..4d7bc2b 100755 --- a/frameworks/components/ui_canvas.cpp +++ b/frameworks/components/ui_canvas.cpp @@ -17,8 +17,8 @@ #include "common/image.h" #include "draw/draw_arc.h" #include "draw/draw_image.h" -#include "gfx_utils/graphic_log.h" #include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_log.h" namespace OHOS { UICanvas::UICanvasPath::~UICanvasPath() @@ -487,7 +487,8 @@ void UICanvas::DoDrawLine(BufferInfo& gfxDstBuffer, GetAbsolutePosition(lineParam->start, rect, style, start); GetAbsolutePosition(lineParam->end, rect, style, end); - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(), paint.GetOpacity()); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), + paint.GetStrokeColor(), paint.GetOpacity()); } void UICanvas::DoDrawCurve(BufferInfo& gfxDstBuffer, @@ -510,8 +511,8 @@ void UICanvas::DoDrawCurve(BufferInfo& gfxDstBuffer, GetAbsolutePosition(curveParam->control1, rect, style, control1); GetAbsolutePosition(curveParam->control2, rect, style, control2); - BaseGfxEngine::GetInstance()->DrawCubicBezier(gfxDstBuffer, start, control1, control2, end, invalidatedArea, paint.GetStrokeWidth(), - paint.GetStrokeColor(), paint.GetOpacity()); + BaseGfxEngine::GetInstance()->DrawCubicBezier(gfxDstBuffer, start, control1, control2, end, invalidatedArea, + paint.GetStrokeWidth(), paint.GetStrokeColor(), paint.GetOpacity()); } void UICanvas::DoDrawRect(BufferInfo& gfxDstBuffer, @@ -623,14 +624,16 @@ void UICanvas::DoDrawCircle(BufferInfo& gfxDstBuffer, arcInfo.radius = circleParam->radius - halfLineWidth; drawStyle.lineWidth_ = arcInfo.radius; drawStyle.lineColor_ = paint.GetFillColor(); - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, + CapType::CAP_NONE); } if (enableStroke) { arcInfo.radius = circleParam->radius + halfLineWidth - 1; drawStyle.lineWidth_ = static_cast(paint.GetStrokeWidth()); drawStyle.lineColor_ = paint.GetStrokeColor(); - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, + CapType::CAP_NONE); } } @@ -657,7 +660,8 @@ void UICanvas::DoDrawArc(BufferInfo& gfxDstBuffer, arcInfo.radius = arcParam->radius + ((paint.GetStrokeWidth() + 1) >> 1); GetAbsolutePosition(arcParam->center, rect, style, arcInfo.center); - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, + CapType::CAP_NONE); } void UICanvas::DoDrawImage(BufferInfo& gfxDstBuffer, @@ -706,7 +710,10 @@ void UICanvas::DoDrawLabel(BufferInfo& gfxDstBuffer, label->SetPosition(startPos.x, startPos.y); } -void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, const Rect& invalidatedArea, const Paint& paint) +void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer, + const Point& center, + const Rect& invalidatedArea, + const Paint& paint) { ArcInfo arcinfo = {{0}}; arcinfo.center = center; @@ -719,7 +726,8 @@ void UICanvas::DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, con style.lineColor_ = paint.GetStrokeColor(); style.lineWidth_ = static_cast(paint.GetStrokeWidth()); style.lineOpa_ = OPA_OPAQUE; - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, style, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, style, OPA_OPAQUE, + CapType::CAP_NONE); } void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer, @@ -758,7 +766,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer, GetAbsolutePosition(start, rect, style, start); GetAbsolutePosition(end, rect, style, end); - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, + paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE); if ((pathEnd.x == start.x) && (pathEnd.y == start.y)) { DoDrawLineJoin(gfxDstBuffer, start, invalidatedArea, paint); } @@ -777,7 +786,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer, arcInfo.radius = arcIter->data_.radius + ((paint.GetStrokeWidth() + 1) >> 1); GetAbsolutePosition(arcIter->data_.center, rect, style, arcInfo.center); - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfo, invalidatedArea, drawStyle, OPA_OPAQUE, + CapType::CAP_NONE); if (pointIter != path->points_.Begin()) { DoDrawLineJoin(gfxDstBuffer, pathEnd, invalidatedArea, paint); } @@ -793,8 +803,8 @@ void UICanvas::DoDrawPath(BufferInfo& gfxDstBuffer, GetAbsolutePosition(start, rect, style, start); GetAbsolutePosition(end, rect, style, end); if ((start.x != end.x) || (start.y != end.y)) { - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, paint.GetStrokeWidth(), paint.GetStrokeColor(), - OPA_OPAQUE); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, + paint.GetStrokeWidth(), paint.GetStrokeColor(), OPA_OPAQUE); if ((pathEnd.x == start.x) && (pathEnd.y == start.y)) { DoDrawLineJoin(gfxDstBuffer, start, invalidatedArea, paint); } diff --git a/frameworks/components/ui_chart.cpp b/frameworks/components/ui_chart.cpp index abb2c5b..611dcf2 100755 --- a/frameworks/components/ui_chart.cpp +++ b/frameworks/components/ui_chart.cpp @@ -453,7 +453,8 @@ void UIChartPillar::DrawDataSerials(BufferInfo& gfxDstBuffer, const Rect& invali } current.x += x; xStart.x = current.x; - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, current, xStart, invalidatedArea, barWidth, data->GetFillColor(), style_->lineOpa_); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, current, xStart, invalidatedArea, barWidth, + data->GetFillColor(), style_->lineOpa_); } dataSerialIndex++; } @@ -832,7 +833,8 @@ void UIChartPolyline::GradientColor(BufferInfo& gfxDstBuffer, const Rect& invali } Point start = {limitPoints.start.x, y}; Point end = {limitPoints.end.x, y}; - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, 1, data->GetFillColor(), mixData_[mixScale]); + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, end, invalidatedArea, 1, + data->GetFillColor(), mixData_[mixScale]); } y--; } diff --git a/frameworks/components/ui_checkbox.cpp b/frameworks/components/ui_checkbox.cpp index 56224d8..457deeb 100755 --- a/frameworks/components/ui_checkbox.cpp +++ b/frameworks/components/ui_checkbox.cpp @@ -16,8 +16,8 @@ #include "components/ui_checkbox.h" #include "default_resource/check_box_res.h" #include "draw/draw_image.h" -#include "imgdecode/cache_manager.h" #include "engines/gfx/gfx_engine_manager.h" +#include "imgdecode/cache_manager.h" namespace OHOS { namespace { @@ -118,7 +118,11 @@ void UICheckBox::CalculateSize() borderWidth_ = DEFAULT_BORDER_WIDTH * minValue / DEFAULT_HOT_WIDTH; } -void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth) +void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, + Rect rect, + Rect trunc, + int16_t borderRadius, + int16_t rectLineWidth) { if (backgroundOpacity_ == 0) { return; @@ -152,9 +156,11 @@ void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rec styleSelect.lineOpa_ = backgroundOpacity_; uint8_t opa = DrawUtils::GetMixOpacity(opaScale_, backgroundOpacity_); BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleSelect, opaScale_, CapType::CAP_NONE); - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(), opa); // 2 : double + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(), + opa); // 2 : double BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoMid, trunc, styleSelect, opaScale_, CapType::CAP_NONE); - BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(), opa); // 2 : double + BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(), + opa); // 2 : double BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, opaScale_, CapType::CAP_NONE); } diff --git a/frameworks/components/ui_circle_progress.cpp b/frameworks/components/ui_circle_progress.cpp index 98f7f96..24e4791 100755 --- a/frameworks/components/ui_circle_progress.cpp +++ b/frameworks/components/ui_circle_progress.cpp @@ -104,7 +104,7 @@ void UICircleProgress::DrawCommonCircle(BufferInfo& gfxDstBuffer, const Rect& in arcinfo.endAngle = end; arcinfo.imgSrc = backgroundImage_; BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, *backgroundStyle_, opaScale_, - backgroundStyle_->lineCap_); + backgroundStyle_->lineCap_); } if ((startAngle != endAngle) || (foregroundStyle_->lineCap_ == CapType::CAP_ROUND)) { @@ -114,7 +114,7 @@ void UICircleProgress::DrawCommonCircle(BufferInfo& gfxDstBuffer, const Rect& in arcinfo.endAngle = endAngle; arcinfo.imgSrc = foregroundImage_; BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcinfo, invalidatedArea, *foregroundStyle_, opaScale_, - foregroundStyle_->lineCap_); + foregroundStyle_->lineCap_); } } diff --git a/frameworks/components/ui_image_view.cpp b/frameworks/components/ui_image_view.cpp index 45eb028..bce38bd 100755 --- a/frameworks/components/ui_image_view.cpp +++ b/frameworks/components/ui_image_view.cpp @@ -309,8 +309,8 @@ void UIImageView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) Rect origRect = GetOrigRect(); transMap_->SetTransMapRect(origRect); OpacityType opaScale = DrawUtils::GetMixOpacity(opa, style_->imageOpa_); - BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, invalidatedArea, {0, 0}, Color::Black(), opaScale, *transMap_, - imageTranDataInfo); + BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, invalidatedArea, {0, 0}, Color::Black(), + opaScale, *transMap_, imageTranDataInfo); } } } diff --git a/frameworks/components/ui_label.cpp b/frameworks/components/ui_label.cpp index 697e09a..90b1cf1 100755 --- a/frameworks/components/ui_label.cpp +++ b/frameworks/components/ui_label.cpp @@ -376,6 +376,7 @@ void UILabel::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) Style style = GetStyleConst(); style.textColor_ = GetTextColor(); OpacityType opa = GetMixOpaScale(); - labelText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), GetContentRect(), offsetX_, style, ellipsisIndex_, opa); + labelText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), + GetContentRect(), offsetX_, style, ellipsisIndex_, opa); } } // namespace OHOS \ No newline at end of file diff --git a/frameworks/components/ui_label_button.cpp b/frameworks/components/ui_label_button.cpp index eb58aa9..9cdcbcb 100755 --- a/frameworks/components/ui_label_button.cpp +++ b/frameworks/components/ui_label_button.cpp @@ -35,7 +35,8 @@ void UILabelButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea labelButtonText_->ReMeasureTextSize(textRect, labelStyle_); OpacityType opa = GetMixOpaScale(); uint16_t ellipsisIndex = labelButtonText_->GetEllipsisIndex(textRect, labelStyle_); - labelButtonText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), textRect, 0, labelStyle_, ellipsisIndex, opa); + labelButtonText_->OnDraw(gfxDstBuffer, invalidatedArea, GetOrigRect(), textRect, 0, + labelStyle_, ellipsisIndex, opa); } UILabelButton::~UILabelButton() diff --git a/frameworks/components/ui_radio_button.cpp b/frameworks/components/ui_radio_button.cpp index 1a3bacc..9464007 100755 --- a/frameworks/components/ui_radio_button.cpp +++ b/frameworks/components/ui_radio_button.cpp @@ -92,12 +92,14 @@ void UIRadioButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea styleSelect.lineWidth_ = arcInfoBig.radius; styleSelect.lineColor_ = Color::GetColorFromRGB(0x1F, 0x71, 0xFF); if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleSelect, + OPA_OPAQUE, CapType::CAP_NONE); } styleSelect.lineWidth_ = arcInfoSmall.radius; styleSelect.lineColor_ = Color::White(); if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoSmall, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoSmall, trunc, styleSelect, + OPA_OPAQUE, CapType::CAP_NONE); } break; } @@ -107,7 +109,8 @@ void UIRadioButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea styleUnSelect.lineWidth_ = lineWidth_; if (isIntersect) { // 0xa8 : opacity of drawing unselected button arc edge. - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleUnSelect, 0xa8, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoBig, trunc, styleUnSelect, + 0xa8, CapType::CAP_NONE); } break; } diff --git a/frameworks/components/ui_toggle_button.cpp b/frameworks/components/ui_toggle_button.cpp index 5fc356f..6bb913f 100755 --- a/frameworks/components/ui_toggle_button.cpp +++ b/frameworks/components/ui_toggle_button.cpp @@ -15,8 +15,8 @@ #include "components/ui_toggle_button.h" #include "common/image.h" -#include "imgdecode/cache_manager.h" #include "engines/gfx/gfx_engine_manager.h" +#include "imgdecode/cache_manager.h" namespace OHOS { UIToggleButton::UIToggleButton() : corner_(DEFAULT_CORNER_RADIUS), radius_(DEFAULT_CORNER_RADIUS - DEAFULT_RADIUS_DIFF), @@ -86,7 +86,8 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre styleSelect.lineWidth_ = radius_; styleSelect.lineColor_ = Color::White(); if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, + styleSelect, OPA_OPAQUE, CapType::CAP_NONE); } break; } @@ -105,7 +106,8 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre styleUnSelect.lineColor_ = Color::White(); styleUnSelect.lineWidth_ = radius_; if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleUnSelect, OPA_OPAQUE, CapType::CAP_NONE); + BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, + styleUnSelect, OPA_OPAQUE, CapType::CAP_NONE); } break; } diff --git a/frameworks/components/ui_view.cpp b/frameworks/components/ui_view.cpp index 353e5c0..d5dc6b8 100755 --- a/frameworks/components/ui_view.cpp +++ b/frameworks/components/ui_view.cpp @@ -820,8 +820,11 @@ bool UIView::GetBitmap(ImageInfo& bitmap) parent_ = nullptr; BufferInfo* bufferInfo = BaseGfxEngine::GetInstance()->GetBufferInfo(); - int16_t screenWidth = bufferInfo->rect.GetWidth(); - int16_t screenHeight = bufferInfo->rect.GetHeight(); + if (bufferInfo == nullptr) { + return false; + } + int16_t screenWidth = bufferInfo->width; + int16_t screenHeight = bufferInfo->height; Rect screenRect(0, 0, screenWidth, screenHeight); rect_.SetPosition(0, 0); Rect mask = GetRect(); diff --git a/frameworks/core/render_manager.cpp b/frameworks/core/render_manager.cpp index 71db276..0de69c4 100755 --- a/frameworks/core/render_manager.cpp +++ b/frameworks/core/render_manager.cpp @@ -16,7 +16,6 @@ #include "core/render_manager.h" #include "components/root_view.h" -//#include "dock/screen_device_proxy.h" #include "gfx_utils/graphic_log.h" #include "hal_tick.h" #include "securec.h" diff --git a/frameworks/dock/screen_device.h b/frameworks/dock/screen_device.h index 2be6b6f..df5586e 100755 --- a/frameworks/dock/screen_device.h +++ b/frameworks/dock/screen_device.h @@ -23,7 +23,6 @@ #if ENABLE_WINDOW #include "gfx_utils/pixel_format_utils.h" #endif -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { #if ENABLE_WINDOW @@ -37,6 +36,13 @@ struct AllocationInfo { }; #endif +#ifndef TRANSFORMOPTION +#define TRANSFORMOPTION +struct TransformOption { + TransformAlgorithm algorithm; +}; +#endif + /** @brief A semaphore for display buffer flushing. */ class FlushSem : public HeapBase { public: diff --git a/frameworks/dock/screen_device_proxy.cpp b/frameworks/dock/screen_device_proxy.cpp index 54acc3f..c5c49d2 100755 --- a/frameworks/dock/screen_device_proxy.cpp +++ b/frameworks/dock/screen_device_proxy.cpp @@ -43,8 +43,10 @@ void ScreenDeviceProxy::DrawAnimatorBuffer(const Rect& invalidatedArea) uint8_t pxSize = DrawUtils::GetPxSizeByColorMode(animatorImageInfo_.header.colorMode); TransformDataInfo imageTranDataInfo = {animatorImageInfo_.header, animatorImageInfo_.data, pxSize, LEVEL0, BILINEAR}; - //DrawUtils::GetInstance()->DrawTransform(invalidRect, {0, 0}, Color::Black(), OPA_OPAQUE, transMap_, - // imageTranDataInfo); +#if 0 // to do delete + DrawUtils::GetInstance()->DrawTransform(invalidRect, {0, 0}, Color::Black(), OPA_OPAQUE, transMap_, + imageTranDataInfo); +#endif } } diff --git a/frameworks/draw/draw_arc.cpp b/frameworks/draw/draw_arc.cpp index d88c267..c634ae9 100755 --- a/frameworks/draw/draw_arc.cpp +++ b/frameworks/draw/draw_arc.cpp @@ -120,7 +120,12 @@ uint16_t DrawArc::CalculateTanDegree(uint16_t x, uint16_t y) return degree; } -void DrawArc::DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa, bool anti) +void DrawArc::DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, + ArcInfo& arcInfo, + const Rect& mask, + const Style& style, + uint8_t opa, + bool anti) { DrawAxisLine(gfxDstBuffer, arcInfo, mask, style, opa); @@ -230,8 +235,9 @@ void DrawArc::DrawLineWithDegree(BufferInfo& gfxDstBuffer, uint8_t quadrant) { if (isCircle_) { - DrawHorLine(gfxDstBuffer, Point{static_cast(arcInfo.center.x + start), static_cast(arcInfo.center.y + y)}, - arcInfo.imgPos, mask, end - start, style, opaScale, arcInfo.imgSrc); + DrawHorLine(gfxDstBuffer, Point{static_cast(arcInfo.center.x + start), + static_cast(arcInfo.center.y + y)}, arcInfo.imgPos, + mask, end - start, style, opaScale, arcInfo.imgSrc); return; } uint16_t degreeStart = GetDegreeInQuadrant(CalculateTanDegree(MATH_ABS(start), MATH_ABS(y)), quadrant); diff --git a/frameworks/draw/draw_arc.h b/frameworks/draw/draw_arc.h index 8aabac6..c27a4fc 100755 --- a/frameworks/draw/draw_arc.h +++ b/frameworks/draw/draw_arc.h @@ -142,7 +142,12 @@ private: uint8_t quadrant); #if ENABLE_ANTIALIAS void DrawLineAnti(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa); - void DrawPointAnti(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, int16_t x, const Rect& mask, const Style& style, uint8_t antiOpa); + void DrawPointAnti(BufferInfo& gfxDstBuffer, + ArcInfo& arcInfo, + int16_t x, + const Rect& mask, + const Style& style, + uint8_t antiOpa); #endif uint16_t GetDegreeInQuadrant(uint16_t degree, uint8_t quadrant); void SetArcInfo(ArcInfo& arcInfo, const Style& style); diff --git a/frameworks/draw/draw_curve.h b/frameworks/draw/draw_curve.h index 389fa2d..018d1f0 100755 --- a/frameworks/draw/draw_curve.h +++ b/frameworks/draw/draw_curve.h @@ -18,7 +18,7 @@ #include "gfx_utils/color.h" #include "gfx_utils/geometry2d.h" -#include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_buffer.h" namespace OHOS { class DrawCurve : public HeapBase { diff --git a/frameworks/draw/draw_label.cpp b/frameworks/draw/draw_label.cpp index 2e89d41..5c34197 100755 --- a/frameworks/draw/draw_label.cpp +++ b/frameworks/draw/draw_label.cpp @@ -165,6 +165,7 @@ void DrawLabel::DrawLetterWithRotate(BufferInfo& gfxDstBuffer, transMap.Rotate(rotateAngle, Vector2(-node.left, node.top - head.ascender)); TransformDataInfo letterTranDataInfo = {ImageHeader{colorMode, 0, 0, 0, node.cols, node.rows}, fontMap, fontWeight, BlurLevel::LEVEL0}; - BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, mask, Point{0, 0}, color, opaScale, transMap, letterTranDataInfo); + BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, mask, Point{0, 0}, color, opaScale, transMap, + letterTranDataInfo); } } // namespace OHOS diff --git a/frameworks/draw/draw_label.h b/frameworks/draw/draw_label.h index 6b2c832..f497feb 100755 --- a/frameworks/draw/draw_label.h +++ b/frameworks/draw/draw_label.h @@ -31,8 +31,14 @@ public: const Point& arcCenter, uint8_t fontId, const UIArcLabel::ArcTextInfo arcTextInfo, UIArcLabel::TextOrientation orientation, const Style& style, uint8_t opaScale); - static void DrawLetterWithRotate(BufferInfo& gfxDstBuffer, const Rect& mask, uint8_t fontId, uint32_t letter, const Point& pos, - int16_t rotateAngle, const ColorType& color, OpacityType opaScale); + static void DrawLetterWithRotate(BufferInfo& gfxDstBuffer, + const Rect& mask, + uint8_t fontId, + uint32_t letter, + const Point& pos, + int16_t rotateAngle, + const ColorType& color, + OpacityType opaScale); }; } // namespace OHOS #endif // GRAPHIC_LITE_DRAW_LABEL_H diff --git a/frameworks/draw/draw_line.cpp b/frameworks/draw/draw_line.cpp index fd0daea..7cfd7ef 100755 --- a/frameworks/draw/draw_line.cpp +++ b/frameworks/draw/draw_line.cpp @@ -281,7 +281,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po sy--; } sx += dir; - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, (acc1 >> SHIFT_8) ^ OPA_OPAQUE); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, + (acc1 >> SHIFT_8) ^ OPA_OPAQUE); } if (temp1 < MAX_LINE_WIDTH) { endPoints1[temp1++] = sx + dir; @@ -304,7 +305,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po while (--dy) { if (sy <= y1Int) { INCREASE_ACC(acc0, accTemp0, adj0, sx, dir); - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, color, opacity, acc0 >> SHIFT_8); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, + color, opacity, acc0 >> SHIFT_8); if (temp0 < MAX_LINE_WIDTH) { edge0 = endPoints0[temp0++]; } @@ -312,15 +314,16 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po } else if (sy < y2Int) { INCREASE_ACC(acc0, accTemp0, adj0, sx, dir); INCREASE_ACC(acc2, accTemp2, adj0, sxTemp, dir); - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, color, opacity, acc0 >> SHIFT_8); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx + dir, sy, mask, + color, opacity, acc0 >> SHIFT_8); DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sxTemp, sy, mask, color, opacity, - (acc2 >> SHIFT_8) ^ OPA_OPAQUE); + (acc2 >> SHIFT_8) ^ OPA_OPAQUE); edge0 = sxTemp + dir; edge1 = sx; } else if (sy < y3Int) { INCREASE_ACC(acc2, accTemp2, adj0, sxTemp, dir); DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sxTemp, sy, mask, color, opacity, - (acc2 >> SHIFT_8) ^ OPA_OPAQUE); + (acc2 >> SHIFT_8) ^ OPA_OPAQUE); edge0 = sxTemp + dir; if (temp1 > 0) { edge1 = endPoints1[--temp1]; @@ -354,7 +357,7 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po } sy -= dir; DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, - (acc1 >> SHIFT_8) ^ OPA_OPAQUE); + (acc1 >> SHIFT_8) ^ OPA_OPAQUE); } if (x0Int - sx < MAX_LINE_WIDTH) { endPoints0[x0Int - sx] = sy - dir; @@ -375,7 +378,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po sx++; } sy += dir; - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, (acc1 >> SHIFT_8) ^ OPA_OPAQUE); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy, mask, color, opacity, + (acc1 >> SHIFT_8) ^ OPA_OPAQUE); } DrawUtils::GetInstance()->DrawPixel(gfxDstBuffer, x3Int, y3Int, mask, color, opacity); if (temp1 < MAX_LINE_WIDTH) { @@ -399,7 +403,8 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po while (--dx) { if (sx >= x1Int) { INCREASE_ACC(acc0, accTemp0, adj0, sy, dir); - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, color, opacity, acc0 >> SHIFT_8); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, + color, opacity, acc0 >> SHIFT_8); if (temp0 < MAX_LINE_WIDTH) { edge0 = endPoints0[temp0++]; } @@ -407,15 +412,16 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po } else if (sx > x2Int) { INCREASE_ACC(acc0, accTemp0, adj0, sy, dir); INCREASE_ACC(acc2, accTemp2, adj0, syTemp, dir); - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, color, opacity, acc0 >> SHIFT_8); - DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color, opacity, - (acc2 >> SHIFT_8) ^ OPA_OPAQUE); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, sy + dir, mask, + color, opacity, acc0 >> SHIFT_8); + DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color, + opacity, (acc2 >> SHIFT_8) ^ OPA_OPAQUE); edge0 = syTemp + dir; edge1 = sy; } else if (sx > x3Int) { INCREASE_ACC(acc2, accTemp2, adj0, syTemp, dir); DrawUtils::GetInstance()->DrawPixelInLine(gfxDstBuffer, sx, syTemp, mask, color, opacity, - (acc2 >> SHIFT_8) ^ OPA_OPAQUE); + (acc2 >> SHIFT_8) ^ OPA_OPAQUE); edge0 = syTemp + dir; if (temp1 > 0) { edge1 = endPoints1[--temp1]; @@ -451,10 +457,11 @@ void DrawLine::DrawThinWuLine(BufferInfo& gfxDstBuffer, const Point& start, cons INCREASE_ACC(acc, accTemp, adj, sx, dir); sy++; if (width == 1) { - DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx + dir, sy, mask, color, opacity, - acc >> SHIFT_8); + DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx + dir, sy, mask, + color, opacity, acc >> SHIFT_8); } else { - DrawUtils::GetInstance()->DrawVerPixelInLine(gfxDstBuffer, sx, sy, dir, mask, color, opacity, acc >> SHIFT_8); + DrawUtils::GetInstance()->DrawVerPixelInLine(gfxDstBuffer, sx, sy, dir, mask, + color, opacity, acc >> SHIFT_8); } } } else { @@ -463,10 +470,11 @@ void DrawLine::DrawThinWuLine(BufferInfo& gfxDstBuffer, const Point& start, cons INCREASE_ACC(acc, accTemp, adj, sy, dir); sx--; if (width == 1) { - DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx, sy + dir, mask, color, opacity, - acc >> SHIFT_8); + DrawUtils::GetInstance()->DrawAdjPixelInLine(gfxDstBuffer, sx, sy, sx, sy + dir, mask, + color, opacity, acc >> SHIFT_8); } else { - DrawUtils::GetInstance()->DrawHorPixelInLine(gfxDstBuffer, sx, sy, dir, mask, color, opacity, acc >> SHIFT_8); + DrawUtils::GetInstance()->DrawHorPixelInLine(gfxDstBuffer, sx, sy, dir, mask, + color, opacity, acc >> SHIFT_8); } } } diff --git a/frameworks/draw/draw_line.h b/frameworks/draw/draw_line.h index 5d66b1c..db7ceaa 100755 --- a/frameworks/draw/draw_line.h +++ b/frameworks/draw/draw_line.h @@ -18,7 +18,7 @@ #include "gfx_utils/color.h" #include "gfx_utils/geometry2d.h" -#include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_buffer.h" namespace OHOS { class DrawLine : public HeapBase { diff --git a/frameworks/draw/draw_rect.cpp b/frameworks/draw/draw_rect.cpp index 899ba0e..757246f 100755 --- a/frameworks/draw/draw_rect.cpp +++ b/frameworks/draw/draw_rect.cpp @@ -15,10 +15,10 @@ #include "draw/draw_rect.h" #include "draw/draw_utils.h" +#include "engines/gfx/gfx_engine_manager.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_math.h" #include "gfx_utils/style.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { void DrawRect::Draw(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, diff --git a/frameworks/draw/draw_rect.h b/frameworks/draw/draw_rect.h index 10b03f1..1d48472 100755 --- a/frameworks/draw/draw_rect.h +++ b/frameworks/draw/draw_rect.h @@ -20,7 +20,7 @@ #include "gfx_utils/rect.h" #include "gfx_utils/style.h" #include "gfx_utils/color.h" -#include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_buffer.h" namespace OHOS { /** @brief Class for drawing rectangle. */ diff --git a/frameworks/draw/draw_triangle.cpp b/frameworks/draw/draw_triangle.cpp index 5279daf..e4c2a47 100755 --- a/frameworks/draw/draw_triangle.cpp +++ b/frameworks/draw/draw_triangle.cpp @@ -17,7 +17,12 @@ #include "draw/draw_utils.h" namespace OHOS { -void DrawTriangle::Draw(BufferInfo& gfxDstBuffer, const Point* points, uint8_t count, const Rect& mask, const ColorType& color, OpacityType opa) +void DrawTriangle::Draw(BufferInfo& gfxDstBuffer, + const Point* points, + uint8_t count, + const Rect& mask, + const ColorType& color, + OpacityType opa) { if ((points == nullptr) || (count != VERTEX_NUM)) { return; diff --git a/frameworks/draw/draw_triangle.h b/frameworks/draw/draw_triangle.h index 90020b4..7825a7a 100755 --- a/frameworks/draw/draw_triangle.h +++ b/frameworks/draw/draw_triangle.h @@ -18,7 +18,7 @@ #include "gfx_utils/color.h" #include "gfx_utils/geometry2d.h" -#include "engines/gfx/gfx_engine_manager.h" +#include "gfx_utils/graphic_buffer.h" namespace OHOS { class DrawTriangle : public HeapBase { diff --git a/frameworks/draw/draw_utils.cpp b/frameworks/draw/draw_utils.cpp index 1567eac..ede429f 100755 --- a/frameworks/draw/draw_utils.cpp +++ b/frameworks/draw/draw_utils.cpp @@ -15,13 +15,13 @@ #include "draw/draw_utils.h" #include "draw/draw_triangle.h" +#include "engines/gfx/gfx_engine_manager.h" #include "font/ui_font.h" #include "font/ui_font_header.h" #include "gfx_utils/color.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_math.h" #include "graphic_performance.h" -#include "engines/gfx/gfx_engine_manager.h" #include "securec.h" #ifdef ARM_NEON_OPT @@ -45,8 +45,7 @@ namespace OHOS { } \ ColorMode bufferMode = gfxBufferInfo.mode; \ uint8_t bufferPxSize = GetByteSizeByColorMode(bufferMode); \ - uint16_t screenBufferWidth = /*gfxBufferInfo->rect.GetWidth()*/gfxBufferInfo.width; \ - Rect bufferRect = gfxBufferInfo.rect; + uint16_t screenBufferWidth = gfxBufferInfo.width; /* cover mode, src alpha is 255 */ #define COLOR_FILL_COVER(d, dm, r2, g2, b2, sm) \ @@ -176,7 +175,11 @@ void DrawUtils::DrawColorAreaBySides(BufferInfo& gfxDstBuffer, DrawUtils::GetInstance()->DrawColorArea(gfxDstBuffer, area, mask, color, opa); } -void DrawUtils::DrawColorArea(BufferInfo& gfxDstBuffer, const Rect& area, const Rect& mask, const ColorType& color, OpacityType opa) const +void DrawUtils::DrawColorArea(BufferInfo& gfxDstBuffer, + const Rect& area, + const Rect& mask, + const ColorType& color, + OpacityType opa) const { DRAW_UTILS_PREPROCESS(gfxDstBuffer, opa); Rect maskedArea; @@ -246,7 +249,12 @@ LutColorMode DrawUtils::GetLutColorModeBySize(uint8_t size) } } -void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer, int16_t x, int16_t y, const Rect& mask, const ColorType& color, OpacityType opa) const +void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer, + int16_t x, + int16_t y, + const Rect& mask, + const ColorType& color, + OpacityType opa) const { if ((x < mask.GetLeft()) || (x > mask.GetRight()) || (y < mask.GetTop()) || (y > mask.GetBottom())) { return; @@ -447,7 +455,7 @@ void DrawUtils::FillAreaWithSoftWare(BufferInfo& gfxDstBuffer, const OpacityType& opa) const { ColorMode mode = gfxDstBuffer.mode; - uint8_t destByteSize = DrawUtils::GetByteSizeByColorMode(mode); + uint8_t destByteSize = GetByteSizeByColorMode(mode); int16_t destWidth = gfxDstBuffer.width; int32_t halBufferDeltaByteLen = static_cast(destWidth) * destByteSize; int16_t width = fillArea.GetWidth(); @@ -1405,7 +1413,11 @@ void DrawUtils::DrawWithBuffer(BufferInfo& gfxDstBuffer, const Rect& rect, FillArea(gfxDstBuffer, rect, mask, false, colorBuf); } -void DrawUtils::FillArea(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& mask, bool isTransparent, const ColorType* colorBuf) +void DrawUtils::FillArea(BufferInfo& gfxDstBuffer, + const Rect& rect, + const Rect& mask, + bool isTransparent, + const ColorType* colorBuf) { Rect maskedArea; if (!maskedArea.Intersect(rect, mask)) { diff --git a/frameworks/draw/draw_utils.h b/frameworks/draw/draw_utils.h index 24b122d..86e4f28 100755 --- a/frameworks/draw/draw_utils.h +++ b/frameworks/draw/draw_utils.h @@ -19,10 +19,10 @@ #include "gfx_utils/color.h" #include "common/text.h" #include "gfx_utils/geometry2d.h" +#include "gfx_utils/graphic_buffer.h" #include "gfx_utils/graphic_types.h" #include "gfx_utils/style.h" #include "gfx_utils/transform.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { #define SWAP_INT16(x, y) \ diff --git a/frameworks/engines/gfx/gfx_engine_manager.cpp b/frameworks/engines/gfx/gfx_engine_manager.cpp index 09788fa..ffe091a 100644 --- a/frameworks/engines/gfx/gfx_engine_manager.cpp +++ b/frameworks/engines/gfx/gfx_engine_manager.cpp @@ -15,14 +15,18 @@ #include "engines/gfx/gfx_engine_manager.h" #include "draw/draw_arc.h" -#include "draw/draw_line.h" #include "draw/draw_curve.h" +#include "draw/draw_line.h" #include "draw/draw_rect.h" namespace OHOS { BaseGfxEngine* BaseGfxEngine::baseEngine_ = nullptr; -void BaseGfxEngine::DrawArc(BufferInfo& dst, ArcInfo& arcInfo, const Rect& mask, - const Style& style, OpacityType opacity, uint8_t cap) +void BaseGfxEngine::DrawArc(BufferInfo& dst, + ArcInfo& arcInfo, + const Rect& mask, + const Style& style, + OpacityType opacity, + uint8_t cap) { DrawArc::GetInstance()->Draw(dst, arcInfo, mask, style, opacity, cap); } @@ -38,14 +42,24 @@ void BaseGfxEngine::DrawLine(BufferInfo& dst, DrawLine::Draw(dst, start, end, mask, width, color, opacity); } -void BaseGfxEngine::DrawCubicBezier(BufferInfo& dst, const Point& start, const Point& control1, - const Point& control2, const Point& end, const Rect& mask, int16_t width, ColorType color, OpacityType opacity) +void BaseGfxEngine::DrawCubicBezier(BufferInfo& dst, + const Point& start, + const Point& control1, + const Point& control2, + const Point& end, + const Rect& mask, + int16_t width, + ColorType color, + OpacityType opacity) { DrawCurve::DrawCubicBezier(dst, start, control1, control2, end, mask, width, color, opacity); } -void BaseGfxEngine::DrawRect(BufferInfo& dst, const Rect& rect, const Rect& dirtyRect, - const Style& style, OpacityType opacity) +void BaseGfxEngine::DrawRect(BufferInfo& dst, + const Rect& rect, + const Rect& dirtyRect, + const Style& style, + OpacityType opacity) { DrawRect::Draw(dst, rect, dirtyRect, style, opacity); } @@ -62,20 +76,20 @@ void BaseGfxEngine::DrawTransform(BufferInfo& dst, opacity, transMap, dataInfo); } -void BaseGfxEngine::Blit(BufferInfo& dst, const Point& dstPos, const BufferInfo& src, - const Rect& subRect, const BlendOption& blendOption) +void BaseGfxEngine::Blit(BufferInfo& dst, + const Point& dstPos, + const BufferInfo& src, + const Rect& subRect, + const BlendOption& blendOption) { DrawUtils::GetInstance()->BlendWithSoftWare(static_cast(src.virAddr), src.rect, src.stride, src.rect.GetHeight(), src.mode, src.color, blendOption.opacity, static_cast(dst.virAddr), dst.stride, dst.mode, subRect.GetX(), subRect.GetY()); } -void BaseGfxEngine::Fill(BufferInfo& dst, const Rect& fillArea, const ColorType color, - const OpacityType opacity) +void BaseGfxEngine::Fill(BufferInfo& dst, const Rect& fillArea, const ColorType color, const OpacityType opacity) { uint8_t bufferPxSize = DrawUtils::GetByteSizeByColorMode(dst.mode); - //DrawUtils::GetInstance()->FillAreaWithSoftWare(fillArea, static_cast(dst.virAddr), - // dst.mode, bufferPxSize, dst.rect.GetWidth(), color, opacity); DrawUtils::GetInstance()->FillAreaWithSoftWare(dst, fillArea, color, opacity); } diff --git a/frameworks/engines/gfx/hi3516/hi3516_engine.cpp b/frameworks/engines/gfx/hi3516/hi3516_engine.cpp index 859ed67..f0e737c 100644 --- a/frameworks/engines/gfx/hi3516/hi3516_engine.cpp +++ b/frameworks/engines/gfx/hi3516/hi3516_engine.cpp @@ -15,8 +15,8 @@ #include "engines/gfx/hi3516/hi3516_engine.h" #include "draw/draw_utils.h" -#include "lite_wm_type.h" #include "hals/gfx_engines.h" +#include "lite_wm_type.h" namespace OHOS { const int16_t HARDWARE_ACC_SIZE_LIMIT = 50 * 50; @@ -27,9 +27,9 @@ __attribute__((constructor)) void RegisterHi3516GfxEngine() } void Hi3516GfxEngine::Fill(BufferInfo& dst, - const Rect& fillArea, - const ColorType color, - const OpacityType opacity) + const Rect& fillArea, + const ColorType color, + const OpacityType opacity) { #if ENABLE_GFX_ENGINES if ((opacity != OPA_OPAQUE) && (fillArea.GetSize() >= HARDWARE_ACC_SIZE_LIMIT)) { diff --git a/frameworks/window/window_impl.cpp b/frameworks/window/window_impl.cpp index 99e7b7a..e4bc597 100755 --- a/frameworks/window/window_impl.cpp +++ b/frameworks/window/window_impl.cpp @@ -18,7 +18,6 @@ #include "gfx_utils/graphic_log.h" #include "iwindows_manager.h" - namespace OHOS { WindowImpl::WindowImpl() : rootView_(nullptr), iWindow_(nullptr), isShow_(false), gfxAlloc_({}) {} diff --git a/frameworks/window/window_impl.h b/frameworks/window/window_impl.h index 27c336e..7ce9553 100755 --- a/frameworks/window/window_impl.h +++ b/frameworks/window/window_impl.h @@ -16,11 +16,10 @@ #ifndef GRAPHIC_LITE_WINDOW_IMPL_H #define GRAPHIC_LITE_WINDOW_IMPL_H -#include "iwindow.h" #include "components/root_view.h" -#include "window/window.h" -#include "dock/screen_device.h" #include "engines/gfx/gfx_engine_manager.h" +#include "iwindow.h" +#include "window/window.h" namespace OHOS { class WindowImpl : public Window { @@ -54,6 +53,14 @@ public: private: void UpdateHalDisplayBuffer(); + struct AllocationInfo { + uint8_t* virAddr; + uint8_t* phyAddr; + uint16_t width; + uint16_t height; + uint32_t stride; + ImagePixelFormat pixelFormat; + }; RootView* rootView_; IWindow* iWindow_; WindowConfig config_; diff --git a/interfaces/innerkits/engines/gfx/gfx_engine_manager.h b/interfaces/innerkits/engines/gfx/gfx_engine_manager.h index 83c2274..97d3160 100644 --- a/interfaces/innerkits/engines/gfx/gfx_engine_manager.h +++ b/interfaces/innerkits/engines/gfx/gfx_engine_manager.h @@ -16,26 +16,16 @@ #ifndef GRAPHIC_LITE_GFX_ENGINE_MANAGER_H #define GRAPHIC_LITE_GFX_ENGINE_MANAGER_H -#include "gfx_utils/heap_base.h" +#include "gfx_utils/geometry2d.h" +#include "gfx_utils/graphic_buffer.h" #include "gfx_utils/graphic_math.h" +#include "gfx_utils/graphic_types.h" +#include "gfx_utils/heap_base.h" #include "gfx_utils/style.h" -#include "gfx_utils/geometry2d.h" #include "gfx_utils/transform.h" namespace OHOS { class BaseGfxEngine; - -struct BufferInfo { - Rect rect; - int32_t stride; - void *phyAddr; - void *virAddr; - uint16_t width; - uint16_t height; - ColorMode mode; - uint32_t color; -}; - enum BlendMode { BLEND_MODE, /* no blending */ BLEND_SRC, /* S */ @@ -52,9 +42,12 @@ enum BlendMode { BLEND_SUBTRACT, /* D * (1 - S) */ }; +#ifndef TRANSFORMOPTION +#define TRANSFORMOPTION struct TransformOption { TransformAlgorithm algorithm; }; +#endif struct BlendOption { TransformMap transMap; @@ -81,13 +74,6 @@ struct TransformDataInfo { TransformAlgorithm algorithm; }; -struct DrawContext { - BaseGfxEngine* gfxEngine; - BufferInfo* bufferInfo; - BufferInfo* mapBufferInfo; - BufferInfo* snapShotBufferInfo; -}; - enum BufferInfoUsage { BUFFER_FB_SURFACE, BUFFER_MAP_SURFACE, diff --git a/interfaces/kits/common/image.h b/interfaces/kits/common/image.h index 14a5fa6..ba89a55 100755 --- a/interfaces/kits/common/image.h +++ b/interfaces/kits/common/image.h @@ -36,10 +36,10 @@ #define GRAPHIC_LITE_IMAGE_H #include "gfx_utils/geometry2d.h" +#include "gfx_utils/graphic_buffer.h" #include "gfx_utils/heap_base.h" #include "gfx_utils/image_info.h" #include "gfx_utils/style.h" -#include "engines/gfx/gfx_engine_manager.h" namespace OHOS { /** @@ -133,7 +133,11 @@ public: */ bool SetSrc(const ImageInfo* src); - void DrawImage(BufferInfo& gfxDstBuffer, const Rect& coords, const Rect& mask, const Style& style, uint8_t opaScale) const; + void DrawImage(BufferInfo& gfxDstBuffer, + const Rect& coords, + const Rect& mask, + const Style& style, + uint8_t opaScale) const; protected: const ImageInfo* imageInfo_; diff --git a/interfaces/kits/components/root_view.h b/interfaces/kits/components/root_view.h index 663b0fb..78e620b 100755 --- a/interfaces/kits/components/root_view.h +++ b/interfaces/kits/components/root_view.h @@ -264,8 +264,29 @@ public: void DrawTop(UIView* view, const Rect& rect); - void UpdateBufferInfo(BufferInfo* bufferInfo); + /** + * @brief 根据FBBuffer信息更新内存信息. + * + * @param bufferInfo FBBuffer信息 + * @since 1.0 + * @version 1.0 + */ + void UpdateBufferInfo(BufferInfo* fbBufferInfo); + + /** + * @brief 保存绘制上下文. + * + * @since 1.0 + * @version 1.0 + */ void SaveDrawContext(); + + /** + * @brief 恢复绘制上下文. + * + * @since 1.0 + * @version 1.0 + */ void RestoreDrawContext(); private: friend class RenderManager; @@ -312,6 +333,17 @@ private: #if ENABLE_WINDOW WindowImpl* boundWindow_ {nullptr}; #endif + /** + * @brief 绘制上下文结构信息. + * @param bufferInfo FB Buffer信息. + * @param mapBufferInfo 动效变换Buffer信息. + * @since 5.0 + * @version 3.0 + */ + struct DrawContext { + BufferInfo* bufferInfo; + BufferInfo* mapBufferInfo; + }; DrawContext dc_; DrawContext bakDc_; }; diff --git a/interfaces/kits/components/ui_box_progress.h b/interfaces/kits/components/ui_box_progress.h index 217b0ff..222bc56 100755 --- a/interfaces/kits/components/ui_box_progress.h +++ b/interfaces/kits/components/ui_box_progress.h @@ -225,10 +225,19 @@ protected: void GetBackgroundParam(Point& startPoint, int16_t& width, int16_t& height, uint16_t& radius, const Style& style); void DrawBackground(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); void DrawForeground(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, Rect& coords); - void DrawRoundCap(BufferInfo& gfxDstBuffer, const Image* image, const Point& imgPos, const Rect& rect, const Rect& invalidatedArea, - uint16_t radius, const Style& style); - void DrawValidRect(BufferInfo& gfxDstBuffer, const Image* image, const Rect& rect, const Rect& invalidatedArea, const Style& style, - uint16_t radius); + void DrawRoundCap(BufferInfo& gfxDstBuffer, + const Image* image, + const Point& imgPos, + const Rect& rect, + const Rect& invalidatedArea, + uint16_t radius, + const Style& style); + void DrawValidRect(BufferInfo& gfxDstBuffer, + const Image* image, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style, + uint16_t radius); uint16_t progressWidth_; uint16_t progressHeight_; diff --git a/interfaces/kits/components/ui_canvas.h b/interfaces/kits/components/ui_canvas.h index 84e1583..a2dece2 100755 --- a/interfaces/kits/components/ui_canvas.h +++ b/interfaces/kits/components/ui_canvas.h @@ -656,26 +656,65 @@ protected: delete pathParam; } - static void DoDrawLine(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawCurve(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawRect(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoFillRect(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawCircle(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawArc(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawImage(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawLabel(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); - static void DoDrawPath(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect, const Rect& invalidatedArea, - const Style& style); + static void DoDrawLine(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawCurve(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawRect(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoFillRect(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawCircle(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawArc(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawImage(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawLabel(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); + static void DoDrawPath(BufferInfo& gfxDstBuffer, + void* param, + const Paint& paint, + const Rect& rect, + const Rect& invalidatedArea, + const Style& style); static void GetAbsolutePosition(const Point& prePoint, const Rect& rect, const Style& style, Point& point); - static void DoDrawLineJoin(BufferInfo& gfxDstBuffer, const Point& center, const Rect& invalidatedArea, const Paint& paint); + static void DoDrawLineJoin(BufferInfo& gfxDstBuffer, + const Point& center, + const Rect& invalidatedArea, + const Paint& paint); }; } // namespace OHOS #endif // GRAPHIC_LITE_UI_CANVAS_H diff --git a/interfaces/kits/components/ui_checkbox.h b/interfaces/kits/components/ui_checkbox.h index a66a84a..cda53a8 100755 --- a/interfaces/kits/components/ui_checkbox.h +++ b/interfaces/kits/components/ui_checkbox.h @@ -224,8 +224,16 @@ public: protected: virtual void ReverseState(); virtual void CalculateSize(); - void SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth); - void UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth); + void SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, + Rect rect, + Rect trunc, + int16_t borderRadius, + int16_t rectLineWidth); + void UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, + Rect rect, + Rect trunc, + int16_t borderRadius, + int16_t rectLineWidth); #if DEFAULT_ANIMATION virtual void ResetCallback(); void Callback(UIView* view) override; diff --git a/interfaces/kits/components/ui_view.h b/interfaces/kits/components/ui_view.h index 116e5e1..e87d144 100755 --- a/interfaces/kits/components/ui_view.h +++ b/interfaces/kits/components/ui_view.h @@ -48,14 +48,13 @@ #endif #include "gfx_utils/color.h" #include "gfx_utils/geometry2d.h" +#include "gfx_utils/graphic_buffer.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/heap_base.h" #include "gfx_utils/image_info.h" #include "gfx_utils/style.h" #include "gfx_utils/transform.h" -#include "engines/gfx/gfx_engine_manager.h" - namespace OHOS { /* Enumerates view types. */ enum UIViewType : uint8_t { diff --git a/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.cpp b/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.cpp index e3ee1e3..3a1f4f6 100755 --- a/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.cpp +++ b/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.cpp @@ -34,7 +34,6 @@ void UITestViewScaleRotate::SetUp() list_->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, 0, width, height + 1); container_->Add(list_); } - RenderManager::GetInstance().RegisterFPSChangedListener(this); } void UITestViewScaleRotate::TearDown() diff --git a/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.h b/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.h index 57499b2..7fd161c 100755 --- a/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.h +++ b/test/uitest/test_view_scale_rotate/ui_test_view_scale_rotate.h @@ -30,10 +30,10 @@ #include "layout/list_layout.h" #include "gfx_utils/sys_info.h" #include "ui_test.h" -#include "stdio.h" +#include namespace OHOS { -class UITestViewScaleRotate : public UITest, public AnimatorCallback, public SysInfo::OnFPSChangedListener { +class UITestViewScaleRotate : public UITest, public AnimatorCallback { public: UITestViewScaleRotate() : animator_(this, nullptr, 1000, true) // 1000: the animator duration time is 1000ms { @@ -51,13 +51,6 @@ public: void UIKit_View_Scale_Rotate_Test_UICircleProgress_005(); void UIKit_View_Scale_Rotate_Test_UIDigitalClock_006(); void UIKit_View_Scale_Rotate_Test_Group_007(); - - virtual void OnFPSChanged(float newFPS) override - { - //printf("view scale rotate: %f\n", newFPS); - GRAPHIC_LOGE("view scale rotate: %f\n", newFPS); - } - private: const int GROUP_WIDHT = 454; const int GROUP_HEIGHT = 300; diff --git a/tools/qt/simulator/drivers/display/monitor.cpp b/tools/qt/simulator/drivers/display/monitor.cpp index 77be69a..17d31de 100755 --- a/tools/qt/simulator/drivers/display/monitor.cpp +++ b/tools/qt/simulator/drivers/display/monitor.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,17 @@ #include "common/graphic_startup.h" #include "common/image_decode_ability.h" #include "common/input_device_manager.h" +#include "draw/draw_utils.h" #include "font/ui_font.h" #include "font/ui_font_header.h" #include "font/ui_font_vector.h" #include "key_input.h" #include "mouse_input.h" -#include "draw/draw_utils.h" #include "mousewheel_input.h" +#include "windows.h" namespace OHOS { -bool Monitor::bRegister_ = false; +bool Monitor::isRegister_ = false; void Monitor::InitHal() { @@ -56,7 +57,7 @@ BufferInfo* Monitor::GetBufferInfo() bufferInfo->mode = ARGB8888; bufferInfo->color = 0x44; bufferInfo->phyAddr = bufferInfo->virAddr = tftFb_; - bufferInfo->stride = HORIZONTAL_RESOLUTION * DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3; + bufferInfo->stride = HORIZONTAL_RESOLUTION * (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); // 3: Shift right 3 bits bufferInfo->width = HORIZONTAL_RESOLUTION; bufferInfo->height = VERTICAL_RESOLUTION; } diff --git a/tools/qt/simulator/drivers/display/monitor.h b/tools/qt/simulator/drivers/display/monitor.h index 2eee21a..0c7cdb8 100755 --- a/tools/qt/simulator/drivers/display/monitor.h +++ b/tools/qt/simulator/drivers/display/monitor.h @@ -16,10 +16,9 @@ #ifndef GRAPHIC_LITE_MONITOR_H #define GRAPHIC_LITE_MONITOR_H -#include -#include "dock/screen_device.h" -#include "font/ui_font_header.h" #include "engines/gfx/gfx_engine_manager.h" +#include "font/ui_font_header.h" +#include namespace OHOS { class Monitor : public QObject, public BaseGfxEngine { @@ -30,9 +29,9 @@ public: static Monitor* GetInstance() { static Monitor instance; - if (!bRegister_) { + if (!isRegister_) { BaseGfxEngine::InitGfxEngine(&instance); - bRegister_ = true; + isRegister_ = true; } return &instance; } @@ -61,7 +60,7 @@ private: uint32_t tftFb_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION]; uint32_t animaterBuffer_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION]; uint32_t defaultColor_; - static bool bRegister_; + static bool isRegister_; }; } // namespace OHOS diff --git a/tools/qt/simulator/libui/libui.pro b/tools/qt/simulator/libui/libui.pro index 2fc037a..770e7f2 100644 --- a/tools/qt/simulator/libui/libui.pro +++ b/tools/qt/simulator/libui/libui.pro @@ -133,8 +133,6 @@ HEADERS += \ ../../../../frameworks/dfx/point_event_injector.h \ ../../../../frameworks/dock/input_device.h \ ../../../../frameworks/dock/pointer_input_device.h \ - ../../../../frameworks/dock/screen_device.h \ - ../../../../frameworks/dock/screen_device_proxy.h \ ../../../../frameworks/dock/virtual_input_device.h \ ../../../../frameworks/draw/draw_arc.h \ ../../../../frameworks/draw/draw_curve.h \ diff --git a/tools/qt/simulator/uitest/UITest.pro b/tools/qt/simulator/uitest/UITest.pro index 32ab8ed..2d062a9 100755 --- a/tools/qt/simulator/uitest/UITest.pro +++ b/tools/qt/simulator/uitest/UITest.pro @@ -88,8 +88,8 @@ SOURCES += \ ../../../../frameworks/dock/key_input_device.cpp \ ../../../../frameworks/dock/pointer_input_device.cpp \ ../../../../frameworks/dock/rotate_input_device.cpp \ - ../../../../frameworks/dock/screen_device_proxy.cpp \ ../../../../frameworks/dock/virtual_input_device.cpp \ + ../../../../frameworks/engines/gfx/gfx_engine_manager.cpp \ ../../../../frameworks/draw/draw_arc.cpp \ ../../../../frameworks/draw/draw_curve.cpp \ ../../../../frameworks/draw/draw_image.cpp \ @@ -202,8 +202,6 @@ HEADERS += \ ../../../../frameworks/dfx/point_event_injector.h \ ../../../../frameworks/dock/input_device.h \ ../../../../frameworks/dock/pointer_input_device.h \ - ../../../../frameworks/dock/screen_device.h \ - ../../../../frameworks/dock/screen_device_proxy.h \ ../../../../frameworks/dock/virtual_input_device.h \ ../../../../frameworks/draw/draw_arc.h \ ../../../../frameworks/draw/draw_curve.h \ @@ -225,6 +223,7 @@ HEADERS += \ ../../../../interfaces/innerkits/dock/focus_manager.h \ ../../../../interfaces/innerkits/dock/rotate_input_device.h \ ../../../../interfaces/innerkits/dock/vibrator_manager.h \ + ../../../../interfaces/innerkits/engines/gfx/gfx_engine_manager.h \ ../../../../interfaces/kits/animator/animator.h \ ../../../../interfaces/kits/animator/easing_equation.h \ ../../../../interfaces/kits/animator/interpolation.h \ -- GitLab