From 3f6742f116862d7d44196f1a6d5ac94760a57c25 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 11 Sep 2020 17:11:32 +0800 Subject: [PATCH] fix bugs in Clang --- CMPlatform | 2 +- example/Vulkan/DrawText.cpp | 6 +++--- inc/hgl/graph/font/TextLayout.h | 6 +++--- inc/hgl/graph/vulkan/VKDevice.h | 2 +- src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp | 2 +- src/SceneGraph/RenderableCreater.cpp | 4 ++-- src/SceneGraph/Texture2DLoader.cpp | 2 +- src/SceneGraph/TileData.cpp | 2 +- src/SceneGraph/shader/ShaderResource.cpp | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMPlatform b/CMPlatform index 1209d487..e12425c6 160000 --- a/CMPlatform +++ b/CMPlatform @@ -1 +1 @@ -Subproject commit 1209d487ba12af9cab085c18aa4c3722d8e8f6d0 +Subproject commit e12425c60d0f4712a93918215834e1ffb7699331 diff --git a/example/Vulkan/DrawText.cpp b/example/Vulkan/DrawText.cpp index baa35b7a..b649101f 100644 --- a/example/Vulkan/DrawText.cpp +++ b/example/Vulkan/DrawText.cpp @@ -142,10 +142,10 @@ private: tla.char_layout_attr=&cla; tla.line_gap=0.1f; - tl_engine.Set(tile_font->GetFontSource()); - tl_engine.Set(&tla); + tl_engine.SetFont(tile_font->GetFontSource()); + tl_engine.SetTLA(&tla); tl_engine.SetTextDirection(0); - tl_engine.Set(TextAlign::Left); + tl_engine.SetAlign(TextAlign::Left); tl_engine.SetMaxWidth(0); tl_engine.SetMaxHeight(0); diff --git a/inc/hgl/graph/font/TextLayout.h b/inc/hgl/graph/font/TextLayout.h index 3803ce21..c1d40d2a 100644 --- a/inc/hgl/graph/font/TextLayout.h +++ b/inc/hgl/graph/font/TextLayout.h @@ -156,10 +156,10 @@ namespace hgl virtual ~TextLayout()=default; - void Set (const TextLayoutAttributes *_tla) {if(_tla)memcpy(&tla,_tla,sizeof(TextLayoutAttributes));} - void Set (FontSource *fs) {if(fs)font_source=fs;} + void SetTLA (const TextLayoutAttributes *_tla) {if(_tla)memcpy(&tla,_tla,sizeof(TextLayoutAttributes));} + void SetFont (FontSource *fs) {if(fs)font_source=fs;} void SetTextDirection (const uint8 &td) {tla.text_direction=td;} - void Set (const TextAlign &ta) {tla.align=ta;} + void SetAlign (const TextAlign &ta) {tla.align=ta;} void SetMaxWidth (const float mw) {tla.max_width=mw;} void SetMaxHeight (const float mh) {tla.max_height=mh;} diff --git a/inc/hgl/graph/vulkan/VKDevice.h b/inc/hgl/graph/vulkan/VKDevice.h index ad6864bf..44168ded 100644 --- a/inc/hgl/graph/vulkan/VKDevice.h +++ b/inc/hgl/graph/vulkan/VKDevice.h @@ -205,7 +205,7 @@ public: //Texture bool ChangeTexture2D(Texture2D *tex,void *data,const RectScope2 &rs,uint32_t size) { return ChangeTexture2D( tex, - buf, + data, rs.GetLeft(), rs.GetTop(), rs.GetWidth(), diff --git a/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp b/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp index 6a9a8257..7abebc01 100644 --- a/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp +++ b/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp @@ -167,7 +167,7 @@ Texture2D *CreateTextureFromFile(Device *device,const OSString &filename) VkTexture2DLoader loader(device); if(!loader.Load(filename)) - return(false); + return(nullptr); return loader.GetTexture(); } diff --git a/src/SceneGraph/RenderableCreater.cpp b/src/SceneGraph/RenderableCreater.cpp index 0e531e63..a9056eb4 100644 --- a/src/SceneGraph/RenderableCreater.cpp +++ b/src/SceneGraph/RenderableCreater.cpp @@ -74,10 +74,10 @@ namespace hgl const vulkan::ShaderStage *ss=vsm->GetStageInput(name); if(!ss) - return(nullptr); + return(false); if(ss->type.GetStride()*vertices_number!=bytes) - return(nullptr); + return(false); ssb=new ShaderStageBind; diff --git a/src/SceneGraph/Texture2DLoader.cpp b/src/SceneGraph/Texture2DLoader.cpp index 76c9c411..bf83b962 100644 --- a/src/SceneGraph/Texture2DLoader.cpp +++ b/src/SceneGraph/Texture2DLoader.cpp @@ -98,7 +98,7 @@ namespace hgl Bitmap2DLoader loader; if(!loader.Load(filename)) - return(false); + return(nullptr); return loader.GetBitmap(); } diff --git a/src/SceneGraph/TileData.cpp b/src/SceneGraph/TileData.cpp index 5cc0aed4..86faf184 100644 --- a/src/SceneGraph/TileData.cpp +++ b/src/SceneGraph/TileData.cpp @@ -131,7 +131,7 @@ namespace hgl */ TileObject *TileData::Commit(const void *data,const uint bytes,const int ctw,const int cth) { - if(!commit_ptr)return(false); + if(!commit_ptr)return(nullptr); if(!data||!bytes||ctw<=0||cth<=0) return(nullptr); diff --git a/src/SceneGraph/shader/ShaderResource.cpp b/src/SceneGraph/shader/ShaderResource.cpp index fb40277c..5c407915 100644 --- a/src/SceneGraph/shader/ShaderResource.cpp +++ b/src/SceneGraph/shader/ShaderResource.cpp @@ -154,7 +154,7 @@ VK_NAMESPACE_BEGIN ||memcmp(origin_filedata,SHADER_FILE_HEADER,SHADER_FILE_HEADER_BYTES)) { delete[] origin_filedata; - return(false); + return(nullptr); } const uint8 *filedata=origin_filedata; @@ -187,4 +187,4 @@ VK_NAMESPACE_BEGIN return sr; } -VK_NAMESPACE_END \ No newline at end of file +VK_NAMESPACE_END