mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
Renames in nano svg to follow conventions nsvg__
Remove global FrameTime and NumFrames.
This commit is contained in:
parent
d512413977
commit
c35c0c520c
@ -48,11 +48,6 @@ extern const INTN IconsNamesSize;
|
||||
extern void
|
||||
WaitForKeyPress(CHAR16 *Message);
|
||||
|
||||
extern void DumpFloat2 (CONST char* s, float* t, int N);
|
||||
|
||||
extern UINTN NumFrames;
|
||||
extern UINTN FrameTime;
|
||||
|
||||
|
||||
EFI_STATUS XTheme::ParseSVGXIcon(NSVGparser* SVGParser, INTN Id, const XString8& IconNameX, OUT XImage* Image)
|
||||
{
|
||||
@ -68,7 +63,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(NSVGparser* SVGParser, INTN Id, const XString8&
|
||||
shape = SVGimage->shapes;
|
||||
while (shape) {
|
||||
shapeNext = shape->next;
|
||||
if ( isShapeInGroup(shape, IconNameX.c_str()) )
|
||||
if ( nsvg__isShapeInGroup(shape, IconNameX.c_str()) )
|
||||
{
|
||||
if (BootCampStyle && IconNameX.contains("selection_big")) {
|
||||
shape->opacity = 0.f;
|
||||
@ -138,9 +133,9 @@ EFI_STATUS XTheme::ParseSVGXIcon(NSVGparser* SVGParser, INTN Id, const XString8&
|
||||
ty = (Height - realHeight) * 0.5f;
|
||||
}
|
||||
|
||||
NSVGrasterizer* rast = nsvgCreateRasterizer();
|
||||
NSVGrasterizer* rast = nsvg__createRasterizer();
|
||||
nsvgRasterize(rast, SVGimage, bounds, IconNameX.c_str(), tx, ty, Scale, Scale, (UINT8*)NewImage.GetPixelPtr(0,0), iWidth, iHeight, iWidth*4);
|
||||
nsvgDeleteRasterizer(rast);
|
||||
nsvg__deleteRasterizer(rast);
|
||||
*Image = NewImage; //copy array
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -161,7 +156,7 @@ if ( nsvg__nbDanglingPtr() > 0 ) {
|
||||
char* buffer2 = (char*)malloc(Size);
|
||||
memcpy(buffer2, buffer, Size);
|
||||
nvsg__memoryallocation_verbose = false;
|
||||
NSVGparser* p = nsvgParse(buffer2, 72, 1.f); //the buffer will be modified, it is how nanosvg works
|
||||
NSVGparser* p = nsvg__parse(buffer2, 72, 1.f); //the buffer will be modified, it is how nanosvg works
|
||||
nsvg__deleteParser(p);
|
||||
if ( nsvg__nbDanglingPtr() > 0 ) {
|
||||
nsvg__outputDanglingPtr();
|
||||
@ -169,7 +164,7 @@ if ( nsvg__nbDanglingPtr() > 0 ) {
|
||||
#if 1
|
||||
// Do it a second time, to display all allocations and to be able to step in with debugger
|
||||
memcpy(buffer2, buffer, Size);
|
||||
p = nsvgParse(buffer2, 72, 1.f); //the buffer will be modified, it is how nanosvg works
|
||||
p = nsvg__parse(buffer2, 72, 1.f); //the buffer will be modified, it is how nanosvg works
|
||||
nsvg__deleteParser(p);
|
||||
nsvg__outputDanglingPtr();
|
||||
#endif
|
||||
@ -182,7 +177,7 @@ if ( nsvg__nbDanglingPtr() > 0 ) {
|
||||
#endif
|
||||
|
||||
// --- Parse theme.svg --- low case
|
||||
NSVGparser* SVGParser = nsvgParse((CHAR8*)buffer, 72, 1.f); //the buffer will be modified, it is how nanosvg works// Jief : NEVER cast const to not const. Just change the parameter to not const !!! Nothing better to deceive.
|
||||
NSVGparser* SVGParser = nsvg__parse((CHAR8*)buffer, 72, 1.f); //the buffer will be modified, it is how nanosvg works// Jief : NEVER cast const to not const. Just change the parameter to not const !!! Nothing better to deceive.
|
||||
|
||||
NSVGimage *SVGimage = SVGParser->image;
|
||||
if (!SVGimage) {
|
||||
@ -379,7 +374,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, const textFac
|
||||
float fH = fontSVG->bbox[3] - fontSVG->bbox[1]; //1250
|
||||
if (fH == 0.f) {
|
||||
DBG("wrong font: %f\n", fontSVG->unitsPerEm);
|
||||
DumpFloat2("Font bbox", fontSVG->bbox, 4);
|
||||
nsvg__dumpFloat("Font bbox", fontSVG->bbox, 4);
|
||||
fH = (fontSVG->unitsPerEm > 1.f) ? fontSVG->unitsPerEm : 1000.0f; //1000
|
||||
}
|
||||
sy = (float)Height / fH; //(float)fontSVG->unitsPerEm; // 260./1250.
|
||||
@ -395,21 +390,21 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, const textFac
|
||||
}
|
||||
// DBG("add letter 0x%X\n", letter);
|
||||
if (i == Cursor) {
|
||||
addLetter(p, 0x5F, x, y, sy, color);
|
||||
nsvg__addLetter(p, 0x5F, x, y, sy, color);
|
||||
}
|
||||
x = addLetter(p, letter, x, y, sy, color);
|
||||
x = nsvg__addLetter(p, letter, x, y, sy, color);
|
||||
} //end of string
|
||||
|
||||
p->image->realBounds[0] = fontSVG->bbox[0] * Scale;
|
||||
p->image->realBounds[1] = fontSVG->bbox[1] * Scale;
|
||||
p->image->realBounds[2] = fontSVG->bbox[2] * Scale + x; //last bound
|
||||
p->image->realBounds[3] = fontSVG->bbox[3] * Scale;
|
||||
rast = nsvgCreateRasterizer();
|
||||
rast = nsvg__createRasterizer();
|
||||
nsvgRasterize(rast, p->image, 0, 0, 1.f, 1.f, (UINT8*)TextBufferXY.GetPixelPtr(0,0),
|
||||
(int)TextBufferXY.GetWidth(), (int)TextBufferXY.GetHeight(), (int)(Width*4));
|
||||
float RealWidth = p->image->realBounds[2] - p->image->realBounds[0];
|
||||
|
||||
nsvgDeleteRasterizer(rast);
|
||||
nsvg__deleteRasterizer(rast);
|
||||
nsvg__deleteParser(p); // this deletes p->text;
|
||||
// nsvgDelete(p->image);
|
||||
// TODO delete parser p and p->text?
|
||||
@ -498,7 +493,7 @@ void testSVG()
|
||||
#endif
|
||||
#if TEST_SVG_IMAGE
|
||||
|
||||
NSVGrasterizer* rast = nsvgCreateRasterizer();
|
||||
NSVGrasterizer* rast = nsvg__createRasterizer();
|
||||
// EG_IMAGE *NewImage;
|
||||
NSVGimage *SVGimage;
|
||||
float Scale, ScaleX, ScaleY;
|
||||
@ -508,7 +503,7 @@ void testSVG()
|
||||
if (!EFI_ERROR(Status)) {
|
||||
//Parse XML to vector data
|
||||
|
||||
p = nsvgParse((CHAR8*)FileData, 72, 1.f);
|
||||
p = nsvg__parse((CHAR8*)FileData, 72, 1.f);
|
||||
SVGimage = p->image;
|
||||
DBG("Test image width=%d heigth=%d\n", (int)(SVGimage->width), (int)(SVGimage->height));
|
||||
|
||||
@ -531,7 +526,7 @@ void testSVG()
|
||||
FileData = NULL;
|
||||
//
|
||||
// nsvg__deleteParser(p);
|
||||
nsvgDeleteRasterizer(rast);
|
||||
nsvg__deleteRasterizer(rast);
|
||||
|
||||
}
|
||||
|
||||
@ -544,7 +539,7 @@ void testSVG()
|
||||
Status = egLoadFile(&self.getSelfVolumeRootDir(), L"Font.svg", &FileData, &FileDataLength);
|
||||
DBG("test Font.svg loaded status=%s\n", efiStrError(Status));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
p = nsvgParse((CHAR8*)FileData, 72, 1.f);
|
||||
p = nsvg__parse((CHAR8*)FileData, 72, 1.f);
|
||||
if (!p) {
|
||||
DBG("font not parsed\n");
|
||||
break;
|
||||
|
@ -118,6 +118,10 @@ public:
|
||||
|
||||
XCinema Cinema;
|
||||
|
||||
UINTN NumFrames;
|
||||
UINTN FrameTime;
|
||||
|
||||
|
||||
public:
|
||||
NSVGfontChain* fontsDB = 0;
|
||||
textFaces textFace[4]; //0-help 1-message 2-menu 3-test, far future it will be infinite list with id // in VectorGraphics, I use sizeof(textFace)/sizeof(textFace[0]. So if you change that to a pointer, it'll break.
|
||||
|
@ -104,8 +104,6 @@
|
||||
|
||||
//TODO there are anime properties should be properties of FilmC
|
||||
//which is not accessible here
|
||||
UINTN NumFrames;
|
||||
UINTN FrameTime;
|
||||
|
||||
//#define NANOSVG_MEMORY_ALLOCATION_TRACE
|
||||
|
||||
@ -114,18 +112,18 @@ UINTN FrameTime;
|
||||
|
||||
int nvsg__memoryallocation_verbose = false;
|
||||
|
||||
XArray<uintptr_t> allocatedPtr;
|
||||
XArray<uintptr_t> nsvg__allocatedPtr;
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
XObjArray<XString8> allocatedPtrMsg;
|
||||
XObjArray<XString8> nsvg__allocatedPtrMsg;
|
||||
#endif
|
||||
|
||||
void* nsvg__alloc(UINTN size, const XString8& msg)
|
||||
{
|
||||
void* buffer = AllocatePool(size);
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__alloc(%lld) - %s = %llx\n", size, msg.c_str(), uintptr_t(buffer));
|
||||
allocatedPtr.Add(uintptr_t(buffer));
|
||||
nsvg__allocatedPtr.Add(uintptr_t(buffer));
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
nsvg__allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
@ -134,9 +132,9 @@ void* nsvg__alloczero(UINTN size, const XString8& msg)
|
||||
{
|
||||
void* buffer = AllocateZeroPool(size);
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__alloczero(%lld) - %s = %llx\n", size, msg.c_str(), uintptr_t(buffer));
|
||||
allocatedPtr.Add(uintptr_t(buffer));
|
||||
nsvg__allocatedPtr.Add(uintptr_t(buffer));
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
nsvg__allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
@ -145,9 +143,9 @@ void* nsvg__alloccopy(UINTN size, const void* ref, const XString8& msg)
|
||||
{
|
||||
void* buffer = AllocateCopyPool(size, ref);
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__alloccopy(%lld, %llx) - %s = %llx\n", size, uintptr_t(ref), msg.c_str(), uintptr_t(buffer));
|
||||
allocatedPtr.Add(uintptr_t(buffer));
|
||||
nsvg__allocatedPtr.Add(uintptr_t(buffer));
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
nsvg__allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
@ -155,17 +153,17 @@ void* nsvg__alloccopy(UINTN size, const void* ref, const XString8& msg)
|
||||
void* nsvg__realloc(UINTN oldsize, UINTN newsize, void* ref, const XString8& msg)
|
||||
{
|
||||
uintptr_t ref2 = uintptr_t(ref);
|
||||
auto idx = allocatedPtr.indexOf(ref2);
|
||||
auto idx = nsvg__allocatedPtr.indexOf(ref2);
|
||||
if ( idx == MAX_XSIZE ) log_technical_bug("nsvg__realloc");
|
||||
void* buffer = ReallocatePool(oldsize, newsize, ref);
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__realloc(%lld, %lld, %llx) - %s = %llx\n", oldsize, newsize, uintptr_t(ref), msg.c_str(), uintptr_t(buffer));
|
||||
allocatedPtr.RemoveAtIndex(idx);
|
||||
nsvg__allocatedPtr.RemoveAtIndex(idx);
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.RemoveAtIndex(idx);
|
||||
nsvg__allocatedPtrMsg.RemoveAtIndex(idx);
|
||||
#endif
|
||||
allocatedPtr.Add(uintptr_t(buffer));
|
||||
nsvg__allocatedPtr.Add(uintptr_t(buffer));
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
nsvg__allocatedPtrMsg.AddCopy(XString8(msg), true);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
@ -176,36 +174,36 @@ void nsvg__delete(void* buffer, const XString8& msg)
|
||||
// DBG("stop");
|
||||
//}
|
||||
uintptr_t ref2 = uintptr_t(buffer);
|
||||
auto idx = allocatedPtr.indexOf(ref2);
|
||||
auto idx = nsvg__allocatedPtr.indexOf(ref2);
|
||||
if ( idx == MAX_XSIZE ) {
|
||||
log_technical_bug("nsvg__delete %llx", uintptr_t(buffer));
|
||||
}
|
||||
EFI_STATUS Status = gBS->FreePool(buffer);
|
||||
(void)Status;
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__delete(%llx) - allocation msg %s - %s - Status = %s\n", uintptr_t(buffer), allocatedPtrMsg[idx].c_str(), msg.c_str(), efiStrError(Status));
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__delete(%llx) - allocation msg %s - %s - Status = %s\n", uintptr_t(buffer), nsvg__allocatedPtrMsg[idx].c_str(), msg.c_str(), efiStrError(Status));
|
||||
#else
|
||||
if ( nvsg__memoryallocation_verbose ) DBG("nsvg__delete(%llx) - %s - Status = %s\n", uintptr_t(buffer), msg.c_str(), efiStrError(Status));
|
||||
#endif
|
||||
allocatedPtr.RemoveAtIndex(idx);
|
||||
nsvg__allocatedPtr.RemoveAtIndex(idx);
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
allocatedPtrMsg.RemoveAtIndex(idx);
|
||||
nsvg__allocatedPtrMsg.RemoveAtIndex(idx);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t nsvg__nbDanglingPtr()
|
||||
{
|
||||
return allocatedPtr.length();
|
||||
return nsvg__allocatedPtr.length();
|
||||
}
|
||||
|
||||
|
||||
void nsvg__outputDanglingPtr()
|
||||
{
|
||||
for(size_t i=0;i<allocatedPtr.length();++i){
|
||||
for(size_t i=0;i<nsvg__allocatedPtr.length();++i){
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE_VERBOSE
|
||||
DBG("Dangling ptr %llx %s\n", allocatedPtr[i], allocatedPtrMsg[i].c_str());
|
||||
DBG("Dangling ptr %llx %s\n", nsvg__allocatedPtr[i], nsvg__allocatedPtrMsg[i].c_str());
|
||||
#else
|
||||
DBG("Dangling ptr %llx\n", allocatedPtr[i]);
|
||||
DBG("Dangling ptr %llx\n", nsvg__allocatedPtr[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -217,10 +215,10 @@ void nsvg__outputDanglingPtr()
|
||||
|
||||
|
||||
//int nsvg__shapesBound(NSVGshape *shapes, float* bounds);
|
||||
void takeXformBounds(NSVGshape *shape, float *xform, float *bounds);
|
||||
void nsvg__takeXformBounds(NSVGshape *shape, float *xform, float *bounds);
|
||||
void nsvg__deleteShapes(NSVGshape* shape);
|
||||
|
||||
void DumpFloat2 (CONST char* s, float* t, int N)
|
||||
void nsvg__dumpFloat(CONST char* s, float* t, int N)
|
||||
{
|
||||
#if DEBUG_SVG
|
||||
int i;
|
||||
@ -240,7 +238,7 @@ void DumpFloat2 (CONST char* s, float* t, int N)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int getIntegerDict(const char* s)
|
||||
static int nsvg__getIntegerDict(const char* s)
|
||||
{
|
||||
if ((s[1] == 'x') || (s[1] == 'X')) {
|
||||
return (int)AsciiStrHexToUintn (s);
|
||||
@ -743,7 +741,7 @@ void nsvg__deleteParser(NSVGparser* p)
|
||||
nsvg__deletePaths(p->pathList);
|
||||
nsvg__deleteGradientData(p->gradients);
|
||||
nsvg__deleteFontChain(p->fontsDB);
|
||||
nsvgDelete(p->image);
|
||||
nsvg__deleteImage(p->image);
|
||||
if (p->cpts > 0 && p->pts) {
|
||||
nsvg__delete(p->pts, "nsvg__deleteParser2"_XS8);
|
||||
}
|
||||
@ -967,7 +965,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGg
|
||||
}
|
||||
data = nsvg__findGradientData(p, link->id);
|
||||
if (data == NULL) return NULL;
|
||||
// DumpFloat2("gradient data xform:", data->xform, 6);
|
||||
// nsvg__dumpFloat("gradient data xform:", data->xform, 6);
|
||||
stops = data->stops;
|
||||
nstops = data->nstops;
|
||||
ref = nsvg__findGradientData(p, data->ref);
|
||||
@ -987,7 +985,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGg
|
||||
if (refIter > 32) break; // prevent infinite loops on malformed data
|
||||
}
|
||||
if (stops == NULL) return NULL;
|
||||
// DumpFloat2("gradient final xform:", data->xform, 6);
|
||||
// nsvg__dumpFloat("gradient final xform:", data->xform, 6);
|
||||
grad = (NSVGgradient*)nsvg__alloczero(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1), "nsvg__createGradient"_XS8);
|
||||
if (grad == NULL) return NULL;
|
||||
// The shape width and height.
|
||||
@ -1103,8 +1101,8 @@ static void nsvg__getSymbolBounds(NSVGparser* p)
|
||||
symbol->bounds[2] = -FLT_MAX;
|
||||
symbol->bounds[3] = -FLT_MAX;
|
||||
nsvg__shapesBound(shape, symbol->bounds);
|
||||
// DumpFloat2("Symbol has bounds", symbol->bounds, 4); //nothing
|
||||
DumpFloat2("Symbol has viewbox", symbol->viewBox, 4);
|
||||
// nsvg__dumpFloat("Symbol has bounds", symbol->bounds, 4); //nothing
|
||||
nsvg__dumpFloat("Symbol has viewbox", symbol->viewBox, 4);
|
||||
}
|
||||
*/
|
||||
static void nsvg__addShape(NSVGparser* p)
|
||||
@ -2097,7 +2095,7 @@ static NSVGclipPath* nsvg__findClipPath(NSVGparser* p, const char* name)
|
||||
return *link;
|
||||
}
|
||||
|
||||
static int substr(const char* aClass, char* style)
|
||||
static int nsvg__substr(const char* aClass, char* style)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
@ -2280,7 +2278,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, char* value)
|
||||
else if (strcmp(name, "class") == 0) {
|
||||
NSVGstyles* style = p->styles;
|
||||
while (style) {
|
||||
if (substr(value, style->name) != 0) {
|
||||
if (nsvg__substr(value, style->name) != 0) {
|
||||
nsvg__parseStyle(p, style->description);
|
||||
}
|
||||
style = style->next;
|
||||
@ -2929,7 +2927,7 @@ static void nsvg__parseUse(NSVGparser* p, char** dict)
|
||||
|
||||
nsvg__xformSetTranslation(&xform[0], x, y);
|
||||
nsvg__xformMultiply(&xform[0], attr->xform); //translate before rotate
|
||||
// DumpFloat2("use xform", xform, 6);
|
||||
// nsvg__dumpFloat("use xform", xform, 6);
|
||||
|
||||
if (ref) {
|
||||
shape = (NSVGshape*)nsvg__alloccopy(sizeof(NSVGshape), ref, "nsvg__parseUse shape"_XS8);
|
||||
@ -2943,8 +2941,8 @@ static void nsvg__parseUse(NSVGparser* p, char** dict)
|
||||
shape->bounds[1] = FLT_MAX;
|
||||
shape->bounds[2] = -FLT_MAX;
|
||||
shape->bounds[3] = -FLT_MAX;
|
||||
takeXformBounds(ref, &xform[0], shape->bounds);
|
||||
// DumpFloat2("used shape has bounds", shape->bounds, 4);
|
||||
nsvg__takeXformBounds(ref, &xform[0], shape->bounds);
|
||||
// nsvg__dumpFloat("used shape has bounds", shape->bounds, 4);
|
||||
} else if (refSym) {
|
||||
shape = (NSVGshape*)nsvg__alloczero(sizeof(NSVGshape), "nsvg__parseUse shape2"_XS8);
|
||||
if (!shape) return;
|
||||
@ -2963,10 +2961,10 @@ static void nsvg__parseUse(NSVGparser* p, char** dict)
|
||||
while (shapeInt) {
|
||||
memcpy(&xform2[0], shape->xform, sizeof(float)*6);
|
||||
nsvg__xformPremultiply(&xform2[0], shapeInt->xform);
|
||||
takeXformBounds(shapeInt, &xform2[0], shape->bounds);
|
||||
nsvg__takeXformBounds(shapeInt, &xform2[0], shape->bounds);
|
||||
shapeInt = shapeInt->next;
|
||||
}
|
||||
// DumpFloat2("used symbol has bounds", shape->bounds, 4);
|
||||
// nsvg__dumpFloat("used symbol has bounds", shape->bounds, 4);
|
||||
}
|
||||
|
||||
/* //there can't be own gradient
|
||||
@ -3129,7 +3127,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict)
|
||||
Status = egLoadFile(&ThemeX->getThemeDir(), FontFileName.wc_str(), &FileData, &FileDataLength);
|
||||
// DBG(" font %s loaded status=%lld, %s\n", text->fontFace->fontFamily, Status, efiStrError(Status));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
p1 = nsvgParse((CHAR8*)FileData, 72, 1.0f); //later we will free parser p1
|
||||
p1 = nsvg__parse((CHAR8*)FileData, 72, 1.0f); //later we will free parser p1
|
||||
if (!p1) {
|
||||
// DBG("font %s not parsed\n", text->fontFace->fontFamily);
|
||||
} else {
|
||||
@ -3419,7 +3417,7 @@ static void nsvg__parsePoly(NSVGparser* p, char** attr, int closeFlag)
|
||||
*/
|
||||
|
||||
//parse embedded PNG image
|
||||
static void parseImage(NSVGparser* p, char** dict)
|
||||
static void nsvg__parseEmbeddedPNG(NSVGparser* p, char** dict)
|
||||
{
|
||||
// NSVGattrib* attr = nsvg__getAttr(p);
|
||||
NSVGpattern *pt = NULL;
|
||||
@ -3461,7 +3459,7 @@ static void parseImage(NSVGparser* p, char** dict)
|
||||
}
|
||||
}
|
||||
|
||||
static void parsePattern(NSVGparser* p, char** dict)
|
||||
static void nsvg__parsePattern(NSVGparser* p, char** dict)
|
||||
{
|
||||
NSVGattrib* attr = nsvg__getAttr(p);
|
||||
int i;
|
||||
@ -3591,9 +3589,9 @@ static void nsvg__parseGradient(NSVGparser* p, char** attr, char type)
|
||||
} else if (strcmp(attr[i], "y2") == 0) {
|
||||
grad->direction.linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]);
|
||||
} else if (strcmp(attr[i], "clover:ditherCoarse") == 0) {
|
||||
grad->ditherCoarse = getIntegerDict(attr[i + 1]);
|
||||
grad->ditherCoarse = nsvg__getIntegerDict(attr[i + 1]);
|
||||
} else if (strcmp(attr[i], "clover:conic") == 0) {
|
||||
int conic = getIntegerDict(attr[i + 1]);
|
||||
int conic = nsvg__getIntegerDict(attr[i + 1]);
|
||||
if (conic > 0) {
|
||||
grad->type = NSVG_PAINT_CONIC_GRADIENT;
|
||||
}
|
||||
@ -3729,6 +3727,7 @@ static void nsvg__parseGroup(NSVGparser* p, char** dict)
|
||||
}
|
||||
|
||||
//parse Clover settings for theme
|
||||
// What's this doing here ???? XTheme method are supposed to be in XTheme.cpp.
|
||||
void XTheme::parseTheme(void* parser, char** dict)
|
||||
{
|
||||
NSVGparser* p = (NSVGparser*)parser;
|
||||
@ -3736,24 +3735,24 @@ void XTheme::parseTheme(void* parser, char** dict)
|
||||
UINT32 Color = 0x80808080; //default value
|
||||
for (int i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "SelectionOnTop") == 0) {
|
||||
SelectionOnTop = getIntegerDict(dict[i+1]) > 0;
|
||||
SelectionOnTop = nsvg__getIntegerDict(dict[i+1]) > 0;
|
||||
} else if (strcmp(dict[i], "BadgeOffsetX") == 0) {
|
||||
BadgeOffsetX = getIntegerDict(dict[i + 1]);
|
||||
BadgeOffsetX = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BadgeOffsetY") == 0) {
|
||||
BadgeOffsetY = getIntegerDict(dict[i + 1]);
|
||||
BadgeOffsetY = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "LayoutBannerOffset") == 0) {
|
||||
LayoutBannerOffset = getIntegerDict(dict[i + 1]);
|
||||
LayoutBannerOffset = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "LayoutButtonOffset") == 0) {
|
||||
LayoutButtonOffset = getIntegerDict(dict[i + 1]);
|
||||
LayoutButtonOffset = nsvg__getIntegerDict(dict[i + 1]);
|
||||
|
||||
} else if (strcmp(dict[i], "NonSelectedGrey") == 0) {
|
||||
NonSelectedGrey = getIntegerDict(dict[i + 1]) > 0;
|
||||
NonSelectedGrey = nsvg__getIntegerDict(dict[i + 1]) > 0;
|
||||
} else if (strcmp(dict[i], "CharWidth") == 0) {
|
||||
CharWidth = getIntegerDict(dict[i + 1]);
|
||||
CharWidth = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundDark") == 0) {
|
||||
BackgroundDark = getIntegerDict(dict[i + 1]) > 0;
|
||||
BackgroundDark = nsvg__getIntegerDict(dict[i + 1]) > 0;
|
||||
} else if (strcmp(dict[i], "BackgroundSharp") == 0) {
|
||||
BackgroundSharp = getIntegerDict(dict[i + 1]);
|
||||
BackgroundSharp = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundScale") == 0) {
|
||||
BackgroundScale = imNone;
|
||||
if (strstr(dict[i+1], "scale") != NULL) {
|
||||
@ -3777,28 +3776,28 @@ void XTheme::parseTheme(void* parser, char** dict)
|
||||
HideBadges |= HDBADGES_INLINE;
|
||||
}
|
||||
} else if (strcmp(dict[i], "BadgeScale") == 0) {
|
||||
BadgeScale = getIntegerDict(dict[i + 1]);
|
||||
BadgeScale = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "SelectionColor") == 0) {
|
||||
Color = getIntegerDict(dict[i + 1]);
|
||||
Color = nsvg__getIntegerDict(dict[i + 1]);
|
||||
if (ThemeX->Daylight) {
|
||||
SelectionColor = Color;
|
||||
}
|
||||
} else if (strcmp(dict[i], "SelectionColor_night") == 0) {
|
||||
found = true;
|
||||
if (!ThemeX->Daylight) {
|
||||
SelectionColor = getIntegerDict(dict[i + 1]);
|
||||
SelectionColor = nsvg__getIntegerDict(dict[i + 1]);
|
||||
}
|
||||
} else if (strcmp(dict[i], "VerticalLayout") == 0) {
|
||||
VerticalLayout = getIntegerDict(dict[i + 1]) > 0;
|
||||
VerticalLayout = nsvg__getIntegerDict(dict[i + 1]) > 0;
|
||||
} else if (strcmp(dict[i], "BootCampStyle") == 0) {
|
||||
BootCampStyle = getIntegerDict(dict[i + 1]) > 0;
|
||||
BootCampStyle = nsvg__getIntegerDict(dict[i + 1]) > 0;
|
||||
} else if (strcmp(dict[i], "AnimeFrames") == 0) {
|
||||
NumFrames = getIntegerDict(dict[i + 1]);
|
||||
NumFrames = nsvg__getIntegerDict(dict[i + 1]);
|
||||
if (NumFrames == 0xFFFF) {
|
||||
NumFrames = 0;
|
||||
}
|
||||
} else if (strcmp(dict[i], "FrameTime") == 0) {
|
||||
FrameTime = getIntegerDict(dict[i + 1]);
|
||||
FrameTime = nsvg__getIntegerDict(dict[i + 1]);
|
||||
} else nsvg__parseAttr(p, dict[i], dict[i + 1]);
|
||||
}
|
||||
if (!found) {
|
||||
@ -3908,7 +3907,7 @@ static void nsvg__parseFontFace(NSVGparser* p, char** dict)
|
||||
AsciiStrToFloat((const char*)Next, &Next, &font->bbox[1]);
|
||||
AsciiStrToFloat((const char*)Next, &Next, &font->bbox[2]);
|
||||
AsciiStrToFloat((const char*)Next, &Next, &font->bbox[3]);
|
||||
// DumpFloat2("font bbox=", font->bbox, 4);
|
||||
// nsvg__dumpFloat("font bbox=", font->bbox, 4);
|
||||
}
|
||||
else if (strcmp(dict[i], "unicode-range") == 0) {
|
||||
const char * a = dict[i + 1];
|
||||
@ -4150,10 +4149,10 @@ static void nsvg__startElement(void* ud, const char* el, char** dict)
|
||||
} else if (strcmp(el, "image") == 0) {
|
||||
// nsvg__pushAttr(p);
|
||||
// nsvg__parseIMAGE(p, dict);
|
||||
parseImage(p, dict);
|
||||
nsvg__parseEmbeddedPNG(p, dict);
|
||||
// nsvg__popAttr(p);
|
||||
} else if (strcmp(el, "pattern") == 0) {
|
||||
parsePattern(p, dict);
|
||||
nsvg__parsePattern(p, dict);
|
||||
p->patternFlag = 1;
|
||||
|
||||
} else if (strcmp(el, "clover:theme") == 0) {
|
||||
@ -4218,7 +4217,7 @@ static void nsvg__endElement(void* ud, const char* el)
|
||||
}
|
||||
}
|
||||
|
||||
float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UINT32 color)
|
||||
float nsvg__addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UINT32 color)
|
||||
{
|
||||
float x1 = x; //initial position
|
||||
// INTN y = 0;
|
||||
@ -4307,7 +4306,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
|
||||
// if (letter == L'C') {
|
||||
// DBG("bbox0=%f ", p->text->font->bbox[0]);
|
||||
// DBG("bbox3=%f \n", p->text->font->bbox[3]);
|
||||
// DumpFloat2("glyph xform:", shape->xform, 6);
|
||||
// nsvg__dumpFloat("glyph xform:", shape->xform, 6);
|
||||
// DBG("stroke-color=%X ", shape->stroke.paint.color);
|
||||
// DBG("stroke-width=%f\n", shape->strokeWidth);
|
||||
// }
|
||||
@ -4318,12 +4317,12 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
|
||||
shape->bounds[2] = p->text->font->bbox[2] + x/scale; //x + p->font->bbox[2] * scale;
|
||||
shape->bounds[3] = p->text->font->bbox[3] + y/scale; //y + p->font->bbox[3] * scale;
|
||||
// if (letter == L'C') {
|
||||
// DumpFloat2("glyph bounds in text", shape->bounds, 4);
|
||||
// nsvg__dumpFloat("glyph bounds in text", shape->bounds, 4);
|
||||
// }
|
||||
// if (color == NSVG_RGBA(0x80, 0xFF, 0, 255)) {
|
||||
// DBG("glyph code=%X\n", letter);
|
||||
// DumpFloat2("glyph xform", shape->xform, 6);
|
||||
// DumpFloat2("glyph bounds", shape->bounds, 4);
|
||||
// nsvg__dumpFloat("glyph xform", shape->xform, 6);
|
||||
// nsvg__dumpFloat("glyph bounds", shape->bounds, 4);
|
||||
// DBG("glyph width=%d\n", g->horizAdvX);
|
||||
// }
|
||||
|
||||
@ -4338,7 +4337,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
|
||||
return x1;
|
||||
}
|
||||
|
||||
static void addString(NSVGparser* p, char* s)
|
||||
static void nsvg__addString(NSVGparser* p, char* s)
|
||||
{
|
||||
//text support should create shape for each letter
|
||||
UINTN len = strlen(s);
|
||||
@ -4364,7 +4363,7 @@ static void addString(NSVGparser* p, char* s)
|
||||
if (!letter) {
|
||||
break;
|
||||
}
|
||||
x = addLetter(p, letter, x, y, scale, p->text->fontColor);
|
||||
x = nsvg__addLetter(p, letter, x, y, scale, p->text->fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4435,7 +4434,7 @@ static void nsvg__content(void* ud, char* s)
|
||||
}
|
||||
}
|
||||
else if (p->isText) { //text support
|
||||
addString(p, s);
|
||||
nsvg__addString(p, s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4482,7 +4481,7 @@ static char *nsvg__strndup(const char *s, size_t n)
|
||||
return result;
|
||||
}
|
||||
|
||||
void takeXformBounds(NSVGshape *shape, float *xform, float *bounds)
|
||||
void nsvg__takeXformBounds(NSVGshape *shape, float *xform, float *bounds)
|
||||
{
|
||||
float newBounds[8]; //(x1, y1), (x2, y2), (x2, y1), (x1, y2)
|
||||
nsvg__xformPoint(&newBounds[0], &newBounds[1], shape->bounds[0], shape->bounds[1], xform);
|
||||
@ -4511,7 +4510,7 @@ void takeXformBounds(NSVGshape *shape, float *xform, float *bounds)
|
||||
bounds[3] = nsvg__maxf(bounds[3], newBounds[7]);
|
||||
}
|
||||
|
||||
bool isShapeInGroup(NSVGshape* shape, const char* groupName)
|
||||
bool nsvg__isShapeInGroup(NSVGshape* shape, const char* groupName)
|
||||
{
|
||||
NSVGgroup* group = shape->group;
|
||||
while (group) {
|
||||
@ -4534,7 +4533,7 @@ int nsvg__shapesBound(/*NSVGimage* image,*/ NSVGshape *shapes, float* bounds, co
|
||||
int count = 0;
|
||||
int visibility;
|
||||
for (shapeLink = shapes; shapeLink != NULL; shapeLink = shapeLink->next) {
|
||||
if ( groupName && !isShapeInGroup(shapeLink, groupName) ) {
|
||||
if ( groupName && !nsvg__isShapeInGroup(shapeLink, groupName) ) {
|
||||
continue;
|
||||
}
|
||||
memcpy(&xform[0], shapeLink->xform, sizeof(float)*6);
|
||||
@ -4545,19 +4544,19 @@ int nsvg__shapesBound(/*NSVGimage* image,*/ NSVGshape *shapes, float* bounds, co
|
||||
}
|
||||
shape = shapeLink->link; //this is <use>
|
||||
if (!shape) {
|
||||
takeXformBounds(shapeLink, &xform[0], bounds);
|
||||
nsvg__takeXformBounds(shapeLink, &xform[0], bounds);
|
||||
}
|
||||
while (shape) { //take bounds from symbol's shapes
|
||||
memcpy(xform2, xform, sizeof(float)*6);
|
||||
nsvg__xformPremultiply(&xform2[0], shape->xform);
|
||||
takeXformBounds(shape, &xform2[0], bounds);
|
||||
nsvg__takeXformBounds(shape, &xform2[0], bounds);
|
||||
shape = shape->next;
|
||||
}
|
||||
/*
|
||||
if (shapeLink->isText) { //strstr(shapeLink->id, "shar")) {
|
||||
DBG("take Bounds: shapeID=%s\n", shapeLink->id);
|
||||
DumpFloat2(" transform", xform, 6);
|
||||
DumpFloat2(" shape initial bounds", shapeLink->bounds, 4);
|
||||
nsvg__dumpFloat(" transform", xform, 6);
|
||||
nsvg__dumpFloat(" shape initial bounds", shapeLink->bounds, 4);
|
||||
}
|
||||
*/
|
||||
count++; //count visible
|
||||
@ -4595,7 +4594,7 @@ void nsvg__imageBounds(NSVGimage* image, float* bounds)
|
||||
}
|
||||
}
|
||||
|
||||
NSVGclipPath* getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx)
|
||||
NSVGclipPath* nsvg__getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx)
|
||||
{
|
||||
NSVGclipPath* clipPath = image->clipPaths;
|
||||
for (NSVGclipPathIndex i = 0; i < idx; i++) clipPath = clipPath->next;
|
||||
@ -4617,12 +4616,12 @@ void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName)
|
||||
|
||||
NSVGshape *shape;
|
||||
for (shape = image->shapes; shape != NULL; shape = shape->next) {
|
||||
if ( groupName && !isShapeInGroup(shape, groupName) ) {
|
||||
if ( groupName && !nsvg__isShapeInGroup(shape, groupName) ) {
|
||||
continue;
|
||||
}
|
||||
// DBG("nsvg__imageBounds2 found shapes=%s shape->clip.count=%d\n", shape->id, shape->clip.count);
|
||||
for (int i = 0; i < shape->clip.count; i++) {
|
||||
NSVGclipPath* clipPath = getClipPathWithIndex(image, shape->clip.index[i]);
|
||||
NSVGclipPath* clipPath = nsvg__getClipPathWithIndex(image, shape->clip.index[i]);
|
||||
if ( clipPath ) {
|
||||
// DBG("nsvg__imageBounds found clipPath %s\n", clipPath->id);
|
||||
count += nsvg__shapesBound(clipPath->shapes, bounds, NULL);
|
||||
@ -4637,7 +4636,7 @@ void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName)
|
||||
}
|
||||
|
||||
// units like "px" is not used so just exclude it
|
||||
NSVGparser* nsvgParse(char* input, /* const char* units,*/ float dpi, float opacity)
|
||||
NSVGparser* nsvg__parse(char* input, /* const char* units,*/ float dpi, float opacity)
|
||||
{
|
||||
NSVGparser* p;
|
||||
NSVGclipPath* clipPath;
|
||||
@ -4672,7 +4671,7 @@ NSVGparser* nsvgParse(char* input, /* const char* units,*/ float dpi, float opac
|
||||
#if 1
|
||||
memcpy(p->image->realBounds, bounds, 4*sizeof(float));
|
||||
|
||||
// DumpFloat2("image real bounds", bounds, 4);
|
||||
// nsvg__dumpFloat("image real bounds", bounds, 4);
|
||||
p->image->width = bounds[2] - bounds[0];
|
||||
p->image->height = bounds[3] - bounds[1];
|
||||
#endif
|
||||
@ -4710,7 +4709,7 @@ void nsvg__deleteClipPaths(NSVGclipPath* path)
|
||||
}
|
||||
}
|
||||
|
||||
void nsvgDelete(NSVGimage* image)
|
||||
void nsvg__deleteImage(NSVGimage* image)
|
||||
{
|
||||
NSVGgroup *group, *gnext;
|
||||
if (image == NULL) return;
|
||||
|
@ -444,11 +444,6 @@ typedef struct NSVGparser
|
||||
NSVGclipPathIndex clipPathStack[NSVG_MAX_CLIP_PATHS];
|
||||
} NSVGparser;
|
||||
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
extern XArray<uintptr_t> allocatedPtr;
|
||||
extern XObjArray<XString8> allocatedPtrMsg;
|
||||
|
||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE
|
||||
extern int nvsg__memoryallocation_verbose;
|
||||
void* nsvg__alloc(UINTN size, const XString8& msg);
|
||||
@ -468,8 +463,10 @@ void nsvg__outputDanglingPtr();
|
||||
#define nsvg__delete(buffer, msg) FreePool(buffer)
|
||||
#endif
|
||||
|
||||
bool isShapeInGroup(NSVGshape* shape, const char* groupName);
|
||||
NSVGclipPath* getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx);
|
||||
void nsvg__dumpFloat(CONST char* s, float* t, int N);
|
||||
|
||||
bool nsvg__isShapeInGroup(NSVGshape* shape, const char* groupName);
|
||||
NSVGclipPath* nsvg__getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx);
|
||||
//---
|
||||
|
||||
// Duplicates a path.
|
||||
@ -480,11 +477,11 @@ NSVGclipPath* getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx);
|
||||
|
||||
// Parses SVG file from a null terminated string, returns SVG image as paths.
|
||||
// Important note: changes the string.
|
||||
NSVGparser* nsvgParse(char* input, /* const char* units,*/ float dpi, float opacity);
|
||||
NSVGparser* nsvg__parse(char* input, /* const char* units,*/ float dpi, float opacity);
|
||||
NSVGparser* nsvg__createParser();
|
||||
|
||||
// Deletes list of paths.
|
||||
void nsvgDelete(NSVGimage* image);
|
||||
void nsvg__deleteImage(NSVGimage* image);
|
||||
void nsvg__xformIdentity(float* t);
|
||||
void nsvg__deleteParser(NSVGparser* p);
|
||||
void nsvg__xformInverse(float* inv, float* t);
|
||||
@ -495,7 +492,7 @@ void nsvg__deleteFont(NSVGfont* font);
|
||||
void nsvg__deleteFontChain(NSVGfontChain *fontChain);
|
||||
void nsvg__imageBounds(NSVGimage* image, float* bounds);
|
||||
void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName);
|
||||
float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UINT32 color);
|
||||
float nsvg__addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UINT32 color);
|
||||
void RenderSVGfont(NSVGfont *fontSVG, UINT32 color);
|
||||
|
||||
//--------------- Rasterizer --------------
|
||||
@ -504,7 +501,7 @@ typedef void (*recursive_image)(const void *obj, NSVGrasterizer *r, const char *
|
||||
|
||||
|
||||
// Allocated rasterizer context.
|
||||
NSVGrasterizer* nsvgCreateRasterizer(void);
|
||||
NSVGrasterizer* nsvg__createRasterizer(void);
|
||||
|
||||
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
|
||||
// r - pointer to rasterizer context
|
||||
@ -523,7 +520,7 @@ void nsvgRasterize(NSVGrasterizer* r,
|
||||
UINT8* dst, int w, int h, int stride);
|
||||
|
||||
// Deletes rasterizer context.
|
||||
void nsvgDeleteRasterizer(NSVGrasterizer*);
|
||||
void nsvg__deleteRasterizer(NSVGrasterizer*);
|
||||
|
||||
|
||||
#define NSVG__SUBSAMPLES 5
|
||||
|
@ -71,20 +71,6 @@
|
||||
static void renderShape(NSVGrasterizer* r,
|
||||
NSVGshape* shape, float *xform, float min_scale);
|
||||
|
||||
void DumpFloat (char* s, float* t, int N)
|
||||
{
|
||||
#if DEBUG_SVG
|
||||
int i;
|
||||
DBG("%s: ", s);
|
||||
for(i=0; i<N;i++) {
|
||||
float a = t[i];
|
||||
int b = (int)a;
|
||||
int sign = (a < 0.f);
|
||||
DBG("%c%d.%06d ", ((b == 0) && sign)?'-':' ', b, (int)(fabsf((a-(float)b)*1.0e6f)));
|
||||
}
|
||||
DBG("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsvg_qsort(NSVGedge* Array, int Low, int High)
|
||||
{
|
||||
@ -121,7 +107,7 @@ void nsvg_qsort(void* Array, int Num, INTN Size,
|
||||
}
|
||||
|
||||
//caller is responsible for free memory
|
||||
NSVGrasterizer* nsvgCreateRasterizer()
|
||||
NSVGrasterizer* nsvg__createRasterizer()
|
||||
{
|
||||
NSVGrasterizer* r = (NSVGrasterizer*)AllocateZeroPool(sizeof(NSVGrasterizer));
|
||||
if (r == NULL) return NULL;
|
||||
@ -131,7 +117,7 @@ NSVGrasterizer* nsvgCreateRasterizer()
|
||||
return r;
|
||||
}
|
||||
|
||||
void nsvgDeleteRasterizer(NSVGrasterizer* r)
|
||||
void nsvg__deleteRasterizer(NSVGrasterizer* r)
|
||||
{
|
||||
NSVGmemPage* p;
|
||||
|
||||
@ -455,7 +441,7 @@ static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float* xform
|
||||
NSVGpath* path;
|
||||
NSVGpoint pt;
|
||||
|
||||
// DumpFloat("flattenShape with", xform, 6);
|
||||
// nsvg__dumpFloat("flattenShape with", xform, 6);
|
||||
for (path = shape->paths; path != NULL; path = path->next) {
|
||||
r->npoints = 0;
|
||||
// Flatten path
|
||||
@ -865,7 +851,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float*
|
||||
} else { */
|
||||
lineWidth = shape->strokeWidth * scale;
|
||||
// }
|
||||
//DumpFloat("shapeStroke", xform, 6);
|
||||
//nsvg__dumpFloat("shapeStroke", xform, 6);
|
||||
for (path = shape->paths; path != NULL; path = path->next) {
|
||||
// Flatten path
|
||||
r->npoints = 0;
|
||||
@ -1178,7 +1164,7 @@ static void nsvg__scanlineSolid(UINT8* row, int count, UINT8* cover, int x, int
|
||||
float fx, fy, gy;
|
||||
float* t = cache->xform;
|
||||
|
||||
// DumpFloat("cache grad xform", t, 6);
|
||||
// nsvg__dumpFloat("cache grad xform", t, 6);
|
||||
int cr, cg, cb, ca;
|
||||
unsigned int c;
|
||||
//x,y - pixels
|
||||
@ -1223,7 +1209,7 @@ static void nsvg__scanlineSolid(UINT8* row, int count, UINT8* cover, int x, int
|
||||
// TODO: focus (fx,fy)
|
||||
float fx, fy, gx, gy, gd;
|
||||
float* t = cache->xform;
|
||||
// DumpFloat("cache grad xform", t, 6);
|
||||
// nsvg__dumpFloat("cache grad xform", t, 6);
|
||||
int cr, cg, cb, ca;
|
||||
unsigned int c;
|
||||
fx = (float)x;
|
||||
@ -1329,7 +1315,7 @@ static void nsvg__scanlineSolid(UINT8* row, int count, UINT8* cover, int x, int
|
||||
// TODO: focus (fx,fy)
|
||||
float fx, fy, gx, gy, gd;
|
||||
float* t = cache->xform;
|
||||
// DumpFloat("cache grad xform", t, 6);
|
||||
// nsvg__dumpFloat("cache grad xform", t, 6);
|
||||
int cr, cg, cb, ca;
|
||||
unsigned int c;
|
||||
|
||||
@ -1380,7 +1366,7 @@ static void nsvg__scanlineSolid(UINT8* row, int count, UINT8* cover, int x, int
|
||||
}
|
||||
}
|
||||
|
||||
UINT8* FindStencil(NSVGrasterizer *r, int index)
|
||||
UINT8* nsvg__findStencil(NSVGrasterizer *r, int index)
|
||||
{
|
||||
NSVGstencil* sl = r->stencilList;
|
||||
while (sl != NULL) {
|
||||
@ -1680,7 +1666,7 @@ static void nsvg__rasterizeShapes(NSVGrasterizer* r,
|
||||
for (shape = shapes; shape != NULL; shape = shape->next) {
|
||||
if (!(shape->flags & NSVG_VIS_VISIBLE))
|
||||
continue;
|
||||
if ( groupName && !isShapeInGroup(shape, groupName) ) {
|
||||
if ( groupName && !nsvg__isShapeInGroup(shape, groupName) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1827,7 +1813,7 @@ void nsvgRasterize(NSVGrasterizer* r,
|
||||
tx -= bounds[0] * scalex;
|
||||
ty -= bounds[1] * scaley;
|
||||
// DBG(" image %s will be scaled by [%f]\n", image->id, scalex);
|
||||
// DumpFloat(" image real bounds ", image->realBounds, 4);
|
||||
// nsvg__dumpFloat(" image real bounds ", image->realBounds, 4);
|
||||
|
||||
nsvg__rasterizeClipPaths(r, image, w, h, tx, ty, scalex, scaley);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user