提交 3cd6f964 编写于 作者: L liuyuxiang-bear

Fix revise-issue.

Signed-off-by: Nliuyuxiang-bear <liuyuxiang7@huawei.com>
上级 b6f74d8e
......@@ -51,7 +51,7 @@ The graphics UI directly calls the HAL API or uses the client provided by the Wi
├── interfaces # APIs
│ ├── innerkits # APIs between modules
│ │ └── xxx # Sub-module APIs
│ └── kits # Externel APIs
│ └── kits # External APIs
│ │ └── xxx # Sub-module APIs
├── test # Test code
│ ├── framework
......
......@@ -83,7 +83,7 @@
(1) ColorMode新增TSC6枚举 类型。
(2) UIImageView成员变量colorFromat由4位修改为8位。
(2) UIImageView成员变量colorFormat由4位修改为8位。
(3) 合入时间2021.6.17
......
......@@ -21,7 +21,7 @@ namespace OHOS {
/* B(t) = P0*(1-t)^3 + 3*P1*t*(1-t)^2 + 3*P2*t^2*(1-t) + P3*t^3 */
int16_t Interpolation::GetBezierInterpolation(int16_t t, int16_t u0, int16_t u1, int16_t u2, int16_t u3)
{
int64_t invT = 1024 - t; // Intergerlize the standard equation, 1.0f is devided into 1024 parts
int64_t invT = 1024 - t; // Intergerlize the standard equation, 1.0f is divided into 1024 parts
int64_t invT2 = invT * invT;
int64_t invT3 = invT2 * invT;
int64_t t2 = t * t;
......@@ -31,8 +31,10 @@ int16_t Interpolation::GetBezierInterpolation(int16_t t, int16_t u0, int16_t u1,
ret += BEZIER_COEFFICIENT * invT2 * t * u1;
ret += BEZIER_COEFFICIENT * invT * t2 * u2;
ret += t3 * u3;
ret = ret >> 30; // 30: cubic shift
return static_cast<int16_t>(ret);
uint64_t uret = (ret < 0) ? (-ret) : ret;
int16_t value = static_cast<int16_t>(uret >> 30); // 30: cubic shift
return (ret < 0) ? (-value) : value;
}
/* B(t) = P0*(1-t)^3 + 3*P1*t*(1-t)^2 + 3*P2*t^2*(1-t) + P3*t^3 */
......@@ -76,7 +78,7 @@ float Interpolation::GetBezierY(float x, float x1, float y1, float x2, float y2)
/* Attention: precision must be carefully selected
* too small may lead to misconvergence and a decrease of performance
* too large may cause the curve rugged even make some points outlier */
constexpr float PRECISION = 0.05f; // 0.05f make serveral outliers near inflection point
constexpr float PRECISION = 0.05f; // 0.05f make several outliers near inflection point
/* Newton Method to solve t from x */
while (MATH_ABS(xt - x) > PRECISION) {
......
......@@ -131,7 +131,7 @@ void Text::SetFont(const char* name, uint8_t size, char*& destName, uint8_t& des
void Text::SetFontId(uint8_t fontId)
{
if ((fontId >= UIFontBuilder::GetInstance()->GetTotalFontId()) || ((fontId_ == fontId) && (fontSize_ != 0))) {
GRAPHIC_LOGE("Text::SetFontId invalid fontId(%d)", fontId);
GRAPHIC_LOGE("Text::SetFontId invalid fontId(%hhd)", fontId);
return;
}
UITextLanguageFontParam* fontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId);
......
......@@ -65,16 +65,16 @@ void UICheckBox::SetState(UICheckBoxState state, bool needAnimater)
}
state_ = state;
if ((image_[SELECTED].GetSrcType() == IMG_SRC_UNKNOWN) || (image_[UNSELECTED].GetSrcType() == IMG_SRC_UNKNOWN)) {
if (needAnimater) {
#if DEFAULT_ANIMATION
if (needAnimater) {
checkBoxAnimator_.Start();
ResetCallback();
#else
backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
#endif
} else {
backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
}
#else
backgroundOpacity_ = (state_ == SELECTED) ? OPA_OPAQUE : 0;
#endif
}
if (onStateChangeListener_ != nullptr) {
onStateChangeListener_->OnChange(state);
......
......@@ -225,7 +225,7 @@ UIImageView::UIImageView()
imageHeight_(0),
autoEnable_(true),
needRefresh_(false),
colorFormat_(UNKNOW),
colorFormat_(UNKNOWN),
blurLevel_(BlurLevel::LEVEL0),
algorithm_(TransformAlgorithm::BILINEAR),
reserve_(0)
......
......@@ -193,7 +193,7 @@ void UITimePicker::TimeSelectedCallback()
void UITimePicker::GetValueByIndex(char* value, uint8_t len, uint16_t index, int16_t start, int16_t end)
{
if ((value != nullptr) && (index < end - start + 1)) {
if (sprintf_s(value, len, "%02d", index) < 0) {
if (sprintf_s(value, len, "%02u", index) < 0) {
return;
}
}
......
......@@ -83,7 +83,7 @@ UIView::~UIView()
bool UIView::OnPreDraw(Rect& invalidatedArea) const
{
Rect rect(GetRect());
int16_t r = style_->borderRadius_;
uint16_t r = style_->borderRadius_; // radius must be positive
if (r == COORD_MAX) {
return true;
}
......@@ -298,6 +298,9 @@ void UIView::Shear(const Vector2<float>& shearX, const Vector2<float>& shearY, c
if (transMap_ == nullptr) {
ReMeasure();
transMap_ = new TransformMap();
if (transMap_ == nullptr) {
return;
}
}
bool firstTrans = transMap_->IsInvalid();
Rect joinRect = transMap_->GetBoxRect();
......
......@@ -314,7 +314,7 @@ void UIDumpDomTree::OutputDomTree(UIView* view, cJSON* usr)
GRAPHIC_LOGE("UIDumpDomTree::OutputDomTree cJSON create object failed Err!\n");
return;
}
/* usr must be a array. */
/* usr must be an array. */
cJSON_AddItemToArray(usr, dumpUsr);
}
......
/*
* Copyright (c) 2020 Huawei Device Co., Ltd.
* 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.
* You may obtain a copy of the License at
......
......@@ -80,7 +80,7 @@ RetCode FileImgDecoder::GetHeader(ImgResDsc& dsc)
if (readCount != sizeof(ImageHeader)) {
dsc.imgInfo.header.width = 0;
dsc.imgInfo.header.height = 0;
dsc.imgInfo.header.colorMode = UNKNOW;
dsc.imgInfo.header.colorMode = UNKNOWN;
return RetCode::FAIL;
}
......
......@@ -37,7 +37,7 @@ void Window::DestoryWindow(Window* window)
WindowImpl* windowImpl = reinterpret_cast<WindowImpl*>(window);
windowImpl->RemoveFromDisplay();
windowImpl->UnbindRootView();
windowImpl->Destory();
windowImpl->Destroy();
delete windowImpl;
}
}
......
......@@ -42,7 +42,7 @@ bool WindowImpl::Create(const WindowConfig& config)
return true;
}
void WindowImpl::Destory()
void WindowImpl::Destroy()
{
Flush();
if (iWindow_ != nullptr) {
......
......@@ -45,7 +45,7 @@ public:
void Update();
void Flush();
bool Create(const WindowConfig& config);
void Destory();
void Destroy();
void AddToDisplay();
void RemoveFromDisplay();
......
......@@ -319,7 +319,7 @@ private:
#if LOCAL_RENDER
void RemoveViewFromInvalidMap(UIView *view);
void DrawInvalidMap(const Rect &buffRect);
void OptimizeInvalidView(UIView* curview, UIView* backgroud, List<Rect> &renderedRects);
void OptimizeInvalidView(UIView* curview, UIView* background, List<Rect> &renderedRects);
void OptimizeInvalidMap();
std::map<UIView*, Graphic::Vector<Rect>> invalidateMap_;
......
......@@ -51,7 +51,7 @@ public:
* @brief Get font id
*
* @param ttfName
* @param size 0: invaild size
* @param size 0: invalid size
* @return uint8_t
*/
virtual uint8_t GetFontId(const char* ttfName, uint8_t size) const = 0;
......
......@@ -152,7 +152,7 @@ bool CompareTools::SaveByBit(uint32_t fd)
struct BitmapInfoHeader bitmapInfo = {0};
bitmapInfo.bfSize = imageBit.dataSize + BITMAP_HEADER_SIZE;
bitmapInfo.bfOffBits = BITMAP_HEADER_SIZE;
bitmapInfo.biSize = 40; // 40: bitmap infomation header size
bitmapInfo.biSize = 40; // 40: bitmap information header size
bitmapInfo.biWidth = imageBit.header.width;
bitmapInfo.biHeight = -imageBit.header.height;
bitmapInfo.biPlanes = 1;
......
......@@ -609,7 +609,7 @@ void UITestBorderMarginPadding::UIKit_UITestBorderMarginPadding_Test_015()
UIQrcode* qrcode = new UIQrcode();
qrcode->SetStyle(style_);
qrcode->Resize(60, 60); // 60: height
qrcode->SetQrcodeInfo("Hello\n HarmonyOS Lite GUI");
qrcode->SetQrcodeInfo("Hello\n Test of GUI");
listScroll_->Add(qrcode);
}
......
......@@ -465,7 +465,7 @@ void UITestFont::UIKitFontMultiLanguage001()
#else
label->SetFontId(F_ROBOTOCONDENSED_REGULAR_30_4);
#endif
label->SetText("Hello, HarmonyOS Lite GUI");
label->SetText("Hello, Test of GUI");
container_->Add(label);
positionY_ += LABEL_HEIGHT + GAP;
}
......@@ -494,7 +494,7 @@ void UITestFont::UIKitFontMultiLanguage002()
#else
label->SetFontId(F_ROBOTOCONDENSED_REGULAR_30_4);
#endif
label->SetText("Hello\n HarmonyOS Lite GUI");
label->SetText("Hello\n Test of GUI");
container_->Add(label);
positionY_ += LABEL_HEIGHT * 2 + GAP; // 2 : double
}
......
......@@ -98,7 +98,7 @@ void UITestLabel::UIKit_UILabel_Test_Display_001()
uiViewGroupFrame->SetStyle(STYLE_BORDER_RADIUS, VIEW_STYLE_BORDER_RADIUS);
uiViewGroupFrame->SetStyle(STYLE_BACKGROUND_OPA, 0);
uiLabel = new UILabel();
uiLabel->SetText("HarmonyOS Lite 图形子系统");
uiLabel->SetText("Test of 图形子系统");
uiLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); // 26: font size
uiLabel->SetPosition(0, 141, 280, 336); // 141: y-coordinate; 280: width; 336: height
uiViewGroupFrame->Add(uiLabel);
......@@ -234,14 +234,14 @@ bool UITestLabel::OnClick(UIView& view, const ClickEvent& event)
} else if (&view == labelBeyondBtn1_) {
uiLabel->Resize(288, 35); // 288: width; 35: height
uiLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
uiLabel->SetText("HarmonyOS Lite 图形子系统,HarmonyOS Lite 图形子系统 ");
uiLabel->SetText("Test of 图形子系统,Test of 图形子系统 ");
uiLabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP);
} else if (&view == labelBeyondBtn2_) {
uiLabel->Resize(288, 35); // 288: width; 35: height
uiLabel->SetText("HarmonyOS Lite 图形子系统,HarmonyOS Lite 图形子系统 ");
uiLabel->SetText("Test of 图形子系统,Test of 图形子系统 ");
uiLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
} else if (&view == labelBeyondBtn3_) {
uiLabel->SetText("HarmonyOS Lite 图形子系统,HarmonyOS Lite 图形子系统 ");
uiLabel->SetText("Test of 图形子系统,Test of 图形子系统 ");
uiLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
} else {
ExpandClick(view, event);
......@@ -270,10 +270,10 @@ void UITestLabel::ExpandClick(UIView& view, const ClickEvent& event) const
} else if (&view == labelDirectionBtn2_) {
uiLabel->SetDirect(TEXT_DIRECT_RTL);
} else if (&view == labelSizeBtn1_) {
uiLabel->SetText("HarmonyOS Lite 图形子系统,HarmonyOS Lite 图形子系统 ");
uiLabel->SetText("Test of 图形子系统,Test of 图形子系统 ");
uiLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
} else if (&view == labelSizeBtn2_) {
uiLabel->SetText("HarmonyOS Lite 图形子系统,HarmonyOS Lite 图形子系统 ");
uiLabel->SetText("Test of 图形子系统,Test of 图形子系统 ");
uiLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
}
}
......
......@@ -231,9 +231,6 @@ void UITestOpacity::UIKitOpacityTestUIArcLabel001()
UIArcLabel* label = CreateTestCaseUIArcLabel("01234567", 200); // 200: opacity
group->Add(label);
UIArcLabel* label2 = CreateTestCaseUIArcLabel("01234567", 100); // 100: opacity
if (label2 == nullptr) {
return;
}
label2->SetArcTextCenter(CENTER_X + 200, CENTER_Y + 20); // 200: width 20 : height
group->Add(label2);
container_->Add(group);
......
......@@ -460,7 +460,7 @@ bool UITestCircleProgress::OnClick(UIView& view, const ClickEvent& event)
imgPos.x++;
circleProgress_->SetBackgroundImagePosition(imgPos.x, imgPos.y);
circleProgress_->SetProgressImagePosition(imgPos.x, imgPos.y);
} else if (&view == imgPosXBtn_) {
} else if (&view == imgPosYBtn_) {
imgPos.y++;
circleProgress_->SetBackgroundImagePosition(imgPos.x, imgPos.y);
circleProgress_->SetProgressImagePosition(imgPos.x, imgPos.y);
......
......@@ -75,7 +75,7 @@ void UITestQrcode::UIKitUIQrcodeTestDisplay001()
UIQrcode* qrcode = new UIQrcode();
qrcode->SetPosition(20, 30, 60, 60); // 20 x 30 y 150 width 60 height
const char* str = "Hello\n HarmonyOS Lite GUI";
const char* str = "Hello\n Test of GUI";
qrcode->SetQrcodeInfo(str);
group->Add(qrcode);
container_->Add(group);
......@@ -90,7 +90,7 @@ void UITestQrcode::UIKitUIQrcodeTestDisplay002()
UIQrcode* qrcode = new UIQrcode();
qrcode->SetPosition(20, 30); // 20 x 30 y
const char* str = "Hello\n HarmonyOS Lite GUI";
const char* str = "Hello\n Test of GUI";
qrcode->SetQrcodeInfo(str);
qrcode->SetWidth(120); // 120 width
qrcode->SetHeight(250); // 250 height
......
......@@ -53,7 +53,7 @@ void UITestTextureMapper::SetUp()
uiViewGroupFrame->SetStyle(STYLE_BORDER_RADIUS, VIEW_STYLE_BORDER_RADIUS);
uiViewGroupFrame->SetStyle(STYLE_BACKGROUND_OPA, 0);
textureMapper_ = new UITextureMapper();
textureMapper_->SetPosition(200, 50, 200, 200); // 200:position x; 50: positon y; 200: width; 200: height
textureMapper_->SetPosition(200, 50, 200, 200); // 200:position x; 50: position y; 200: width; 200: height
textureMapper_->SetSrc(RED_IMAGE_PATH);
textureMapper_->SetRotateStart(0);
textureMapper_->SetRotateEnd(360); // 360: the end angle of rotation
......
......@@ -26,7 +26,7 @@ class ViewBitmapListener : public UIView::OnClickListener {
public:
ViewBitmapListener(UIViewGroup* container, UIImageView* img) : container_(container), img_(img)
{
memset_s(&info_, sizeof(ImageInfo), 0, sizeof(ImageInfo));
(void)memset_s(&info_, sizeof(ImageInfo), 0, sizeof(ImageInfo));
if ((img != nullptr) && (container != nullptr)) {
container->Add(img);
img->SetVisible(false);
......
......@@ -38,8 +38,8 @@ namespace {
const float POS_Y_PERCENT = 0.2;
const float DEFAULT_WIDTH_PERCENT = 0.3;
const float DEFAULT_HEIGHT_PERCENT = 0.4;
const float INVAILD_PERCENT_ZERO = 0.0f;
const float INVAILD_PERCENT_ONE = 1.0f;
const float INVALID_PERCENT_ZERO = 0.0f;
const float INVALID_PERCENT_ONE = 1.0f;
const int16_t DEFAULE_ANGLE = 45;
const Vector2<float> VIEW_CENTER = {50, 50};
const Vector2<float> SCALE_VALUE = {0.5f, 0.5f};
......@@ -442,10 +442,10 @@ HWTEST_F(UIViewTest, UIViewSetWidthPercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetWidthPercent failed
view_->SetWidthPercent(INVAILD_PERCENT_ZERO);
// Input invalid percent, SetWidthPercent failed
view_->SetWidthPercent(INVALID_PERCENT_ZERO);
EXPECT_EQ(view_->GetWidth(), DEFAULE_WIDTH);
view_->SetWidthPercent(INVAILD_PERCENT_ONE);
view_->SetWidthPercent(INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetWidth(), DEFAULE_WIDTH);
view_->SetWidthPercent(POS_X_PERCENT);
......@@ -485,10 +485,10 @@ HWTEST_F(UIViewTest, UIViewSetHeightPercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetHeightPercent failed
view_->SetHeightPercent(INVAILD_PERCENT_ZERO);
// Input invalid percent, SetHeightPercent failed
view_->SetHeightPercent(INVALID_PERCENT_ZERO);
EXPECT_EQ(view_->GetHeight(), DEFAULE_HEIGHT);
view_->SetHeightPercent(INVAILD_PERCENT_ONE);
view_->SetHeightPercent(INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetHeight(), DEFAULE_HEIGHT);
view_->SetHeightPercent(POS_Y_PERCENT);
......@@ -530,11 +530,11 @@ HWTEST_F(UIViewTest, UIViewResizePercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, ResizePercent failed
view_->ResizePercent(INVAILD_PERCENT_ZERO, POS_Y_PERCENT);
// Input invalid percent, ResizePercent failed
view_->ResizePercent(INVALID_PERCENT_ZERO, POS_Y_PERCENT);
EXPECT_EQ(view_->GetHeight(), DEFAULE_HEIGHT);
EXPECT_EQ(view_->GetWidth(), DEFAULE_WIDTH);
view_->ResizePercent(POS_X_PERCENT, INVAILD_PERCENT_ONE);
view_->ResizePercent(POS_X_PERCENT, INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetHeight(), DEFAULE_HEIGHT);
EXPECT_EQ(view_->GetWidth(), DEFAULE_WIDTH);
......@@ -576,10 +576,10 @@ HWTEST_F(UIViewTest, UIViewSetXPercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetXPercent failed
view_->SetXPercent(INVAILD_PERCENT_ZERO);
// Input invalid percent, SetXPercent failed
view_->SetXPercent(INVALID_PERCENT_ZERO);
EXPECT_EQ(view_->GetX(), POS_X);
view_->SetXPercent(INVAILD_PERCENT_ONE);
view_->SetXPercent(INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetX(), POS_X);
view_->SetXPercent(POS_X_PERCENT);
......@@ -619,10 +619,10 @@ HWTEST_F(UIViewTest, UIViewSetYPercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetYPercent failed
view_->SetYPercent(INVAILD_PERCENT_ZERO);
// Input invalid percent, SetYPercent failed
view_->SetYPercent(INVALID_PERCENT_ZERO);
EXPECT_EQ(view_->GetY(), POS_Y);
view_->SetYPercent(INVAILD_PERCENT_ONE);
view_->SetYPercent(INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetY(), POS_Y);
view_->SetYPercent(POS_Y_PERCENT);
......@@ -664,8 +664,8 @@ HWTEST_F(UIViewTest, UIViewSetPositionPercent_001, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetPositionPercent failed
view_->SetPositionPercent(INVAILD_PERCENT_ZERO, INVAILD_PERCENT_ONE);
// Input invalid percent, SetPositionPercent failed
view_->SetPositionPercent(INVALID_PERCENT_ZERO, INVALID_PERCENT_ONE);
EXPECT_EQ(view_->GetX(), POS_X);
EXPECT_EQ(view_->GetY(), POS_Y);
......@@ -713,8 +713,8 @@ HWTEST_F(UIViewTest, UIViewSetPositionPercent_002, TestSize.Level0)
viewGroup->SetWidth(DEFAULE_WIDTH);
viewGroup->SetHeight(DEFAULE_HEIGHT);
// Input invaild percent, SetPositionPercent failed
view_->SetPositionPercent(INVAILD_PERCENT_ZERO, INVAILD_PERCENT_ONE, DEFAULT_WIDTH_PERCENT, DEFAULT_HEIGHT_PERCENT);
// Input invalid percent, SetPositionPercent failed
view_->SetPositionPercent(INVALID_PERCENT_ZERO, INVALID_PERCENT_ONE, DEFAULT_WIDTH_PERCENT, DEFAULT_HEIGHT_PERCENT);
EXPECT_EQ(view_->GetHeight(), DEFAULE_HEIGHT);
EXPECT_EQ(view_->GetWidth(), DEFAULE_WIDTH);
EXPECT_EQ(view_->GetX(), POS_X);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册