Browse Source

Fix typos.

shared-context
Bruce Mitchener 10 years ago
parent
commit
98b116165d
5 changed files with 30 additions and 30 deletions
  1. +1
    -1
      README.md
  2. +1
    -1
      example/example_fbo.c
  3. +6
    -6
      src/fontstash.h
  4. +4
    -4
      src/nanovg.c
  5. +18
    -18
      src/nanovg.h

+ 1
- 1
README.md View File

@@ -17,7 +17,7 @@ The NanoVG API is modeled loosely on HTML5 canvas API. If you know canvas, you'r


## Creating drawing context ## Creating drawing context


The drawing context is created using platform specific constructor function. If you're using the a OpenGL 2.0 back-end the context is created as follows:
The drawing context is created using platform specific constructor function. If you're using the OpenGL 2.0 back-end the context is created as follows:
```C ```C
#define NANOVG_GL2_IMPLEMENTATION // Use GL2 implementation. #define NANOVG_GL2_IMPLEMENTATION // Use GL2 implementation.
#include "nanovg_gl.h" #include "nanovg_gl.h"


+ 1
- 1
example/example_fbo.c View File

@@ -45,7 +45,7 @@ void renderPattern(NVGcontext* vg, NVGLUframebuffer* fb, float t, float pxRatio)
winWidth = (int)(fboWidth / pxRatio); winWidth = (int)(fboWidth / pxRatio);
winHeight = (int)(fboHeight / pxRatio); winHeight = (int)(fboHeight / pxRatio);


// Draw some stull to an FBO as a test
// Draw some stuff to an FBO as a test
nvgluBindFramebuffer(fb); nvgluBindFramebuffer(fb);
glViewport(0, 0, fboWidth, fboHeight); glViewport(0, 0, fboWidth, fboHeight);
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);


+ 6
- 6
src/fontstash.h View File

