diff --git a/native/cocos/platform/apple/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/apple/modules/CanvasRenderingContext2DDelegate.h index 4864164b16..e07e27e544 100644 --- a/native/cocos/platform/apple/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/apple/modules/CanvasRenderingContext2DDelegate.h @@ -71,6 +71,7 @@ public: const cc::Data &getDataRef() const override; void fillImageData(const Data &imageData, float imageWidth, float imageHeight, float offsetX, float offsetY) override; void updateData() override {} + private: void fillData(); void unMultiplyAlpha(unsigned char *ptr, ssize_t size) const; diff --git a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h index 69aa0f45d8..bf94a0859b 100644 --- a/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h @@ -74,6 +74,7 @@ public: void strokeText(const std::string &text, float /*x*/, float /*y*/, float /*maxWidth*/) override; void rect(float x, float y, float w, float h) override; void updateData() override {} + private: int32_t _x{0}; int32_t _y{0}; diff --git a/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.cpp b/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.cpp index 4e64c4a312..a503bad3ba 100644 --- a/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.cpp +++ b/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.cpp @@ -26,12 +26,11 @@ #include "platform/java/modules/CanvasRenderingContext2DDelegate.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) -#include + #include #else -#include + #include #endif - namespace { } // namespace @@ -210,7 +209,7 @@ void CanvasRenderingContext2DDelegate::fillImageData(const Data &imageData, floa } void CanvasRenderingContext2DDelegate::updateData() { - jobject bmpObj = nullptr; + jobject bmpObj = nullptr; JniMethodInfo methodInfo; #if (CC_PLATFORM == CC_PLATFORM_ANDROID) if (JniHelper::getMethodInfo(methodInfo, JCLS_CANVASIMPL, "getBitmap", "()Landroid/graphics/Bitmap;")) { @@ -247,13 +246,13 @@ void CanvasRenderingContext2DDelegate::updateData() { uint32_t size = bmpInfo.stride * bmpInfo.height; #else OhosPixelMapInfo bmpInfo; - void *pixelData = nullptr; + void * pixelData = nullptr; if (GetImageInfo(env, bmpObj, bmpInfo) == - OHOS_IMAGE_RESULT_SUCCESS && + OHOS_IMAGE_RESULT_SUCCESS && bmpInfo.width > 0 && bmpInfo.height > 0 && bmpInfo.pixelFormat == OHOS_PIXEL_MAP_FORMAT_RGBA_8888) { - if (AccessPixels (env, bmpObj, &pixelData) != OHOS_IMAGE_RESULT_SUCCESS) { + if (AccessPixels(env, bmpObj, &pixelData) != OHOS_IMAGE_RESULT_SUCCESS) { CC_LOG_ERROR("AccessPixels() failed ! error"); break; } diff --git a/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.h index c3f18350b1..c0aae58f09 100644 --- a/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/java/modules/CanvasRenderingContext2DDelegate.h @@ -80,6 +80,7 @@ public: const cc::Data &getDataRef() const override; void fillImageData(const Data &imageData, float imageWidth, float imageHeight, float offsetX, float offsetY) override; void updateData() override; + private: void unMultiplyAlpha(unsigned char *ptr, ssize_t size); diff --git a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h index 7707f3b4da..70088b5237 100644 --- a/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/linux/modules/CanvasRenderingContext2DDelegate.h @@ -78,6 +78,7 @@ public: void strokeText(const std::string &text, float /*x*/, float /*y*/, float /*maxWidth*/) override; void rect(float x, float y, float w, float h) override; void updateData() override {} + private: static wchar_t * utf8ToUtf16(const std::string &str, int *pRetLen = nullptr); void removeCustomFont(); diff --git a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h index 70cfefe9da..914b9ef55b 100644 --- a/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h +++ b/native/cocos/platform/qnx/modules/CanvasRenderingContext2DDelegate.h @@ -76,6 +76,7 @@ public: void strokeText(const std::string &text, float /*x*/, float /*y*/, float /*maxWidth*/) override; void rect(float x, float y, float w, float h) override; void updateData() override {} + private: static wchar_t * utf8ToUtf16(const std::string &str, int *pRetLen = nullptr); void removeCustomFont();