From fb4f9f1f0c863789567439bed7161897de95a84c Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Thu, 13 May 2021 14:46:28 +0800 Subject: [PATCH] IssueNo:#I3R5CP Description:fix codestyle Sig:graphic Feature or Bugfix:Bugfix Binary Source:No --- frameworks/components/ui_canvas.cpp | 2 +- frameworks/components/ui_chart.cpp | 6 ++-- frameworks/components/ui_checkbox.cpp | 12 +++++-- frameworks/components/ui_toggle_button.cpp | 23 +++++-------- frameworks/draw/draw_arc.cpp | 32 ++++++++++-------- frameworks/draw/draw_arc.h | 3 +- frameworks/draw/draw_label.cpp | 4 +-- frameworks/draw/draw_line.cpp | 2 +- frameworks/draw/draw_utils.cpp | 4 +-- interfaces/kits/font/ui_font_header.h | 33 ------------------- .../ui_test_view_scale_rotate.h | 4 +-- .../qt/simulator/drivers/display/monitor.cpp | 3 +- tools/qt/simulator/drivers/display/monitor.h | 3 +- 13 files changed, 52 insertions(+), 79 deletions(-) diff --git a/frameworks/components/ui_canvas.cpp b/frameworks/components/ui_canvas.cpp index 4d7bc2b..ef35024 100755 --- a/frameworks/components/ui_canvas.cpp +++ b/frameworks/components/ui_canvas.cpp @@ -687,7 +687,7 @@ void UICanvas::DoDrawImage(BufferInfo& gfxDstBuffer, cordsTmp.SetPosition(start.x, start.y); cordsTmp.SetHeight(imageParam->height); cordsTmp.SetWidth(imageParam->width); - DrawImage::DrawCommon(gfxDstBuffer,cordsTmp, invalidatedArea, + DrawImage::DrawCommon(gfxDstBuffer, cordsTmp, invalidatedArea, imageParam->image->GetPath(), style, paint.GetOpacity()); } diff --git a/frameworks/components/ui_chart.cpp b/frameworks/components/ui_chart.cpp index 611dcf2..bdd8014 100755 --- a/frameworks/components/ui_chart.cpp +++ b/frameworks/components/ui_chart.cpp @@ -746,8 +746,7 @@ void UIChartPolyline::DrawGradientColor(BufferInfo& gfxDstBuffer, } start.y = enableReverse_ ? (start.y - startY) : (startY - start.y); end.y = enableReverse_ ? (end.y - startY) : (startY - end.y); - polyLine.start = start; - polyLine.end = end; + polyLine = { start, end }; FindCrossPoints(linePoints, polyLine, cross); if (cross.firstFind && cross.secondFind) { cross.first.y = enableReverse_ ? (cross.first.y + startY) : (startY - cross.first.y); @@ -760,8 +759,7 @@ void UIChartPolyline::DrawGradientColor(BufferInfo& gfxDstBuffer, } if (cross.firstFind && !cross.secondFind) { - cross.second.x = limitPoints.end.x; - cross.second.y = y; + cross.second = { limitPoints.end.x, y }; cross.first.y = y; BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, cross.first, cross.second, invalidatedArea, 1, data->GetFillColor(), mixData_[mixScale]); diff --git a/frameworks/components/ui_checkbox.cpp b/frameworks/components/ui_checkbox.cpp index 457deeb..a8acf0a 100755 --- a/frameworks/components/ui_checkbox.cpp +++ b/frameworks/components/ui_checkbox.cpp @@ -156,15 +156,21 @@ void UICheckBox::SelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, styleSelect.lineOpa_ = backgroundOpacity_; uint8_t opa = DrawUtils::GetMixOpacity(opaScale_, backgroundOpacity_); BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoLeft, trunc, styleSelect, opaScale_, CapType::CAP_NONE); + // 2 : double BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, start, mid, trunc, rectLineWidth * 2, Color::White(), - opa); // 2 : double + opa); BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoMid, trunc, styleSelect, opaScale_, CapType::CAP_NONE); + // 2 : double BaseGfxEngine::GetInstance()->DrawLine(gfxDstBuffer, mid, end, trunc, rectLineWidth * 2, Color::White(), - opa); // 2 : double + opa); BaseGfxEngine::GetInstance()->DrawArc(gfxDstBuffer, arcInfoRight, trunc, styleSelect, opaScale_, CapType::CAP_NONE); } -void UICheckBox::UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, Rect rect, Rect trunc, int16_t borderRadius, int16_t rectLineWidth) +void UICheckBox::UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, + Rect rect, + Rect trunc, + int16_t borderRadius, + int16_t rectLineWidth) { Rect contentRect = GetContentRect(); Style styleUnSelect = StyleDefault::GetBackgroundTransparentStyle(); diff --git a/frameworks/components/ui_toggle_button.cpp b/frameworks/components/ui_toggle_button.cpp index 6bb913f..0067541 100755 --- a/frameworks/components/ui_toggle_button.cpp +++ b/frameworks/components/ui_toggle_button.cpp @@ -69,15 +69,16 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre rectMid.SetRect(x, y, x + rectWidth_, y + (corner_ << 1) + 1); Rect trunc = invalidatedArea; bool isIntersect = trunc.Intersect(trunc, contentRect); + if (isIntersect == false) { + return; + } switch (state_) { case SELECTED: { Style styleSelect = StyleDefault::GetBackgroundTransparentStyle(); styleSelect.borderRadius_ = corner_; styleSelect.bgColor_ = Color::GetColorFromRGB(DEFAULT_BG_RED, DEFAULT_BG_GREEN, DEFAULT_BG_BLUE); styleSelect.bgOpa_ = OPA_OPAQUE; - if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rectMid, trunc, styleSelect, opaScale_); - } + BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rectMid, trunc, styleSelect, opaScale_); ArcInfo arcInfoRight = { { static_cast(x + rectWidth_ - corner_), static_cast(y + corner_) }, { 0 }, radius_, 0, CIRCLE_IN_DEGREE, nullptr @@ -85,10 +86,8 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre styleSelect.bgColor_ = Color::White(); 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; } case UNSELECTED: { @@ -96,19 +95,15 @@ void UIToggleButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedAre styleUnSelect.bgColor_ = Color::White(); styleUnSelect.bgOpa_ = DEFAULT_UNSELECTED_OPA; styleUnSelect.borderRadius_ = corner_; - if (isIntersect) { - BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rectMid, trunc, styleUnSelect, opaScale_); - } + BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, rectMid, trunc, styleUnSelect, opaScale_); ArcInfo arcInfoLeft = { { static_cast(x + corner_), static_cast(y + corner_) }, { 0 }, radius_, 0, CIRCLE_IN_DEGREE, nullptr }; 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; } default: diff --git a/frameworks/draw/draw_arc.cpp b/frameworks/draw/draw_arc.cpp index 52e838b..2486042 100755 --- a/frameworks/draw/draw_arc.cpp +++ b/frameworks/draw/draw_arc.cpp @@ -197,7 +197,11 @@ void DrawArc::DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, } } -void DrawArc::DrawAxisLine(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa) +void DrawArc::DrawAxisLine(BufferInfo& gfxDstBuffer, + ArcInfo& arcInfo, + const Rect& mask, + const Style& style, + uint8_t opa) { int16_t lineWidth = 0; int16_t outRadius = outRadius_ - 1; @@ -209,22 +213,22 @@ void DrawArc::DrawAxisLine(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rec lineWidth = outRadius - inRadius; if (isCircle_ || (IS_IN_DEGREERANE(THREE_QUARTER_IN_DEGREE, arcInfo.startAngle, arcInfo.endAngle))) { - DrawHorLine(gfxDstBuffer, Point{static_cast(arcInfo.center.x - outRadius), arcInfo.center.y}, + DrawHorLine(gfxDstBuffer, Point { static_cast(arcInfo.center.x - outRadius), arcInfo.center.y }, arcInfo.imgPos, mask, lineWidth, style, opa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(QUARTER_IN_DEGREE, arcInfo.startAngle, arcInfo.endAngle))) { - DrawHorLine(gfxDstBuffer, Point{static_cast(arcInfo.center.x + inRadius), arcInfo.center.y}, + DrawHorLine(gfxDstBuffer, Point { static_cast(arcInfo.center.x + inRadius), arcInfo.center.y }, arcInfo.imgPos, mask, lineWidth, style, opa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(0, arcInfo.startAngle, arcInfo.endAngle))) { - DrawVerLine(gfxDstBuffer, Point{arcInfo.center.x, static_cast(arcInfo.center.y - outRadius)}, + DrawVerLine(gfxDstBuffer, Point { arcInfo.center.x, static_cast(arcInfo.center.y - outRadius) }, arcInfo.imgPos, mask, lineWidth, style, opa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(SEMICIRCLE_IN_DEGREE, arcInfo.startAngle, arcInfo.endAngle))) { - DrawVerLine(gfxDstBuffer, Point{arcInfo.center.x, static_cast(arcInfo.center.y + inRadius)}, + DrawVerLine(gfxDstBuffer, Point { arcInfo.center.x, static_cast(arcInfo.center.y + inRadius) }, arcInfo.imgPos, mask, lineWidth, style, opa, arcInfo.imgSrc); } } @@ -240,9 +244,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); @@ -260,7 +264,7 @@ void DrawArc::DrawLineWithDegree(BufferInfo& gfxDstBuffer, return; case IN_DEGREE_RANG: DrawHorLine(gfxDstBuffer, - Point{static_cast(arcInfo.center.x + start), static_cast(arcInfo.center.y + y)}, + Point { static_cast(arcInfo.center.x + start), static_cast(arcInfo.center.y + y) }, arcInfo.imgPos, mask, end - start, style, opaScale, arcInfo.imgSrc); return; case INTERSECT: @@ -306,7 +310,7 @@ int16_t DrawArc::DrawLineWithDegreeInner(BufferInfo& gfxDstBuffer, } if ((drawStart != COORD_MIN) && (drawEnd != COORD_MIN)) { DrawHorLine(gfxDstBuffer, - Point{static_cast(arcInfo.center.x + drawStart), static_cast(arcInfo.center.y + y)}, + Point { static_cast(arcInfo.center.x + drawStart), static_cast(arcInfo.center.y + y) }, arcInfo.imgPos, mask, drawEnd - drawStart, style, opaScale, arcInfo.imgSrc); } return drawEnd; @@ -367,22 +371,22 @@ void DrawArc::DrawPointAnti(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, int16_t if (isCircle_ || (IS_IN_DEGREERANE(CIRCLE_IN_DEGREE - degreeBase, arcInfo.startAngle, arcInfo.endAngle))) { startX = arcInfo.center.x + x; starty = arcInfo.center.y + y_; - DrawHorLine(gfxDstBuffer, Point{startX, starty}, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); + DrawHorLine(gfxDstBuffer, Point { startX, starty }, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(SEMICIRCLE_IN_DEGREE + degreeBase, arcInfo.startAngle, arcInfo.endAngle))) { startX = arcInfo.center.x + x; starty = arcInfo.center.y - y_; - DrawHorLine(gfxDstBuffer, Point{startX, starty}, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); + DrawHorLine(gfxDstBuffer, Point { startX, starty }, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(degreeBase, arcInfo.startAngle, arcInfo.endAngle))) { startX = arcInfo.center.x - x; starty = arcInfo.center.y + y_; - DrawHorLine(gfxDstBuffer, Point{startX, starty}, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); + DrawHorLine(gfxDstBuffer, Point { startX, starty }, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); } if (isCircle_ || (IS_IN_DEGREERANE(SEMICIRCLE_IN_DEGREE - degreeBase, arcInfo.startAngle, arcInfo.endAngle))) { startX = arcInfo.center.x - x; starty = arcInfo.center.y - y_; - DrawHorLine(gfxDstBuffer, Point{startX, starty}, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); + DrawHorLine(gfxDstBuffer, Point { startX, starty }, arcInfo.imgPos, mask, 0, style, antiOpa, arcInfo.imgSrc); } } #endif diff --git a/frameworks/draw/draw_arc.h b/frameworks/draw/draw_arc.h index bd63215..5a39f77 100755 --- a/frameworks/draw/draw_arc.h +++ b/frameworks/draw/draw_arc.h @@ -113,7 +113,8 @@ private: int16_t GetDrawAngle(int16_t angle); - void DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa, bool anti); + void DrawCircleNoEndpoint(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, + uint8_t opa, bool anti); void DrawAxisLine(BufferInfo& gfxDstBuffer, ArcInfo& arcInfo, const Rect& mask, const Style& style, uint8_t opa); diff --git a/frameworks/draw/draw_label.cpp b/frameworks/draw/draw_label.cpp index 5c34197..f68de7a 100755 --- a/frameworks/draw/draw_label.cpp +++ b/frameworks/draw/draw_label.cpp @@ -115,7 +115,7 @@ void DrawLabel::DrawArcText(BufferInfo& gfxDstBuffer, TypedText::GetArcLetterPos(arcCenter, arcTextInfo.radius, angle, posX, posY); angle += incrementAngle; - DrawLetterWithRotate(gfxDstBuffer, mask, fontId, letter, Point{MATH_ROUND(posX), MATH_ROUND(posY)}, + DrawLetterWithRotate(gfxDstBuffer, mask, fontId, letter, Point { MATH_ROUND(posX), MATH_ROUND(posY) }, static_cast(rotateAngle), style.textColor_, opaScale); } } @@ -165,7 +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, + BaseGfxEngine::GetInstance()->DrawTransform(gfxDstBuffer, mask, Point { 0, 0 }, color, opaScale, transMap, letterTranDataInfo); } } // namespace OHOS diff --git a/frameworks/draw/draw_line.cpp b/frameworks/draw/draw_line.cpp index 7cfd7ef..fd2edb3 100755 --- a/frameworks/draw/draw_line.cpp +++ b/frameworks/draw/draw_line.cpp @@ -181,7 +181,7 @@ void DrawLine::DrawWuLine(BufferInfo& gfxDstBuffer, const Point& start, const Po // width is longer than distance between start point and end point, need swap direction of line. if (dx * dx + dy * dy < width * width) { if ((dx == 1) && (dy == 1)) { - DrawThinWuLine(gfxDstBuffer, { x0Int, y0Int }, { x3Int, y3Int }, mask, 2, color, opacity); // 2 : width of line + DrawThinWuLine(gfxDstBuffer, { x0Int, y0Int }, { x3Int, y3Int }, mask, 2, color, opacity); // 2 : line width return; } dx = MATH_ABS(x0Int - x1Int); diff --git a/frameworks/draw/draw_utils.cpp b/frameworks/draw/draw_utils.cpp index 55cfcbe..fd23517 100755 --- a/frameworks/draw/draw_utils.cpp +++ b/frameworks/draw/draw_utils.cpp @@ -562,7 +562,7 @@ void DrawUtils::BlendWithSoftWare(const uint8_t* src1, uint8_t* dest = dst + destStride * y; dest += destByteSize * x; - uint8_t pxByteSize = GetPxSizeByColorMode(srcMode) >> 3; + uint8_t pxByteSize = GetPxSizeByColorMode(srcMode) >> 3; // 3 : right shift 3 bits uint8_t* src = const_cast(src1) + srcStride * srcRect.GetY() + pxByteSize * srcRect.GetX(); uint32_t width = srcRect.GetWidth(); uint32_t height = srcRect.GetHeight(); @@ -862,7 +862,7 @@ void DrawUtils::DrawTriangleTrueColorBilinear888(const TriangleScanInfo& in, con static void DrawTriangleTrueColorBilinear8888Inner(const TriangleScanInfo& in, uint8_t* screenBuffer, int16_t len, - const ColorMode bufferMode, + const ColorMode bufferMode, int32_t u, int32_t v) { diff --git a/interfaces/kits/font/ui_font_header.h b/interfaces/kits/font/ui_font_header.h index 8ece15d..57ce84e 100755 --- a/interfaces/kits/font/ui_font_header.h +++ b/interfaces/kits/font/ui_font_header.h @@ -376,38 +376,5 @@ struct FileCommonHeader { uint32_t fileLength; }; #pragma pack() - -/** - * @brief Get the Text Lang Fonts Table - * @param uint8_t langFontId [in] the font id - * @return UITextLanguageFontParam* the font table, definition is in font tool - */ -UITextLanguageFontParam* GetTextLangFontsTable(uint8_t langFontId); - -/** - * @brief Get the Total Lang Id - * @return uint8_t the total Lang id, definition is in font tool - */ -uint8_t GetTotalLangId(); - -/** - * @brief Get the Total Font Id - * @return uint8_t the total font id, definition is in font tool - */ -uint8_t GetTotalFontId(); - -uint8_t GetBitmapFontIdMax(); - -/** - * @brief Get the Total Text Id - * @return uint8_t the total text id, definition is in font tool - */ -uint16_t GetTotalTextId(); - -/** - * @brief Get the Lang Text default param table - * @return LangTextParam* the param table, definition is in font tool - */ -LangTextParam* GetLangTextDefaultParamTable(); } // namespace OHOS #endif /* UI_FONT_HEADER_H */ \ No newline at end of file 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 7fd161c..2b44e42 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 @@ -16,6 +16,7 @@ #ifndef UI_TEST_VIEW_SCALE_ROTATE_H #define UI_TEST_VIEW_SCALE_ROTATE_H +#include #include "components/ui_arc_label.h" #include "components/ui_box_progress.h" #include "components/ui_button.h" @@ -27,10 +28,9 @@ #include "components/ui_scroll_view.h" #include "components/ui_slider.h" #include "components/ui_swipe_view.h" -#include "layout/list_layout.h" #include "gfx_utils/sys_info.h" +#include "layout/list_layout.h" #include "ui_test.h" -#include namespace OHOS { class UITestViewScaleRotate : public UITest, public AnimatorCallback { diff --git a/tools/qt/simulator/drivers/display/monitor.cpp b/tools/qt/simulator/drivers/display/monitor.cpp index 3137b11..ce910b2 100755 --- a/tools/qt/simulator/drivers/display/monitor.cpp +++ b/tools/qt/simulator/drivers/display/monitor.cpp @@ -72,7 +72,8 @@ BufferInfo* Monitor::GetBufferInfo() bufferInfo->mode = ARGB8888; bufferInfo->color = 0x44; bufferInfo->phyAddr = bufferInfo->virAddr = tftFb_; - bufferInfo->stride = HORIZONTAL_RESOLUTION * (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); // 3: Shift right 3 bits + // 3: Shift right 3 bits + bufferInfo->stride = HORIZONTAL_RESOLUTION * (DrawUtils::GetPxSizeByColorMode(bufferInfo->mode) >> 3); 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 fb1a426..c2098fa 100755 --- a/tools/qt/simulator/drivers/display/monitor.h +++ b/tools/qt/simulator/drivers/display/monitor.h @@ -16,9 +16,10 @@ #ifndef GRAPHIC_LITE_MONITOR_H #define GRAPHIC_LITE_MONITOR_H +#include + #include "engines/gfx/gfx_engine_manager.h" #include "font/ui_font_header.h" -#include namespace OHOS { class Monitor : public QObject, public BaseGfxEngine { -- GitLab