From 06a7c92af65526419e914c5a77c2579b2f6ec58a Mon Sep 17 00:00:00 2001 From: yutanqi Date: Fri, 18 Feb 2022 10:35:21 +0800 Subject: [PATCH] ndk code style bugfix Signed-off-by: yutanqi Change-Id: I00dc21e2efd82763aa051470c7de9a8a8f8b369c --- rosen/modules/2d_graphics/include/c/drawing_brush.h | 8 ++++---- rosen/modules/2d_graphics/include/c/drawing_canvas.h | 4 ++-- rosen/modules/2d_graphics/include/c/drawing_color.h | 2 +- rosen/modules/2d_graphics/include/c/drawing_pen.h | 8 ++++---- rosen/modules/2d_graphics/include/c/drawing_types.h | 5 ----- rosen/modules/2d_graphics/src/c/drawing_brush.cpp | 6 +++--- rosen/modules/2d_graphics/src/c/drawing_canvas.cpp | 4 ++-- rosen/modules/2d_graphics/src/c/drawing_color.cpp | 2 +- rosen/modules/2d_graphics/src/c/drawing_pen.cpp | 6 +++--- rosen/modules/2d_graphics/src/draw/core_canvas.cpp | 8 -------- rosen/modules/2d_graphics/src/draw/core_canvas.h | 3 --- .../src/engine_adapter/impl_interface/core_canvas_impl.h | 3 --- .../src/engine_adapter/skia_adapter/skia_canvas.cpp | 2 -- .../src/engine_adapter/skia_adapter/skia_canvas.h | 3 --- 14 files changed, 20 insertions(+), 44 deletions(-) diff --git a/rosen/modules/2d_graphics/include/c/drawing_brush.h b/rosen/modules/2d_graphics/include/c/drawing_brush.h index deb7fd2016..571758fb6f 100644 --- a/rosen/modules/2d_graphics/include/c/drawing_brush.h +++ b/rosen/modules/2d_graphics/include/c/drawing_brush.h @@ -61,18 +61,18 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush a pointer to OH_Drawing_Brush object - * @return OH_Drawing_Brush fill color + * @return OH_Drawing_Brush fill color, a 32-bit ARGB quantity */ -OH_Drawing_Color OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); +uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); /** * @brief Sets OH_Drawing_Brush fill color, that is a 32-bit ARGB quantity. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush a pointer to OH_Drawing_Brush object - * @param OH_Drawing_Color a 32-bit ARGB quantity + * @param color a 32-bit ARGB quantity */ -void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, OH_Drawing_Color); +void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color); #ifdef __cplusplus } diff --git a/rosen/modules/2d_graphics/include/c/drawing_canvas.h b/rosen/modules/2d_graphics/include/c/drawing_canvas.h index 5eac5284c5..594b5b44b9 100644 --- a/rosen/modules/2d_graphics/include/c/drawing_canvas.h +++ b/rosen/modules/2d_graphics/include/c/drawing_canvas.h @@ -123,9 +123,9 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas a pointer to OH_Drawing_Canvas object - * @param OH_Drawing_Color a 32-bit ARGB color quantity + * @param color a 32-bit ARGB color quantity */ -void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, OH_Drawing_Color); +void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); #ifdef __cplusplus } diff --git a/rosen/modules/2d_graphics/include/c/drawing_color.h b/rosen/modules/2d_graphics/include/c/drawing_color.h index dd9d081e3e..1d418ee43f 100644 --- a/rosen/modules/2d_graphics/include/c/drawing_color.h +++ b/rosen/modules/2d_graphics/include/c/drawing_color.h @@ -32,7 +32,7 @@ extern "C" { * @param blue blue, which range is 0x00~0xFF * @return a 32-bit ARGB color quantity */ -OH_Drawing_Color OH_Drawing_ColorSetArgb(uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue); +uint32_t OH_Drawing_ColorSetArgb(uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue); #ifdef __cplusplus } diff --git a/rosen/modules/2d_graphics/include/c/drawing_pen.h b/rosen/modules/2d_graphics/include/c/drawing_pen.h index 4dc17078fd..e8fc5aec40 100644 --- a/rosen/modules/2d_graphics/include/c/drawing_pen.h +++ b/rosen/modules/2d_graphics/include/c/drawing_pen.h @@ -61,18 +61,18 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen a pointer to OH_Drawing_Pen object - * @return OH_Drawing_Pen stroke color + * @return OH_Drawing_Pen stroke color, a 32-bit ARGB quantity */ -OH_Drawing_Color OH_Drawing_PenGetColor(const OH_Drawing_Pen*); +uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); /** * @brief Sets OH_Drawing_Pen stroke color, that is a 32-bit ARGB quantity. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen a pointer to OH_Drawing_Pen object - * @param OH_Drawing_Color a 32-bit ARGB quantity + * @param color a 32-bit ARGB quantity */ -void OH_Drawing_PenSetColor(OH_Drawing_Pen*, OH_Drawing_Color); +void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); /** * @brief Returns OH_Drawing_Pen stroke width. diff --git a/rosen/modules/2d_graphics/include/c/drawing_types.h b/rosen/modules/2d_graphics/include/c/drawing_types.h index 86ec793653..f65f417221 100644 --- a/rosen/modules/2d_graphics/include/c/drawing_types.h +++ b/rosen/modules/2d_graphics/include/c/drawing_types.h @@ -22,11 +22,6 @@ extern "C" { #endif -/** - * @brief OH_Drawing_Color is a 32-bit ARGB color quantity. - */ -typedef uint32_t OH_Drawing_Color; - /** * @brief OH_Drawing_Canvas contains the current state of the rendering, * used to draw some destination such as shapes, bitmap. diff --git a/rosen/modules/2d_graphics/src/c/drawing_brush.cpp b/rosen/modules/2d_graphics/src/c/drawing_brush.cpp index d183a44a62..2b85058554 100644 --- a/rosen/modules/2d_graphics/src/c/drawing_brush.cpp +++ b/rosen/modules/2d_graphics/src/c/drawing_brush.cpp @@ -51,12 +51,12 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush* cBrush, bool aa) CastToBrush(cBrush)->SetAntiAlias(aa); } -OH_Drawing_Color OH_Drawing_BrushGetColor(const OH_Drawing_Brush* cBrush) +uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush* cBrush) { return CastToBrush(*cBrush).GetColor().CastToColorQuad(); } -void OH_Drawing_BrushSetColor(OH_Drawing_Brush* cBrush, OH_Drawing_Color c) +void OH_Drawing_BrushSetColor(OH_Drawing_Brush* cBrush, uint32_t color) { - CastToBrush(cBrush)->SetColor(c); + CastToBrush(cBrush)->SetColor(color); } diff --git a/rosen/modules/2d_graphics/src/c/drawing_canvas.cpp b/rosen/modules/2d_graphics/src/c/drawing_canvas.cpp index 84441e049a..efca5b579c 100644 --- a/rosen/modules/2d_graphics/src/c/drawing_canvas.cpp +++ b/rosen/modules/2d_graphics/src/c/drawing_canvas.cpp @@ -103,7 +103,7 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas* cCanvas, const OH_Drawing_Path CastToCanvas(cCanvas)->DrawPath(CastToPath(*cPath)); } -void OH_Drawing_CanvasClear(OH_Drawing_Canvas* cCanvas, OH_Drawing_Color c) +void OH_Drawing_CanvasClear(OH_Drawing_Canvas* cCanvas, uint32_t color) { - CastToCanvas(cCanvas)->Clear(c); + CastToCanvas(cCanvas)->Clear(color); } diff --git a/rosen/modules/2d_graphics/src/c/drawing_color.cpp b/rosen/modules/2d_graphics/src/c/drawing_color.cpp index 6e96400ab4..3087f61901 100644 --- a/rosen/modules/2d_graphics/src/c/drawing_color.cpp +++ b/rosen/modules/2d_graphics/src/c/drawing_color.cpp @@ -15,7 +15,7 @@ #include "c/drawing_color.h" -OH_Drawing_Color OH_Drawing_ColorSetArgb(uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) +uint32_t OH_Drawing_ColorSetArgb(uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) { // alpha left-shifted 24, red left-shifted 16, green left-shifted 8, blue left-shifted 0 return ((alpha & 0xffu) << 24) | ((red & 0xffu) << 16) | ((green & 0xffu) << 8) | ((blue & 0xffu) << 0); diff --git a/rosen/modules/2d_graphics/src/c/drawing_pen.cpp b/rosen/modules/2d_graphics/src/c/drawing_pen.cpp index d6d907f8db..2b9320d333 100644 --- a/rosen/modules/2d_graphics/src/c/drawing_pen.cpp +++ b/rosen/modules/2d_graphics/src/c/drawing_pen.cpp @@ -127,14 +127,14 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen* cPen, bool aa) CastToPen(cPen)->SetAntiAlias(aa); } -OH_Drawing_Color OH_Drawing_PenGetColor(const OH_Drawing_Pen* cPen) +uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen* cPen) { return CastToPen(*cPen).GetColor().CastToColorQuad(); } -void OH_Drawing_PenSetColor(OH_Drawing_Pen* cPen, OH_Drawing_Color c) +void OH_Drawing_PenSetColor(OH_Drawing_Pen* cPen, uint32_t color) { - CastToPen(cPen)->SetColor(c); + CastToPen(cPen)->SetColor(color); } float OH_Drawing_PenGetWidth(const OH_Drawing_Pen* cPen) diff --git a/rosen/modules/2d_graphics/src/draw/core_canvas.cpp b/rosen/modules/2d_graphics/src/draw/core_canvas.cpp index 3f4bbefb99..8f1add826c 100644 --- a/rosen/modules/2d_graphics/src/draw/core_canvas.cpp +++ b/rosen/modules/2d_graphics/src/draw/core_canvas.cpp @@ -15,9 +15,6 @@ #include "core_canvas.h" -#include -#include - #include "impl_factory.h" namespace OHOS { @@ -122,11 +119,6 @@ void CoreCanvas::DrawPicture(const Picture& picture) impl_->DrawPicture(picture); } -void CoreCanvas::DrawText(const Text& text) -{ - impl_->DrawText(text); -} - void CoreCanvas::ClipRect(const Rect& rect, ClipOp op) { impl_->ClipRect(rect, op); diff --git a/rosen/modules/2d_graphics/src/draw/core_canvas.h b/rosen/modules/2d_graphics/src/draw/core_canvas.h index f65496f184..eb6bd8f834 100644 --- a/rosen/modules/2d_graphics/src/draw/core_canvas.h +++ b/rosen/modules/2d_graphics/src/draw/core_canvas.h @@ -57,9 +57,6 @@ public: void DrawImageRect(const Image& image, const Rect& dst, const SamplingOptions& sampling); void DrawPicture(const Picture& picture); - // text - void DrawText(const Text& text); // TODO... - // clip void ClipRect(const Rect& rect, ClipOp op); void ClipRoundRect(const RoundRect& roundRect, ClipOp op); diff --git a/rosen/modules/2d_graphics/src/engine_adapter/impl_interface/core_canvas_impl.h b/rosen/modules/2d_graphics/src/engine_adapter/impl_interface/core_canvas_impl.h index bb4043c567..880740e67f 100644 --- a/rosen/modules/2d_graphics/src/engine_adapter/impl_interface/core_canvas_impl.h +++ b/rosen/modules/2d_graphics/src/engine_adapter/impl_interface/core_canvas_impl.h @@ -81,9 +81,6 @@ public: virtual void DrawImageRect(const Image& image, const Rect& dst, const SamplingOptions& sampling) = 0; virtual void DrawPicture(const Picture& picture) = 0; - // text - virtual void DrawText(const Text& text) = 0; // TODO... - // clip virtual void ClipRect(const Rect& rect, ClipOp op) = 0; virtual void ClipRoundRect(const RoundRect& roundRect, ClipOp op) = 0; diff --git a/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.cpp b/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.cpp index 62cdf51b90..94afb4bfdc 100644 --- a/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.cpp +++ b/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.cpp @@ -407,8 +407,6 @@ void SkiaCanvas::DrawPicture(const Picture& picture) LOGI("------- DrawPicture"); } -void SkiaCanvas::DrawText(const Text& text) {} // TODO... - void SkiaCanvas::ClipRect(const Rect& rect, ClipOp op) { SkRect clipRect = SkRect::MakeLTRB(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); diff --git a/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.h b/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.h index 70bdfc93ba..ad7b89395b 100644 --- a/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.h +++ b/rosen/modules/2d_graphics/src/engine_adapter/skia_adapter/skia_canvas.h @@ -73,9 +73,6 @@ public: void DrawImageRect(const Image& image, const Rect& dst, const SamplingOptions& sampling) override; void DrawPicture(const Picture& picture) override; - // text - void DrawText(const Text& text) override; // TODO... - // clip void ClipRect(const Rect& rect, ClipOp op) override; void ClipRoundRect(const RoundRect& roundRect, ClipOp op) override;