Browse Source

Removed nvgIsBlack, and added isBlack to demo.c

shared-context
Doug Binks 11 years ago
parent
commit
c3f50b9c01
3 changed files with 13 additions and 13 deletions
  1. +12
    -2
      example/demo.c
  2. +1
    -8
      src/nanovg.c
  3. +0
    -3
      src/nanovg.h

+ 12
- 2
example/demo.c View File

@@ -24,6 +24,16 @@
#define ICON_LOGIN 0xE740 #define ICON_LOGIN 0xE740
#define ICON_TRASH 0xE729 #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) static char* cpToUTF8(int cp, char* str)
{ {
int n = 0; 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 cornerRadius = 4.0f;
float tw = 0, iw = 0; 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); nvgBeginPath(vg);
nvgRoundedRect(vg, x+1,y+1, w-2,h-2, cornerRadius-1); nvgRoundedRect(vg, x+1,y+1, w-2,h-2, cornerRadius-1);
if (!nvgIsBlack(col)) {
if (!isBlack(col)) {
nvgFillColor(vg, col); nvgFillColor(vg, col);
nvgFill(vg); nvgFill(vg);
} }


+ 1
- 8
src/nanovg.c View File

@@ -363,14 +363,7 @@ struct NVGcolor nvgHSLA(float h, float s, float l, unsigned char a)
return col; 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) static struct NVGstate* nvg__getState(struct NVGcontext* ctx)
{ {


+ 0
- 3
src/nanovg.h View File

@@ -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] // 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); 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 // State Handling
// //


Loading…
Cancel
Save