提交 8a734f0b 编写于 作者: Y youbing

Description: Code alarm processing#5

IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I5WD6I
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: youbing54<youbing3@huawei.com>
上级 14157308
...@@ -82,7 +82,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf ...@@ -82,7 +82,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf
labelLine.style.lineSpace_, labelLine.style.lineSpace_,
havebackgroundColor, havebackgroundColor,
backgroundColor}; backgroundColor};
#if ENABLE_VECTOR_FONT #if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
glyphNode.textStyle = letterInfo.textStyle; glyphNode.textStyle = letterInfo.textStyle;
#endif #endif
glyphNode.advance = 0; glyphNode.advance = 0;
......
...@@ -91,12 +91,12 @@ namespace OHOS { ...@@ -91,12 +91,12 @@ namespace OHOS {
(r1) = static_cast<uint8_t>((Alpha2 * (r2) + (1 - Alpha2) * Alpha1 * (r1)) / Alpha3); \ (r1) = static_cast<uint8_t>((Alpha2 * (r2) + (1 - Alpha2) * Alpha1 * (r1)) / Alpha3); \
(g1) = static_cast<uint8_t>((Alpha2 * (g2) + (1 - Alpha2) * Alpha1 * (g1)) / Alpha3); \ (g1) = static_cast<uint8_t>((Alpha2 * (g2) + (1 - Alpha2) * Alpha1 * (g1)) / Alpha3); \
(b1) = static_cast<uint8_t>((Alpha2 * (b2) + (1 - Alpha2) * Alpha1 * (b1)) / Alpha3); \ (b1) = static_cast<uint8_t>((Alpha2 * (b2) + (1 - Alpha2) * Alpha1 * (b1)) / Alpha3); \
(a1) = static_cast<uint8_t>(Alpha3 * OPA_OPAQUE); (a1) = static_cast<uint8_t>(Alpha3 * OPA_OPAQUE)
#define COLOR_BLEND_RGB(r1, g1, b1, r2, g2, b2, a2) \ #define COLOR_BLEND_RGB(r1, g1, b1, r2, g2, b2, a2) \
(r1) = (((r2) * (a2)) / OPA_OPAQUE) + (((r1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); \ (r1) = (((r2) * (a2)) / OPA_OPAQUE) + (((r1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); \
(g1) = (((g2) * (a2)) / OPA_OPAQUE) + (((g1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); \ (g1) = (((g2) * (a2)) / OPA_OPAQUE) + (((g1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); \
(b1) = (((b2) * (a2)) / OPA_OPAQUE) + (((b1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE); (b1) = (((b2) * (a2)) / OPA_OPAQUE) + (((b1) * (OPA_OPAQUE - (a2))) / OPA_OPAQUE)
// 565 // 565
#define COLOR_FILL_BLEND(d, dm, s, sm, a) \ #define COLOR_FILL_BLEND(d, dm, s, sm, a) \
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#include "gfx_utils/file.h" #include "gfx_utils/file.h"
#include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_log.h"
#include "graphic_config.h" #include "graphic_config.h"
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
#include "font/ui_multi_font_manager.h" #include "font/ui_multi_font_manager.h"
#endif #endif
#if ENABLE_SHAPING #if defined(ENABLE_SHAPING) && ENABLE_SHAPING
#include "font/ui_text_shaping.h" #include "font/ui_text_shaping.h"
#endif #endif
...@@ -60,9 +60,10 @@ bool UIFontBitmap::IsVectorFont() const ...@@ -60,9 +60,10 @@ bool UIFontBitmap::IsVectorFont() const
return false; return false;
} }
uint8_t UIFontBitmap::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint16_t fontId, uint8_t size) const uint8_t UIFontBitmap::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script,
uint16_t fontId, uint8_t size) const
{ {
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
return UIMultiFontManager::GetInstance()->GetShapingFontId(text, fontId, ttfId, script); return UIMultiFontManager::GetInstance()->GetShapingFontId(text, fontId, ttfId, script);
#else #else
UITextLanguageFontParam* fontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId); UITextLanguageFontParam* fontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId);
...@@ -157,7 +158,7 @@ int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint ...@@ -157,7 +158,7 @@ int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint
return INVALID_RET_VALUE; return INVALID_RET_VALUE;
} }
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
int8_t UIFontBitmap::GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId) int8_t UIFontBitmap::GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId)
{ {
int8_t ret = GetGlyphNode(unicode, glyphNode, fontId); int8_t ret = GetGlyphNode(unicode, glyphNode, fontId);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_log.h"
#include "graphic_config.h" #include "graphic_config.h"
#include "securec.h" #include "securec.h"
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
#include "font/ui_multi_font_manager.h" #include "font/ui_multi_font_manager.h"
#endif #endif
...@@ -118,7 +118,7 @@ uint8_t UIFontVector::RegisterFontInfo(const char* ttfName, uint8_t shaping) ...@@ -118,7 +118,7 @@ uint8_t UIFontVector::RegisterFontInfo(const char* ttfName, uint8_t shaping)
if (IsColorEmojiFont(ftFaces_[j])) { if (IsColorEmojiFont(ftFaces_[j])) {
SetupColorFont(ftFaces_[j]); SetupColorFont(ftFaces_[j]);
} }
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
UIMultiFontManager::GetInstance()->UpdateScript(fontInfo_[j]); UIMultiFontManager::GetInstance()->UpdateScript(fontInfo_[j]);
#endif #endif
return j; return j;
...@@ -337,9 +337,10 @@ uint16_t UIFontVector::GetHeight(uint16_t fontId, uint8_t fontSize) ...@@ -337,9 +337,10 @@ uint16_t UIFontVector::GetHeight(uint16_t fontId, uint8_t fontSize)
return static_cast<uint16_t>(faceInfo.face->size->metrics.height / FONT_PIXEL_IN_POINT); return static_cast<uint16_t>(faceInfo.face->size->metrics.height / FONT_PIXEL_IN_POINT);
} }
uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint16_t fontId, uint8_t size) const uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script,
uint16_t fontId, uint8_t size) const
{ {
#if ENABLE_MULTI_FONT #if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
const UITextLanguageFontParam* fontParam1 = GetFontInfo(fontId); const UITextLanguageFontParam* fontParam1 = GetFontInfo(fontId);
if (fontParam1 == nullptr) { if (fontParam1 == nullptr) {
return 0; return 0;
...@@ -364,7 +365,7 @@ uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr ...@@ -364,7 +365,7 @@ uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr
} }
ttfId = fontParam1->ttfId; ttfId = fontParam1->ttfId;
#if ENABLE_SHAPING #if defined(ENABLE_SHAPING) && ENABLE_SHAPING
script = UIMultiFontManager::GetInstance()->GetScriptByTtfId(ttfId); script = UIMultiFontManager::GetInstance()->GetScriptByTtfId(ttfId);
#endif #endif
return fontParam1->shaping; return fontParam1->shaping;
...@@ -377,6 +378,7 @@ uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr ...@@ -377,6 +378,7 @@ uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr
return fontInfo->shaping; return fontInfo->shaping;
#endif #endif
} }
uint16_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const uint16_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const
{ {
if (ttfName != nullptr) { if (ttfName != nullptr) {
...@@ -568,6 +570,7 @@ void UIFontVector::SetItaly(FT_GlyphSlot slot) ...@@ -568,6 +570,7 @@ void UIFontVector::SetItaly(FT_GlyphSlot slot)
FT_Outline outline = slot->outline; FT_Outline outline = slot->outline;
FT_Outline_Transform(&outline, &matrix); FT_Outline_Transform(&outline, &matrix);
} }
void UIFontVector::SetBold(uint16_t fontId) void UIFontVector::SetBold(uint16_t fontId)
{ {
int32_t error; int32_t error;
......
...@@ -339,7 +339,7 @@ public: ...@@ -339,7 +339,7 @@ public:
*/ */
virtual void OnPickerStoped(UIPicker& picker) {} virtual void OnPickerStoped(UIPicker& picker) {}
/** /**
* @brief Called when an item is selected during sliding. This function is implemented by applications. * @brief Called when an item is selected during sliding. This function is implemented by applications.
* *
* @param picker Indicates the picker instance. * @param picker Indicates the picker instance.
* @since 1.0 * @since 1.0
......
...@@ -576,7 +576,7 @@ private: ...@@ -576,7 +576,7 @@ private:
bool touchable_; bool touchable_;
}; };
#if DEFAULT_ANIMATION #if defined(DEFAULT_ANIMATION) && DEFAULT_ANIMATION
class TestBtnAnimationListener : public UIView::OnClickListener { class TestBtnAnimationListener : public UIView::OnClickListener {
public: public:
TestBtnAnimationListener(UIView* uiView, bool enableAnimation) : uiView_(uiView), enableAnimation_(enableAnimation) TestBtnAnimationListener(UIView* uiView, bool enableAnimation) : uiView_(uiView), enableAnimation_(enableAnimation)
...@@ -708,8 +708,9 @@ void UITestBUTTON::UIKitButtonTest002(UIScrollView* container, UIButton* button) ...@@ -708,8 +708,9 @@ void UITestBUTTON::UIKitButtonTest002(UIScrollView* container, UIButton* button)
container->Add(button14); container->Add(button14);
container->Add(button15); container->Add(button15);
#if DEFAULT_ANIMATION #if defined(DEFAULT_ANIMATION) && DEFAULT_ANIMATION
UILabelButton* button16 = GetTestUIButton("开启动效", 340, 1040, button); // 340: x-coordinate, 1040: y-coordinate // 340: x-coordinate, 1040: y-coordinate
UILabelButton* button16 = GetTestUIButton("开启动效", 340, 1040, button);
if (enableAnimationListener_ == nullptr) { if (enableAnimationListener_ == nullptr) {
enableAnimationListener_ = enableAnimationListener_ =
static_cast<UIView::OnClickListener*>( static_cast<UIView::OnClickListener*>(
...@@ -717,7 +718,8 @@ void UITestBUTTON::UIKitButtonTest002(UIScrollView* container, UIButton* button) ...@@ -717,7 +718,8 @@ void UITestBUTTON::UIKitButtonTest002(UIScrollView* container, UIButton* button)
} }
button16->SetOnClickListener(enableAnimationListener_); button16->SetOnClickListener(enableAnimationListener_);
UILabelButton* button17 = GetTestUIButton("关闭动效", 340, 1090, button); // 340: x-coordinate, 1090: y-coordinate // 340: x-coordinate, 1090: y-coordinate
UILabelButton* button17 = GetTestUIButton("关闭动效", 340, 1090, button);
if (disableAnimationListener_ == nullptr) { if (disableAnimationListener_ == nullptr) {
disableAnimationListener_ = static_cast<UIView::OnClickListener*>( disableAnimationListener_ = static_cast<UIView::OnClickListener*>(
new TestBtnAnimationListener(reinterpret_cast<UIView*>(button), false)); new TestBtnAnimationListener(reinterpret_cast<UIView*>(button), false));
......
...@@ -267,7 +267,6 @@ void UITestClip::UIKitClipTest004() ...@@ -267,7 +267,6 @@ void UITestClip::UIKitClipTest004()
CreateTitleLabel("贝塞尔曲线裁剪 "); CreateTitleLabel("贝塞尔曲线裁剪 ");
ClipPath path; ClipPath path;
// {50, 50}, {100, 50}, {100, 100}, {50, 100}: path points; {60, 110}, {80, 10}: control points of curve
path.MoveTo({50, 50}).CurveTo({60, 110}, {80, 10}, {100, 50}).LineTo({100, 100}).LineTo({50, 100}); path.MoveTo({50, 50}).CurveTo({60, 110}, {80, 10}, {100, 50}).LineTo({100, 100}).LineTo({50, 100});
UIImageView* imageView = CreateImageView(); UIImageView* imageView = CreateImageView();
...@@ -282,7 +281,6 @@ void UITestClip::UIKitClipTest005() ...@@ -282,7 +281,6 @@ void UITestClip::UIKitClipTest005()
CreateTitleLabel("多边形裁剪 "); CreateTitleLabel("多边形裁剪 ");
ClipPath path; ClipPath path;
// {20, 70}, {50, 60}, {110, 80}, {110, 130}, {50, 100}, {20, 120}: path points
path.MoveTo({20, 70}).LineTo({50, 60}).LineTo({110, 80}).LineTo({110, 130}).LineTo({50, 100}).LineTo({20, 120}); path.MoveTo({20, 70}).LineTo({50, 60}).LineTo({110, 80}).LineTo({110, 130}).LineTo({50, 100}).LineTo({20, 120});
UIImageView* imageView = CreateImageView(); UIImageView* imageView = CreateImageView();
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define UI_TEST_SCREENSHOT_H #define UI_TEST_SCREENSHOT_H
#include "graphic_config.h" #include "graphic_config.h"
#if ENABLE_DEBUG #if defined(ENABLE_DEBUG) && ENABLE_DEBUG
#include "components/ui_scroll_view.h" #include "components/ui_scroll_view.h"
#include "components/ui_label.h" #include "components/ui_label.h"
#include "components/ui_label_button.h" #include "components/ui_label_button.h"
......
...@@ -27,7 +27,7 @@ namespace { ...@@ -27,7 +27,7 @@ namespace {
const uint8_t INIT_HOUR = 24; const uint8_t INIT_HOUR = 24;
const uint8_t INIT_MINUTE = 60; const uint8_t INIT_MINUTE = 60;
const uint8_t INIT_SECOND = 60; const uint8_t INIT_SECOND = 60;
const bool clockInit = 1; const bool CLOCK_INT = 1;
} }
class UIAbstractClockUnitTest : public testing::Test { class UIAbstractClockUnitTest : public testing::Test {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册