From 45e8725f367eca408d6cad54e3bc7f9da303fd92 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Wed, 15 Jun 2022 16:05:54 +0800 Subject: [PATCH] added ToAnsiString functions at Windows platform. --- inc/hgl/CodePage.h | 9 ++++++++- inc/hgl/type/String.h | 2 +- src/Color/Color3f.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/hgl/CodePage.h b/inc/hgl/CodePage.h index 522ea1f..7e79e70 100644 --- a/inc/hgl/CodePage.h +++ b/inc/hgl/CodePage.h @@ -285,8 +285,15 @@ namespace hgl { return to_u8(ws.c_str(),ws.Length()); } - #if HGL_OS == HGL_OS_Windows + AnsiString ToAnsiString(const CharSet &cs,const UTF16String &str); + inline AnsiString ToAnsiString(const UTF16String &str) + { + const CharSet cs((uint16)0); + + return ToAnsiString(cs,str); + } + inline OSString ToOSString(const u8char *str){return to_u16(str);} inline OSString ToOSString(const UTF8String &str){return to_u16(str.c_str(), (int)(str.Length()));} diff --git a/inc/hgl/type/String.h b/inc/hgl/type/String.h index 7792a3e..4399a44 100644 --- a/inc/hgl/type/String.h +++ b/inc/hgl/type/String.h @@ -44,7 +44,7 @@ namespace hgl } /** - * 根据一个C指针风格字符串设置当前字符串内容(传入的str需要delete[]) + * 根据一个C指针风格字符串设置当前字符串内容(传入的str会被复制一份,所以需要传入者自行delete[]) * @param str 字符串内容,在len<0的情况下,需以0为结尾 * @param len 字符串长度,如果str以0为结尾,可以为负值,将启用自动计算长度 */ diff --git a/src/Color/Color3f.cpp b/src/Color/Color3f.cpp index 4002770..bc5b0b2 100644 --- a/src/Color/Color3f.cpp +++ b/src/Color/Color3f.cpp @@ -25,12 +25,12 @@ namespace hgl b=nb; return; } - + r+=(nr-r)*pos; g+=(ng-g)*pos; b+=(nb-b)*pos; } -//-------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------- void Color3f::Grey(float v1,float v2,float v3) { float lum=RGB2Lum(v1,v2,v3);