nk_ prefix
This commit is contained in:
parent
02e6a81625
commit
49c3bcd0c6
@ -643,21 +643,6 @@ nk_gdip_load_image_from_memory(const void *membuf, nk_uint membufSize)
|
|||||||
return nk_image_id(0);
|
return nk_image_id(0);
|
||||||
|
|
||||||
return nk_gdip_image_to_nk(image);
|
return nk_gdip_image_to_nk(image);
|
||||||
|
|
||||||
#if 1==0
|
|
||||||
GpImage *image = NULL;
|
|
||||||
IStream *pStream = NULL;
|
|
||||||
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, membufSize);
|
|
||||||
LPVOID pImage = GlobalLock(hMem);
|
|
||||||
nk_memcopy(pImage, membuf, membufSize);
|
|
||||||
GlobalUnlock(hMem);
|
|
||||||
|
|
||||||
/* CreateStreamOnHGlobal needs OLE32 in linked libraries list */
|
|
||||||
CreateStreamOnHGlobal(hMem, FALSE, &pStream);
|
|
||||||
GdipLoadImageFromStream(pStream, &image);
|
|
||||||
GlobalFree(hMem);
|
|
||||||
return nk_gdip_image_to_nk(image);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -687,7 +672,7 @@ nk_gdipfont_create(const char *name, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GpFontCollection*
|
GpFontCollection*
|
||||||
getCurFontCollection(){
|
nk_gdip_getCurFontCollection(){
|
||||||
return gdip.fontCollection[gdip.curFontCollection];
|
return gdip.fontCollection[gdip.curFontCollection];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,10 +681,10 @@ nk_gdipfont_create_from_collection(int size){
|
|||||||
GpFontFamily **families;
|
GpFontFamily **families;
|
||||||
INT count;
|
INT count;
|
||||||
GdipFont *font = (GdipFont*)calloc(1, sizeof(GdipFont));
|
GdipFont *font = (GdipFont*)calloc(1, sizeof(GdipFont));
|
||||||
if( GdipGetFontCollectionFamilyCount(getCurFontCollection(), &count) ) return NULL;
|
if( GdipGetFontCollectionFamilyCount(nk_gdip_getCurFontCollection(), &count) ) return NULL;
|
||||||
families = (GpFontFamily**)calloc(1, sizeof(GpFontFamily*));
|
families = (GpFontFamily**)calloc(1, sizeof(GpFontFamily*));
|
||||||
if( !families ) return NULL;
|
if( !families ) return NULL;
|
||||||
if( GdipGetFontCollectionFamilyList(getCurFontCollection(), count, families, &count) ) return NULL;
|
if( GdipGetFontCollectionFamilyList(nk_gdip_getCurFontCollection(), count, families, &count) ) return NULL;
|
||||||
if( count < 1 ) return NULL;
|
if( count < 1 ) return NULL;
|
||||||
if( GdipCreateFont(families[count-1], (REAL)size, FontStyleRegular, UnitPixel, &font->handle) ) return NULL;
|
if( GdipCreateFont(families[count-1], (REAL)size, FontStyleRegular, UnitPixel, &font->handle) ) return NULL;
|
||||||
free(families);
|
free(families);
|
||||||
@ -710,18 +695,18 @@ nk_gdipfont_create_from_collection(int size){
|
|||||||
GdipFont*
|
GdipFont*
|
||||||
nk_gdipfont_create_from_memory(const void* membuf, int membufSize, int size)
|
nk_gdipfont_create_from_memory(const void* membuf, int membufSize, int size)
|
||||||
{
|
{
|
||||||
if( !getCurFontCollection() )
|
if( !nk_gdip_getCurFontCollection() )
|
||||||
if( GdipNewPrivateFontCollection(&gdip.fontCollection[gdip.curFontCollection]) ) return NULL;
|
if( GdipNewPrivateFontCollection(&gdip.fontCollection[gdip.curFontCollection]) ) return NULL;
|
||||||
if( GdipPrivateAddMemoryFont(getCurFontCollection(), membuf, membufSize) ) return NULL;
|
if( GdipPrivateAddMemoryFont(nk_gdip_getCurFontCollection(), membuf, membufSize) ) return NULL;
|
||||||
return nk_gdipfont_create_from_collection(size);
|
return nk_gdipfont_create_from_collection(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdipFont*
|
GdipFont*
|
||||||
nk_gdipfont_create_from_file(const WCHAR* filename, int size)
|
nk_gdipfont_create_from_file(const WCHAR* filename, int size)
|
||||||
{
|
{
|
||||||
if( !getCurFontCollection() )
|
if( !nk_gdip_getCurFontCollection() )
|
||||||
if( GdipNewPrivateFontCollection(&gdip.fontCollection[gdip.curFontCollection]) ) return NULL;
|
if( GdipNewPrivateFontCollection(&gdip.fontCollection[gdip.curFontCollection]) ) return NULL;
|
||||||
if( GdipPrivateAddFontFile(getCurFontCollection(), filename) ) return NULL;
|
if( GdipPrivateAddFontFile(nk_gdip_getCurFontCollection(), filename) ) return NULL;
|
||||||
return nk_gdipfont_create_from_collection(size);
|
return nk_gdipfont_create_from_collection(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -860,7 +845,6 @@ nk_gdip_init(HWND hwnd, unsigned int width, unsigned int height)
|
|||||||
StringFormatFlagsMeasureTrailingSpaces | StringFormatFlagsNoWrap |
|
StringFormatFlagsMeasureTrailingSpaces | StringFormatFlagsNoWrap |
|
||||||
StringFormatFlagsNoClip);
|
StringFormatFlagsNoClip);
|
||||||
|
|
||||||
/*gdip.fontCollection = NULL;*/
|
|
||||||
for(i=0; i< sizeof(gdip.fontCollection)/sizeof(gdip.fontCollection[0]); i++)
|
for(i=0; i< sizeof(gdip.fontCollection)/sizeof(gdip.fontCollection[0]); i++)
|
||||||
gdip.fontCollection[i] = NULL;
|
gdip.fontCollection[i] = NULL;
|
||||||
nk_init_default(&gdip.ctx, NULL);
|
nk_init_default(&gdip.ctx, NULL);
|
||||||
@ -1071,7 +1055,6 @@ nk_gdip_handle_event(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
|||||||
NK_API void
|
NK_API void
|
||||||
nk_gdip_shutdown(void)
|
nk_gdip_shutdown(void)
|
||||||
{
|
{
|
||||||
/*GdipDeletePrivateFontCollection( &gdip.fontCollection );*/
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i< gdip.curFontCollection; i++)
|
for(i=0; i< gdip.curFontCollection; i++)
|
||||||
GdipDeletePrivateFontCollection( &gdip.fontCollection[i] );
|
GdipDeletePrivateFontCollection( &gdip.fontCollection[i] );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user