Skip to content

Commit

Permalink
nk_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
DeXP authored Oct 4, 2017
1 parent 02e6a81 commit 49c3bcd
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions demo/gdip/nuklear_gdip.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,21 +643,6 @@ nk_gdip_load_image_from_memory(const void *membuf, nk_uint membufSize)
return nk_image_id(0);

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
Expand Down Expand Up @@ -687,7 +672,7 @@ nk_gdipfont_create(const char *name, int size)
}

GpFontCollection*
getCurFontCollection(){
nk_gdip_getCurFontCollection(){
return gdip.fontCollection[gdip.curFontCollection];
}

Expand All @@ -696,10 +681,10 @@ nk_gdipfont_create_from_collection(int size){
GpFontFamily **families;
INT count;
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*));
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( GdipCreateFont(families[count-1], (REAL)size, FontStyleRegular, UnitPixel, &font->handle) ) return NULL;
free(families);
Expand All @@ -710,18 +695,18 @@ nk_gdipfont_create_from_collection(int size){
GdipFont*
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( GdipPrivateAddMemoryFont(getCurFontCollection(), membuf, membufSize) ) return NULL;
if( GdipPrivateAddMemoryFont(nk_gdip_getCurFontCollection(), membuf, membufSize) ) return NULL;
return nk_gdipfont_create_from_collection(size);
}

GdipFont*
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( GdipPrivateAddFontFile(getCurFontCollection(), filename) ) return NULL;
if( GdipPrivateAddFontFile(nk_gdip_getCurFontCollection(), filename) ) return NULL;
return nk_gdipfont_create_from_collection(size);
}

Expand Down Expand Up @@ -860,7 +845,6 @@ nk_gdip_init(HWND hwnd, unsigned int width, unsigned int height)
StringFormatFlagsMeasureTrailingSpaces | StringFormatFlagsNoWrap |
StringFormatFlagsNoClip);

/*gdip.fontCollection = NULL;*/
for(i=0; i< sizeof(gdip.fontCollection)/sizeof(gdip.fontCollection[0]); i++)
gdip.fontCollection[i] = NULL;
nk_init_default(&gdip.ctx, NULL);
Expand Down Expand Up @@ -1071,7 +1055,6 @@ nk_gdip_handle_event(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
NK_API void
nk_gdip_shutdown(void)
{
/*GdipDeletePrivateFontCollection( &gdip.fontCollection );*/
int i;
for(i=0; i< gdip.curFontCollection; i++)
GdipDeletePrivateFontCollection( &gdip.fontCollection[i] );
Expand Down

0 comments on commit 49c3bcd

Please sign in to comment.