@@ -43,7 +43,7 @@ enum FONSerrorCode {
FONS_ATLAS_FULL = 1, FONS_ATLAS_FULL = 1,
// Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE. // Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE.
FONS_SCRATCH_FULL = 2, FONS_SCRATCH_FULL = 2,
// Calls to fonsPushState has craeted too large stack, if you need deep state stack bump up FONS_MAX_STATES.
// Calls to fonsPushState has created too large stack, if you need deep state stack bump up FONS_MAX_STATES.
FONS_STATES_OVERFLOW = 3, FONS_STATES_OVERFLOW = 3,
// Trying to pop too many states fonsPopState(). // Trying to pop too many states fonsPopState().
FONS_STATES_UNDERFLOW = 4, FONS_STATES_UNDERFLOW = 4,
@@ -83,7 +83,7 @@ typedef struct FONStextIter FONStextIter;


typedef struct FONScontext FONScontext; typedef struct FONScontext FONScontext;


// Contructor and destructor.
// Constructor and destructor.
FONScontext* fonsCreateInternal(FONSparams* params); FONScontext* fonsCreateInternal(FONSparams* params);
void fonsDeleteInternal(FONScontext* s); void fonsDeleteInternal(FONScontext* s);


@@ -92,7 +92,7 @@ void fonsSetErrorCallback(FONScontext* s, void (*callback)(void* uptr, int error
void fonsGetAtlasSize(FONScontext* s, int* width, int* height); void fonsGetAtlasSize(FONScontext* s, int* width, int* height);
// Expands the atlas size. // Expands the atlas size.
int fonsExpandAtlas(FONScontext* s, int width, int height); int fonsExpandAtlas(FONScontext* s, int width, int height);
// Reseta the whole stash.
// Resets the whole stash.
int fonsResetAtlas(FONScontext* stash, int width, int height); int fonsResetAtlas(FONScontext* stash, int width, int height);


// Add fonts // Add fonts
@@ -585,7 +585,7 @@ static int fons__atlasAddSkylineLevel(FONSatlas* atlas, int idx, int x, int y, i
if (fons__atlasInsertNode(atlas, idx, x, y+h, w) == 0) if (fons__atlasInsertNode(atlas, idx, x, y+h, w) == 0)
return 0; return 0;


// Delete skyline segments that fall under the shaodw of the new segment.
// Delete skyline segments that fall under the shadow of the new segment.
for (i = idx+1; i < atlas->nnodes; i++) { for (i = idx+1; i < atlas->nnodes; i++) {
if (atlas->nodes[i].x < atlas->nodes[i-1].x + atlas->nodes[i-1].width) { if (atlas->nodes[i].x < atlas->nodes[i-1].x + atlas->nodes[i-1].width) {
int shrink = atlas->nodes[i-1].x + atlas->nodes[i-1].width - atlas->nodes[i].x; int shrink = atlas->nodes[i-1].x + atlas->nodes[i-1].width - atlas->nodes[i].x;
@@ -1122,7 +1122,7 @@ static void fons__getQuad(FONScontext* stash, FONSfont* font,


// Each glyph has 2px border to allow good interpolation, // Each glyph has 2px border to allow good interpolation,
// one pixel to prevent leaking, and one to allow good interpolation for rendering. // one pixel to prevent leaking, and one to allow good interpolation for rendering.
// Inset the texture region by one pixel for corret interpolation.
// Inset the texture region by one pixel for correct interpolation.
xoff = (short)(glyph->xoff+1); xoff = (short)(glyph->xoff+1);
yoff = (short)(glyph->yoff+1); yoff = (short)(glyph->yoff+1);
x0 = (float)(glyph->x0+1); x0 = (float)(glyph->x0+1);
@@ -1621,7 +1621,7 @@ int fonsExpandAtlas(FONScontext* stash, int width, int height)
// Increase atlas size // Increase atlas size
fons__atlasExpand(stash->atlas, width, height); fons__atlasExpand(stash->atlas, width, height);


// Add axisting data as dirty.
// Add existing data as dirty.
for (i = 0; i < stash->atlas->nnodes; i++) for (i = 0; i < stash->atlas->nnodes; i++)
maxy = fons__maxi(maxy, stash->atlas->nodes[i].y); maxy = fons__maxi(maxy, stash->atlas->nodes[i].y);
stash->dirtyRect[0] = 0; stash->dirtyRect[0] = 0;


+ 4
- 4
src/nanovg.c View File

@@ -41,7 +41,7 @@
#define NVG_INIT_VERTS_SIZE 256 #define NVG_INIT_VERTS_SIZE 256
#define NVG_MAX_STATES 32 #define NVG_MAX_STATES 32


#define NVG_KAPPA90 0.5522847493f // Lenght proportional to radius of a cubic bezier handle for 90deg arcs.
#define NVG_KAPPA90 0.5522847493f // Length proportional to radius of a cubic bezier handle for 90deg arcs.


#define NVG_COUNTOF(arr) (sizeof(arr) / sizeof(0[arr])) #define NVG_COUNTOF(arr) (sizeof(arr) / sizeof(0[arr]))


@@ -2327,7 +2327,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char*
break; break;
} }
prevIter = iter; prevIter = iter;
// Trasnform corners.
// Transform corners.
nvgTransformPoint(&c[0],&c[1], state->xform, q.x0*invscale, q.y0*invscale); nvgTransformPoint(&c[0],&c[1], state->xform, q.x0*invscale, q.y0*invscale);
nvgTransformPoint(&c[2],&c[3], state->xform, q.x1*invscale, q.y0*invscale); nvgTransformPoint(&c[2],&c[3], state->xform, q.x1*invscale, q.y0*invscale);
nvgTransformPoint(&c[4],&c[5], state->xform, q.x1*invscale, q.y1*invscale); nvgTransformPoint(&c[4],&c[5], state->xform, q.x1*invscale, q.y1*invscale);
@@ -2587,7 +2587,7 @@ int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, floa
wordStartX = iter.x; wordStartX = iter.x;
wordMinX = q.x0 - rowStartX; wordMinX = q.x0 - rowStartX;
} else { } else {
// Break the line from the end of the last word, and start new line from the begining of the new.
// Break the line from the end of the last word, and start new line from the beginning of the new.
rows[nrows].start = rowStart; rows[nrows].start = rowStart;
rows[nrows].end = breakEnd; rows[nrows].end = breakEnd;
rows[nrows].width = breakWidth * invscale; rows[nrows].width = breakWidth * invscale;
@@ -2617,7 +2617,7 @@ int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, floa
ptype = type; ptype = type;
} }


// Break the line from the end of the last word, and start new line from the begining of the new.
// Break the line from the end of the last word, and start new line from the beginning of the new.
if (rowStart != NULL) { if (rowStart != NULL) {
rows[nrows].start = rowStart; rows[nrows].start = rowStart;
rows[nrows].end = rowEnd; rows[nrows].end = rowEnd;


+ 18
- 18
src/nanovg.h View File

@@ -142,7 +142,7 @@ NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned cha
NVGcolor nvgRGBAf(float r, float g, float b, float a); NVGcolor nvgRGBAf(float r, float g, float b, float a);




// Linearly interpoaltes from color c0 to c1, and returns resulting color value.
// Linearly interpolates from color c0 to c1, and returns resulting color value.
NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u); NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u);


// Sets transparency of a color value. // Sets transparency of a color value.
@@ -191,7 +191,7 @@ void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
// Sets current stroke style to a paint, which can be a one of the gradients or a pattern. // Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint); void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint);


// Sets current fill cstyle to a solid color.
// Sets current fill style to a solid color.
void nvgFillColor(NVGcontext* ctx, NVGcolor color); void nvgFillColor(NVGcontext* ctx, NVGcolor color);


// Sets current fill style to a paint, which can be a one of the gradients or a pattern. // Sets current fill style to a paint, which can be a one of the gradients or a pattern.
@@ -201,7 +201,7 @@ void nvgFillPaint(NVGcontext* ctx, NVGpaint paint);
// Miter limit controls when a sharp corner is beveled. // Miter limit controls when a sharp corner is beveled.
void nvgMiterLimit(NVGcontext* ctx, float limit); void nvgMiterLimit(NVGcontext* ctx, float limit);


// Sets the stroke witdth of the stroke style.
// Sets the stroke width of the stroke style.
void nvgStrokeWidth(NVGcontext* ctx, float size); void nvgStrokeWidth(NVGcontext* ctx, float size);


// Sets how the end of the line (cap) is drawn, // Sets how the end of the line (cap) is drawn,
@@ -213,7 +213,7 @@ void nvgLineCap(NVGcontext* ctx, int cap);
void nvgLineJoin(NVGcontext* ctx, int join); void nvgLineJoin(NVGcontext* ctx, int join);


// Sets the transparency applied to all rendered shapes. // Sets the transparency applied to all rendered shapes.
// Alreade transparent paths will get proportionally more transparent as well.
// Already transparent paths will get proportionally more transparent as well.
void nvgGlobalAlpha(NVGcontext* ctx, float alpha); void nvgGlobalAlpha(NVGcontext* ctx, float alpha);


// //
@@ -246,16 +246,16 @@ void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e,
// Translates current coordinate system. // Translates current coordinate system.
void nvgTranslate(NVGcontext* ctx, float x, float y); void nvgTranslate(NVGcontext* ctx, float x, float y);


// Rotates current coordinate system. Angle is specifid in radians.
// Rotates current coordinate system. Angle is specified in radians.
void nvgRotate(NVGcontext* ctx, float angle); void nvgRotate(NVGcontext* ctx, float angle);


// Skews the current coordinate system along X axis. Angle is specifid in radians.
// Skews the current coordinate system along X axis. Angle is specified in radians.
void nvgSkewX(NVGcontext* ctx, float angle); void nvgSkewX(NVGcontext* ctx, float angle);


// Skews the current coordinate system along Y axis. Angle is specifid in radians.
// Skews the current coordinate system along Y axis. Angle is specified in radians.
void nvgSkewY(NVGcontext* ctx, float angle); void nvgSkewY(NVGcontext* ctx, float angle);


// Scales the current coordinat system.
// Scales the current coordinate system.
void nvgScale(NVGcontext* ctx, float x, float y); void nvgScale(NVGcontext* ctx, float x, float y);


// Stores the top part (a-f) of the current transformation matrix in to the specified buffer. // Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
@@ -267,7 +267,7 @@ void nvgCurrentTransform(NVGcontext* ctx, float* xform);




// The following functions can be used to make calculations on 2x3 transformation matrices. // The following functions can be used to make calculations on 2x3 transformation matrices.
// A 2x3 matrix is representated as float[6].
// A 2x3 matrix is represented as float[6].


// Sets the transform to identity matrix. // Sets the transform to identity matrix.
void nvgTransformIdentity(float* dst); void nvgTransformIdentity(float* dst);
@@ -278,13 +278,13 @@ void nvgTransformTranslate(float* dst, float tx, float ty);
// Sets the transform to scale matrix. // Sets the transform to scale matrix.
void nvgTransformScale(float* dst, float sx, float sy); void nvgTransformScale(float* dst, float sx, float sy);


// Sets the transform to rotate matrix. Angle is specifid in radians.
// Sets the transform to rotate matrix. Angle is specified in radians.
void nvgTransformRotate(float* dst, float a); void nvgTransformRotate(float* dst, float a);


// Sets the transform to skew-x matrix. Angle is specifid in radians.
// Sets the transform to skew-x matrix. Angle is specified in radians.
void nvgTransformSkewX(float* dst, float a); void nvgTransformSkewX(float* dst, float a);


// Sets the transform to skew-y matrix. Angle is specifid in radians.
// Sets the transform to skew-y matrix. Angle is specified in radians.
void nvgTransformSkewY(float* dst, float a); void nvgTransformSkewY(float* dst, float a);


// Sets the transform to the result of multiplication of two transforms, of A = A*B. // Sets the transform to the result of multiplication of two transforms, of A = A*B.
@@ -300,7 +300,7 @@ int nvgTransformInverse(float* dst, const float* src);
// Transform a point by given transform. // Transform a point by given transform.
void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy); void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy);


// Converts degress to radians and vice versa.
// Converts degrees to radians and vice versa.
float nvgDegToRad(float deg); float nvgDegToRad(float deg);
float nvgRadToDeg(float rad); float nvgRadToDeg(float rad);


@@ -326,7 +326,7 @@ int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsi
// Updates image data specified by image handle. // Updates image data specified by image handle.
void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data); void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data);


// Returns the domensions of a created image.
// Returns the dimensions of a created image.
void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h); void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h);


