From 61241554a1bf07d1fb017165f41fde356ae00739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=BF=97=E8=B1=AA?= Date: Mon, 12 Jul 2021 10:02:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!247=20:?= =?UTF-8?q?=20246=20HILOG=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/animator/animator_manager.cpp | 1 - frameworks/components/ui_arc_label.cpp | 12 ------------ frameworks/components/ui_image_view.cpp | 1 - frameworks/components/ui_label_button.cpp | 13 ------------- frameworks/components/ui_picker.cpp | 12 ------------ frameworks/components/ui_video.cpp | 1 - frameworks/components/ui_view.cpp | 14 -------------- interfaces/kits/components/ui_arc_label.h | 11 ++++++++++- interfaces/kits/components/ui_label_button.h | 13 ++++++++++++- interfaces/kits/components/ui_picker.h | 11 ++++++++++- interfaces/kits/components/ui_view.h | 15 ++++++++++++++- 11 files changed, 46 insertions(+), 58 deletions(-) diff --git a/frameworks/animator/animator_manager.cpp b/frameworks/animator/animator_manager.cpp index 917be2d..96da670 100644 --- a/frameworks/animator/animator_manager.cpp +++ b/frameworks/animator/animator_manager.cpp @@ -16,7 +16,6 @@ #include "animator/animator_manager.h" #include "common/task_manager.h" -#include "gfx_utils/graphic_log.h" #include "hal_tick.h" namespace OHOS { diff --git a/frameworks/components/ui_arc_label.cpp b/frameworks/components/ui_arc_label.cpp index 507c858..b87f636 100755 --- a/frameworks/components/ui_arc_label.cpp +++ b/frameworks/components/ui_arc_label.cpp @@ -18,7 +18,6 @@ #include "draw/draw_label.h" #include "engines/gfx/gfx_engine_manager.h" #include "font/ui_font.h" -#include "gfx_utils/graphic_log.h" #include "themes/theme_manager.h" namespace OHOS { @@ -210,15 +209,4 @@ void UIArcLabel::MeasureArcTextInfo() arcTextInfo_.direct, orientation_); } } - -void UIArcLabel::InitArcLabelText() -{ - if (arcLabelText_ == nullptr) { - arcLabelText_ = new Text(); - if (arcLabelText_ == nullptr) { - HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Text fail"); - return; - } - } -} } // namespace OHOS \ No newline at end of file diff --git a/frameworks/components/ui_image_view.cpp b/frameworks/components/ui_image_view.cpp index 3be6364..dc64ee6 100755 --- a/frameworks/components/ui_image_view.cpp +++ b/frameworks/components/ui_image_view.cpp @@ -20,7 +20,6 @@ #include "draw/draw_label.h" #include "engines/gfx/gfx_engine_manager.h" #include "gfx_utils/file.h" -#include "gfx_utils/graphic_log.h" #include "gfx_utils/image_info.h" #include "gfx_utils/mem_api.h" #include "imgdecode/cache_manager.h" diff --git a/frameworks/components/ui_label_button.cpp b/frameworks/components/ui_label_button.cpp index df1717d..9cdcbcb 100755 --- a/frameworks/components/ui_label_button.cpp +++ b/frameworks/components/ui_label_button.cpp @@ -17,7 +17,6 @@ #include "common/typed_text.h" #include "draw/draw_label.h" #include "font/ui_font.h" -#include "gfx_utils/graphic_log.h" namespace OHOS { UILabelButton::UILabelButton() : labelButtonText_(nullptr), offset_({ 0, 0 }) @@ -40,18 +39,6 @@ void UILabelButton::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea labelStyle_, ellipsisIndex, opa); } -void UILabelButton::InitLabelButtonText() -{ - if (labelButtonText_ == nullptr) { - labelButtonText_ = new Text(); - if (labelButtonText_ == nullptr) { - HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Text fail"); - return; - } - labelButtonText_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - } -} - UILabelButton::~UILabelButton() { if (labelButtonText_ != nullptr) { diff --git a/frameworks/components/ui_picker.cpp b/frameworks/components/ui_picker.cpp index 76afd6d..b00997b 100755 --- a/frameworks/components/ui_picker.cpp +++ b/frameworks/components/ui_picker.cpp @@ -17,7 +17,6 @@ #include "dock/vibrator_manager.h" #include "draw/draw_line.h" #include "draw/draw_rect.h" -#include "gfx_utils/graphic_log.h" #include "themes/theme_manager.h" namespace { @@ -246,17 +245,6 @@ void UIPicker::Refresh() } } -void UIPicker::InitTextAdapter() -{ - if (textAdapter_ == nullptr) { - textAdapter_ = new TextAdapter(); - if (textAdapter_ == nullptr) { - HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new TextAdapter fail"); - return; - } - } -} - bool UIPicker::RefreshValues(int16_t start, int16_t end) { if (!isWidthSet_ || !isHeightSet_ || !itemsHeight_ || ((start == 0) && (end == 0))) { diff --git a/frameworks/components/ui_video.cpp b/frameworks/components/ui_video.cpp index ee94824..b871b32 100755 --- a/frameworks/components/ui_video.cpp +++ b/frameworks/components/ui_video.cpp @@ -14,7 +14,6 @@ */ #include "components/ui_video.h" -#include "gfx_utils/graphic_log.h" #include "securec.h" #ifndef VERSION_LITE diff --git a/frameworks/components/ui_view.cpp b/frameworks/components/ui_view.cpp index 586e51b..748bae2 100755 --- a/frameworks/components/ui_view.cpp +++ b/frameworks/components/ui_view.cpp @@ -548,20 +548,6 @@ Rect UIView::GetContentRect() return contentRect; } -void UIView::ResizeVisibleArea(int16_t x, int16_t y, int16_t width, int16_t height) -{ - if (visibleRect_ == nullptr) { - visibleRect_ = new Rect(); - if (visibleRect_ == nullptr) { - HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Rect fail"); - return; - } - } - visibleRect_->SetWidth(width); - visibleRect_->SetHeight(height); - visibleRect_->SetPosition(x, y); -} - Rect UIView::GetOrigRect() const { int16_t x = rect_.GetX(); diff --git a/interfaces/kits/components/ui_arc_label.h b/interfaces/kits/components/ui_arc_label.h index e3bb256..c176c08 100755 --- a/interfaces/kits/components/ui_arc_label.h +++ b/interfaces/kits/components/ui_arc_label.h @@ -361,7 +361,16 @@ public: protected: Text* arcLabelText_; - virtual void InitArcLabelText(); + virtual void InitArcLabelText() + { + if (arcLabelText_ == nullptr) { + arcLabelText_ = new Text(); + if (arcLabelText_ == nullptr) { + HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Text fail"); + return; + } + } + } void RefreshArcLabel(); private: diff --git a/interfaces/kits/components/ui_label_button.h b/interfaces/kits/components/ui_label_button.h index 72ff99f..4114561 100755 --- a/interfaces/kits/components/ui_label_button.h +++ b/interfaces/kits/components/ui_label_button.h @@ -37,6 +37,7 @@ #include "common/text.h" #include "components/ui_button.h" +#include "gfx_utils/graphic_log.h" namespace OHOS { /** @@ -289,7 +290,17 @@ public: } protected: - virtual void InitLabelButtonText(); + virtual void InitLabelButtonText() + { + if (labelButtonText_ == nullptr) { + labelButtonText_ = new Text(); + if (labelButtonText_ == nullptr) { + HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Text fail"); + return; + } + labelButtonText_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + } + } Text* labelButtonText_; diff --git a/interfaces/kits/components/ui_picker.h b/interfaces/kits/components/ui_picker.h index 065c84a..5546b39 100755 --- a/interfaces/kits/components/ui_picker.h +++ b/interfaces/kits/components/ui_picker.h @@ -381,7 +381,16 @@ protected: void RefreshList(); virtual void ClearList(); virtual void Refresh(); - virtual void InitTextAdapter(); + virtual void InitTextAdapter() + { + if (textAdapter_ == nullptr) { + textAdapter_ = new TextAdapter(); + if (textAdapter_ == nullptr) { + HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new TextAdapter fail"); + return; + } + } + } bool isWidthSet_ : 1; bool isHeightSet_ : 1; diff --git a/interfaces/kits/components/ui_view.h b/interfaces/kits/components/ui_view.h index 6a3554a..cfec5ef 100755 --- a/interfaces/kits/components/ui_view.h +++ b/interfaces/kits/components/ui_view.h @@ -49,6 +49,7 @@ #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" @@ -891,7 +892,19 @@ public: * @since 1.0 * @version 1.0 */ - void ResizeVisibleArea(int16_t x, int16_t y, int16_t width, int16_t height); + void ResizeVisibleArea(int16_t x, int16_t y, int16_t width, int16_t height) + { + if (visibleRect_ == nullptr) { + visibleRect_ = new Rect(); + if (visibleRect_ == nullptr) { + HILOG_ERROR(HILOG_MODULE_GRAPHIC, "new Rect fail"); + return; + } + } + visibleRect_->SetWidth(width); + visibleRect_->SetHeight(height); + visibleRect_->SetPosition(x, y); + } /** * @brief Sets the width for the view. -- GitLab