diff --git a/frameworks/components/ui_canvas.cpp b/frameworks/components/ui_canvas.cpp index 79bb95bc0fbf6d612bfd8bb8eeb0b4860a37e79f..ba6398f9e44aa0b8825717d020a6ee2942a1e8c6 100644 --- a/frameworks/components/ui_canvas.cpp +++ b/frameworks/components/ui_canvas.cpp @@ -707,8 +707,8 @@ void OnBlendDrawGradient(ListNode* curDraw, DrawCanvas::BuildLineGradientMatrix(drawCmd.paint, gradientMatrix, transform, distance); GradientLinearCalculate gradientLinearCalculate; FillGradient span(interpolatorType, gradientLinearCalculate, gradientColorMode, 0, distance); - UICanvas::BlendRaster(drawCmd.paint, drawCmd.param, blendRasterizer, rasterizer, renBase, transform, span, trunc, - pathParamBlend->isStroke); + UICanvas::BlendRaster(drawCmd.paint, drawCmd.param, blendRasterizer, rasterizer, renBase, + transform, span, trunc, pathParamBlend->isStroke); } if (curDraw->data_.paint.GetGradient() == Paint::Radial) { Paint::RadialGradientPoint radialPoint = drawCmd.paint.GetRadialGradientPoint(); @@ -718,8 +718,8 @@ void OnBlendDrawGradient(ListNode* curDraw, GradientRadialCalculate gradientRadialCalculate(endRadius, radialPoint.x0 - radialPoint.x1, radialPoint.y0 - radialPoint.y1); FillGradient span(interpolatorType, gradientRadialCalculate, gradientColorMode, startRadius, endRadius); - UICanvas::BlendRaster(drawCmd.paint, drawCmd.param, blendRasterizer, rasterizer, renBase, transform, span, trunc, - pathParamBlend->isStroke); + UICanvas::BlendRaster(drawCmd.paint, drawCmd.param, blendRasterizer, rasterizer, renBase, + transform, span, trunc, pathParamBlend->isStroke); } } #endif @@ -1015,7 +1015,7 @@ void UICanvas::DoDrawImage(BufferInfo& gfxDstBuffer, imageView->SetPosition(start.x, start.y); if (!paint.GetTransAffine().IsIdentity()) { float angle = paint.GetRotateAngle(); - imageView->Rotate(MATH_ROUND(angle),Vector2(0, 0)); + imageView->Rotate(MATH_ROUND(angle), Vector2(0, 0)); imageView->Translate(Vector3(paint.GetTranslateX(), paint.GetTranslateY(), 1)); Vector2 scale(static_cast(paint.GetScaleX()), static_cast(paint.GetScaleY())); imageView->Scale(scale, Vector2(0, 0)); diff --git a/frameworks/draw/draw_canvas.h b/frameworks/draw/draw_canvas.h index e78924569e5813775641a3fe6942d330c22c7963..0c68349f95745d2ca26afcb607e7d45b1068ffae 100644 --- a/frameworks/draw/draw_canvas.h +++ b/frameworks/draw/draw_canvas.h @@ -53,7 +53,7 @@ public: const Style& style, const bool& isStroke); -#if GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG +#if defined(GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG) && GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG static void DoDrawShadow(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, @@ -76,7 +76,7 @@ public: TransAffine& transform, const bool& isStroke); -#if GRAPHIC_ENABLE_GRADIENT_FILL_FLAG +#if defined(GRAPHIC_ENABLE_GRADIENT_FILL_FLAG) && GRAPHIC_ENABLE_GRADIENT_FILL_FLAG /** * Render gradient */ @@ -113,7 +113,7 @@ public: float& endRadius); #endif // GRAPHIC_ENABLE_GRADIENT_FILL_FLAG -#if GRAPHIC_ENABLE_PATTERN_FILL_FLAG +#if defined(GRAPHIC_ENABLE_PATTERN_FILL_FLAG) && GRAPHIC_ENABLE_PATTERN_FILL_FLAG /** * Render pattern mode */ @@ -154,10 +154,10 @@ public: template static void LineStyleCalc(DepictStroke& strokeLineStyle, const Paint& paint) { strokeLineStyle.SetWidth(paint.GetStrokeWidth()); // Line style related -#if GRAPHIC_ENABLE_LINECAP_FLAG +#if defined(GRAPHIC_ENABLE_LINECAP_FLAG) && GRAPHIC_ENABLE_LINECAP_FLAG strokeLineStyle.SetLineCap(paint.GetLineCap()); #endif -#if GRAPHIC_ENABLE_LINEJOIN_FLAG +#if defined(GRAPHIC_ENABLE_LINEJOIN_FLAG) && GRAPHIC_ENABLE_LINEJOIN_FLAG strokeLineStyle.SetLineJoin(paint.GetLineJoin()); if (paint.GetMiterLimit() > 0) { strokeLineStyle.SetMiterLimit(paint.GetMiterLimit()); @@ -165,7 +165,7 @@ public: #endif }; -#if GRAPHIC_ENABLE_DASH_GENERATE_FLAG +#if defined(GRAPHIC_ENABLE_DASH_GENERATE_FLAG) && GRAPHIC_ENABLE_DASH_GENERATE_FLAG /** * Set linedash style */ diff --git a/frameworks/draw/draw_utils.cpp b/frameworks/draw/draw_utils.cpp index 687df0a6120f915011e78f857a2ecc8b5fae66d3..977da59cf5d76b170c6d4c6a67685ea4e68ead89 100644 --- a/frameworks/draw/draw_utils.cpp +++ b/frameworks/draw/draw_utils.cpp @@ -346,8 +346,8 @@ void DrawUtils::DrawNormalLetter(BufferInfo& gfxDstBuffer, } if (letterInfo.havebackgroundColor) { - Rect backgroundRect(posX, letterInfo.mask.GetTop(), - posX + letterW + letterInfo.letterSpace_ - 1, letterInfo.mask.GetBottom() - letterInfo.lineSpace_); + Rect backgroundRect(posX, letterInfo.mask.GetTop(), posX + letterW + letterInfo.letterSpace_ - 1, + letterInfo.mask.GetBottom() - letterInfo.lineSpace_); Style style; style.bgColor_ = letterInfo.backgroundColor; BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, backgroundRect, diff --git a/frameworks/draw/draw_utils.h b/frameworks/draw/draw_utils.h index fdf015bbbeb20a76072556b583bac2b80b9b2b43..1ab76894620dd89983da92f648827b648ff27b55 100644 --- a/frameworks/draw/draw_utils.h +++ b/frameworks/draw/draw_utils.h @@ -74,7 +74,7 @@ struct LabelLineInfo { UITextLanguageDirect direct; uint32_t* codePoints; bool baseLine; -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT TextStyle* textStyles; #endif List* backgroundColor; @@ -97,7 +97,7 @@ struct LabelLetterInfo { uint8_t fontId; uint8_t shapingId; uint8_t fontSize; -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT TextStyle textStyle; #endif bool baseLine; diff --git a/frameworks/font/ui_font.cpp b/frameworks/font/ui_font.cpp index db36913248c568f60a91c22044e08a7548459b58..5469b5ca5c627cac74d1b83dc38219acaf034e20 100644 --- a/frameworks/font/ui_font.cpp +++ b/frameworks/font/ui_font.cpp @@ -29,9 +29,9 @@ namespace OHOS { bool UIFont::setFontAllocFlag_ = false; -UIFont::UIFont() : instance_(nullptr), defaultInstance_(nullptr){} +UIFont::UIFont() : instance_(nullptr), defaultInstance_(nullptr) {} -UIFont::~UIFont(){} +UIFont::~UIFont() {} UIFont* UIFont::GetInstance() { diff --git a/frameworks/font/ui_font_cache.h b/frameworks/font/ui_font_cache.h index 4b314a52fd370d62d1ce04df4ea1ce2990d04726..2ebc576a9a14e9281793de053a5e43f9b6034f8b 100644 --- a/frameworks/font/ui_font_cache.h +++ b/frameworks/font/ui_font_cache.h @@ -54,7 +54,7 @@ public: ListHead lruHead; uint8_t fontId; uint32_t unicode; -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT TextStyle textStyle; #endif uint8_t data[]; diff --git a/frameworks/font/ui_font_vector.cpp b/frameworks/font/ui_font_vector.cpp index 4c5d35861e834c7d8f8abbae7f7ca10d47de41d1..2d416d9e94b1f8e4e5023082877e4e70e571c150 100644 --- a/frameworks/font/ui_font_vector.cpp +++ b/frameworks/font/ui_font_vector.cpp @@ -144,7 +144,7 @@ uint8_t UIFontVector::RegisterFontInfo(const UITextLanguageFontParam* fontsTable return count; } -/* Note: when use ttc font file, freetype should export FT_Stream_New/FT_Stream_Free function*/ +// Note: when use ttc font file, freetype should export FT_Stream_New/FT_Stream_Free function uint8_t UIFontVector::RegisterTtcFontInfo(const char* ttcName, TtfInfo* ttfInfo, uint8_t count) { if ((ttcName == nullptr) || !freeTypeInited_) { diff --git a/interfaces/innerkits/font/ui_font_bitmap.h b/interfaces/innerkits/font/ui_font_bitmap.h index dc9d8fe90d7465205a94bc4aa50122547c595aa7..414a8a15981dd69cd177d2dbea9753bc631c5b2c 100644 --- a/interfaces/innerkits/font/ui_font_bitmap.h +++ b/interfaces/innerkits/font/ui_font_bitmap.h @@ -60,7 +60,7 @@ protected: private: uint8_t* SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId); int16_t GetWidthInFontId(uint32_t unicode, uint8_t fontId); -#if ENABLE_MULTI_FONT +#if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT int8_t GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId); #endif void CloseFontFd(); diff --git a/interfaces/innerkits/font/ui_font_vector.h b/interfaces/innerkits/font/ui_font_vector.h index 71fa82082fb9d5fa62bb1fabb684cb1a39be2c37..40b27780bcb3627bba40df818a5af06793d68c33 100644 --- a/interfaces/innerkits/font/ui_font_vector.h +++ b/interfaces/innerkits/font/ui_font_vector.h @@ -87,17 +87,17 @@ private: }; TtcInfo ttcInfos_[FONT_ID_MAX] = {}; void SetFace(FaceInfo& faceInfo, uint32_t unicode) const; -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT void SetFace(FaceInfo& faceInfo, uint32_t unicode, TextStyle textStyle) const; #endif uint8_t GetFontId(uint32_t unicode) const; uint32_t GetKey(uint8_t fontId, uint32_t size); int8_t LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode, FT_Face face); -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT int8_t LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode, FT_Face face, TextStyle textStyle); #endif uint8_t IsGlyphFont(uint32_t unicode); -#if ENABLE_VECTOR_FONT +#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT void SetItaly(FT_GlyphSlot slot); void SetBold(uint8_t fontId); #endif diff --git a/test/framework/include/test_resource_config.h b/test/framework/include/test_resource_config.h index 6945cd8c4e018fcd13c54c073f22b0e22e083529..fc0b5eaae9f4c494d3bcabdc2928487971f82ae7 100644 --- a/test/framework/include/test_resource_config.h +++ b/test/framework/include/test_resource_config.h @@ -58,7 +58,7 @@ namespace OHOS { #define PNG_24_RGB_IMAGE_PATH (IMAGE_DIR "png_24_rgb.png") #define PNG_32_RGB_ALPHA_IMAGE_PATH (IMAGE_DIR "png_32_rgba.png") #define GIF_IMAGE_PATH (IMAGE_DIR "gifImage.gif") -#if (ENABLE_GIF == 1) +#if defined(ENABLE_GIF) && (ENABLE_GIF == 1) #define GIF_IMAGE_PATH1 (IMAGE_DIR "gif_image1.gif") #define GIF_IMAGE_PATH2 (IMAGE_DIR "gif_image2.gif") #define GIF_IMAGE_PATH_ERROR (IMAGE_DIR "gif_error.gif") diff --git a/tools/qt/simulator/drivers/indev/key_input.h b/tools/qt/simulator/drivers/indev/key_input.h index 56ec94c7e68f13f3c6143ae94af0ab257f97cb1f..504d0b8e03be66371182e01a3eac739ddb32edd9 100644 --- a/tools/qt/simulator/drivers/indev/key_input.h +++ b/tools/qt/simulator/drivers/indev/key_input.h @@ -22,7 +22,7 @@ #include "dock/key_input_device.h" namespace OHOS { -#if USE_KEY +#if defined(USE_KEY) && USE_KEY class KeyInput : public KeyInputDevice { public: KeyInput() : leftButtonDown_(false), lastX_(0), lastY_(0) {} diff --git a/tools/qt/simulator/drivers/indev/mouse_input.h b/tools/qt/simulator/drivers/indev/mouse_input.h index abcec160fa613b9ec99d472e4e2439aa7f152ec8..91f103e2cd4aca1b164d2da701b6c7c6fa321152 100644 --- a/tools/qt/simulator/drivers/indev/mouse_input.h +++ b/tools/qt/simulator/drivers/indev/mouse_input.h @@ -22,7 +22,7 @@ #include "dock/pointer_input_device.h" namespace OHOS { -#if USE_MOUSE +#if defined(USE_MOUSE) && USE_MOUSE class MouseInput : public PointerInputDevice { public: MouseInput() : leftButtonDown_(false), lastX_(0), lastY_(0) {}