From c3f50b9c01daeebcbf9f58050d81ff661ea22dc3 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Thu, 10 Apr 2014 12:19:03 +0200 Subject: [PATCH] Removed nvgIsBlack, and added isBlack to demo.c --- example/demo.c | 14 ++++++++++++-- src/nanovg.c | 9 +-------- src/nanovg.h | 3 --- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/example/demo.c b/example/demo.c index e1c3140..e51e86b 100644 --- a/example/demo.c +++ b/example/demo.c @@ -24,6 +24,16 @@ #define ICON_LOGIN 0xE740 #define ICON_TRASH 0xE729 +// Returns 1 if col.rgba is 0.0f,0.0f,0.0f,0.0f, 0 otherwise +int isBlack( struct NVGcolor col ) +{ + if( col.r == 0.0f && col.g == 0.0f && col.b == 0.0f && col.a == 0.0f ) + { + return 1; + } + return 0; +} + static char* cpToUTF8(int cp, char* str) { int n = 0; @@ -261,10 +271,10 @@ void drawButton(struct NVGcontext* vg, int preicon, const char* text, float x, f float cornerRadius = 4.0f; float tw = 0, iw = 0; - bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,nvgIsBlack(col)?16:32), nvgRGBA(0,0,0,nvgIsBlack(col)?16:32)); + bg = nvgLinearGradient(vg, x,y,x,y+h, nvgRGBA(255,255,255,isBlack(col)?16:32), nvgRGBA(0,0,0,isBlack(col)?16:32)); nvgBeginPath(vg); nvgRoundedRect(vg, x+1,y+1, w-2,h-2, cornerRadius-1); - if (!nvgIsBlack(col)) { + if (!isBlack(col)) { nvgFillColor(vg, col); nvgFill(vg); } diff --git a/src/nanovg.c b/src/nanovg.c index c50657f..25039c4 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -363,14 +363,7 @@ struct NVGcolor nvgHSLA(float h, float s, float l, unsigned char a) return col; } -int nvgIsBlack( struct NVGcolor col ) -{ - if( col.r == 0.0f && col.g == 0.0f && col.b == 0.0f && col.a == 0.0f ) - { - return 1; - } - return 0; -} + static struct NVGstate* nvg__getState(struct NVGcontext* ctx) { diff --git a/src/nanovg.h b/src/nanovg.h index 9233560..7b6577d 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -144,9 +144,6 @@ struct NVGcolor nvgHSL(float h, float s, float l); // HSL values are all in range [0..1], alpha in range [0..255] struct NVGcolor nvgHSLA(float h, float s, float l, unsigned char a); -// Returns 1 if col.rgba is 0.0f,0.0f,0.0f,0.0f, 0 otherwise -int nvgIsBlack( struct NVGcolor col ); - // // State Handling //