// Deletes created image. // Deletes created image.
@@ -345,7 +345,7 @@ NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float
NVGcolor icol, NVGcolor ocol); NVGcolor icol, NVGcolor ocol);


// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering // Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
// drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry // (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. // the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
@@ -367,7 +367,7 @@ NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey
// //
// Scissoring // Scissoring
// //
// Scissoring allows you to clip the rendering into a rectangle. This is useful for varius
// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
// user interface cases like rendering a text edit or a timeline. // user interface cases like rendering a text edit or a timeline.


// Sets the current scissor rectangle. // Sets the current scissor rectangle.
@@ -506,7 +506,7 @@ void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
// Sets the proportional line height of current text style. The line height is specified as multiple of font size. // Sets the proportional line height of current text style. The line height is specified as multiple of font size.
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight); void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);


// Sets the text align of current text style, see NVGaling for options.
// Sets the text align of current text style, see NVGalign for options.
void nvgTextAlign(NVGcontext* ctx, int align); void nvgTextAlign(NVGcontext* ctx, int align);


// Sets the font face based on specified id of current text style. // Sets the font face based on specified id of current text style.
@@ -598,7 +598,7 @@ struct NVGparams {
}; };
typedef struct NVGparams NVGparams; typedef struct NVGparams NVGparams;


// Contructor and destructor, called by the render back-end.
// Constructor and destructor, called by the render back-end.
NVGcontext* nvgCreateInternal(NVGparams* params); NVGcontext* nvgCreateInternal(NVGparams* params);
void nvgDeleteInternal(NVGcontext* ctx); void nvgDeleteInternal(NVGcontext* ctx);




Loading…
Cancel
Save