mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
debugging SVG
Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
parent
5333dff2c1
commit
1404ba662b
@ -652,14 +652,14 @@
|
|||||||
<key>Tool</key>
|
<key>Tool</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
<key>ScreenResolution?</key>
|
<key>ScreenResolution</key>
|
||||||
<string>1280x1024</string>
|
<string>1600x900</string>
|
||||||
<key>ShowOptimus?</key>
|
<key>ShowOptimus?</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>TextOnly</key>
|
<key>TextOnly</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>Theme</key>
|
<key>Theme</key>
|
||||||
<string>Clovy</string>
|
<string>cesium</string>
|
||||||
<key>Timezone</key>
|
<key>Timezone</key>
|
||||||
<integer>3</integer>
|
<integer>3</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 409 KiB After Width: | Height: | Size: 402 KiB |
18
Qemu/launch
18
Qemu/launch
@ -29,11 +29,11 @@ then
|
|||||||
echo "You must restore the folder \'"$(dirname "$qemu_path")"\'"
|
echo "You must restore the folder \'"$(dirname "$qemu_path")"\'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! [ -f "$SCRIPT_DIR"/disk_image_gpt.img ]
|
# if ! [ -f "$SCRIPT_DIR"/disk_image_gpt.img ]
|
||||||
then
|
# then
|
||||||
unzip -o "$SCRIPT_DIR"/disk_image_gpt.img.zip -d "$SCRIPT_DIR"
|
# unzip -o "$SCRIPT_DIR"/disk_image_gpt.img.zip -d "$SCRIPT_DIR"
|
||||||
rm -rf "$SCRIPT_DIR"/__MACOSX
|
# rm -rf "$SCRIPT_DIR"/__MACOSX
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if pgrep qemu
|
if pgrep qemu
|
||||||
then
|
then
|
||||||
@ -44,7 +44,7 @@ then
|
|||||||
if ! [ -z "$clover_efi_file" ]
|
if ! [ -z "$clover_efi_file" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
hdiutil attach "$SCRIPT_DIR"/disk_image_gpt.img || exit 1
|
hdiutil attach "$SCRIPT_DIR"/QEMU-test2.img || exit 1
|
||||||
|
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ diskutil eject disk5
|
|||||||
-bios "$bios_file" \
|
-bios "$bios_file" \
|
||||||
-machine q35 \
|
-machine q35 \
|
||||||
-device ahci,id=ahi \
|
-device ahci,id=ahi \
|
||||||
-drive format=raw,id=hda,file=./disk_image_gpt.img \
|
-drive format=raw,id=hda,file=./QEMU-test2.img \
|
||||||
-usb \
|
-usb \
|
||||||
-device usb-mouse,bus=usb-bus.0,port=2 \
|
-device usb-mouse,bus=usb-bus.0,port=2 \
|
||||||
-device usb-kbd,bus=usb-bus.0,port=1 \
|
-device usb-kbd,bus=usb-bus.0,port=1 \
|
||||||
@ -93,8 +93,8 @@ diskutil eject disk5
|
|||||||
# -hdb "/JiefLand/Mac OS X 11.0.Beta10.vmwarevm/Virtual Disk.vmdk" \
|
# -hdb "/JiefLand/Mac OS X 11.0.Beta10.vmwarevm/Virtual Disk.vmdk" \
|
||||||
# -hdc /JiefLand/5.Devel/Clover/CloverEfi.vmw/ElCapitan.vmdk \
|
# -hdc /JiefLand/5.Devel/Clover/CloverEfi.vmw/ElCapitan.vmdk \
|
||||||
|
|
||||||
hdiutil attach ./disk_image_gpt.img
|
hdiutil attach ./QEMU-test2.img
|
||||||
diskutil mount disk5s1
|
diskutil mount QEMU_EFI
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
#cp -v /Users/sergey/src/edk2/Clover/CloverPackage/CloverV2/EFI/CLOVER/drivers64UEFI/VBoxHfs-64.efi /Volumes/TEFI/EFI/CLOVER/drivers64UEFI
|
#cp -v /Users/sergey/src/edk2/Clover/CloverPackage/CloverV2/EFI/CLOVER/drivers64UEFI/VBoxHfs-64.efi /Volumes/TEFI/EFI/CLOVER/drivers64UEFI
|
||||||
#sudo umount /Volumes/QEFI
|
#sudo umount /Volumes/QEFI
|
||||||
diskutil umount /dev/disk2s1
|
diskutil umount /dev/disk6s1
|
||||||
diskutil umount /dev/disk2s2
|
diskutil umount /dev/disk6s2
|
||||||
diskutil eject disk2
|
diskutil eject disk6
|
||||||
#qemu -L ~/Desktop/QEMU-Clover/QEMU -m 2048 -cpu core2duo -bios OVMF.fd -machine q35 -usb -device usb-mouse,bus=usb-bus.0,port=2 -device usb-kbd,bus=usb-bus.0,port=1 -device ahci,id=ahc -device ide-drive,bus=ahc.0,drive=hdc -drive id=hdc,file=/Users/sergey/Desktop/QEMU-Clover/QEMU-test2.img -device ide-drive,bus=ahc.1,drive=hdb -drive id=hdb,if=none,file=/Users/sergey/Desktop/QEMU-Clover/freedos.img -net nic,macaddr=00:12:32:43:55:16 -net user,name=lan -serial stdio
|
#qemu -L ~/Desktop/QEMU-Clover/QEMU -m 2048 -cpu core2duo -bios OVMF.fd -machine q35 -usb -device usb-mouse,bus=usb-bus.0,port=2 -device usb-kbd,bus=usb-bus.0,port=1 -device ahci,id=ahc -device ide-drive,bus=ahc.0,drive=hdc -drive id=hdc,file=/Users/sergey/Desktop/QEMU-Clover/QEMU-test2.img -device ide-drive,bus=ahc.1,drive=hdb -drive id=hdb,if=none,file=/Users/sergey/Desktop/QEMU-Clover/freedos.img -net nic,macaddr=00:12:32:43:55:16 -net user,name=lan -serial stdio
|
||||||
|
|
||||||
#qemu -L ~/Desktop/QEMU-Clover/QEMU -m 2048 -vga std -cpu core2duo -bios OVMF.fd -machine q35 -usb -device usb-mouse,bus=usb-bus.0,port=2 -device usb-kbd,bus=usb-bus.0,port=1 -hda /Users/sergey/Desktop/QEMU-Clover/QEMU-test2.img -hdc /Users/sergey/Desktop/QEMU-Clover/freedos.img -net nic,macaddr=00:12:32:43:55:16 -net user,name=lan
|
#qemu -L ~/Desktop/QEMU-Clover/QEMU -m 2048 -vga std -cpu core2duo -bios OVMF.fd -machine q35 -usb -device usb-mouse,bus=usb-bus.0,port=2 -device usb-kbd,bus=usb-bus.0,port=1 -hda /Users/sergey/Desktop/QEMU-Clover/QEMU-test2.img -hdc /Users/sergey/Desktop/QEMU-Clover/freedos.img -net nic,macaddr=00:12:32:43:55:16 -net user,name=lan
|
||||||
|
@ -1020,8 +1020,8 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case SCAN_F8:
|
case SCAN_F8:
|
||||||
// testSVG();
|
testSVG();
|
||||||
testBMP();
|
// testBMP();
|
||||||
testEfires();
|
testEfires();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ EFI_STATUS XTheme::ParseSVGXIcon(NSVGparser* SVGParser, INTN Id, const XString8&
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
float bounds[4];
|
float bounds[4] = {0,0,0,0};
|
||||||
nsvg__imageBounds(SVGimage, bounds, IconNameX.c_str());
|
nsvg__imageBounds(SVGimage, bounds, IconNameX);
|
||||||
|
|
||||||
if ((Id == BUILTIN_ICON_BANNER) && IconNameX.contains("Banner")) {
|
if ((Id == BUILTIN_ICON_BANNER) && IconNameX.contains("Banner")) {
|
||||||
BannerPosX = (int)(bounds[0] * Scale - CentreShift);
|
BannerPosX = (int)(bounds[0] * Scale - CentreShift);
|
||||||
@ -128,13 +128,20 @@ EFI_STATUS XTheme::ParseSVGXIcon(NSVGparser* SVGParser, INTN Id, const XString8&
|
|||||||
!IconNameX.contains("Banner")) {
|
!IconNameX.contains("Banner")) {
|
||||||
float realWidth = (bounds[2] - bounds[0]) * Scale;
|
float realWidth = (bounds[2] - bounds[0]) * Scale;
|
||||||
float realHeight = (bounds[3] - bounds[1]) * Scale;
|
float realHeight = (bounds[3] - bounds[1]) * Scale;
|
||||||
// DBG("icon=%s width=%f realwidth=%f\n", IconNameX.c_str(), Width, realWidth);
|
// DBG("icon=%s width=%f realwidth=%f\n", IconNameX.c_str(), Width, realWidth);
|
||||||
tx = (Width - realWidth) * 0.5f;
|
tx = (Width - realWidth) * 0.5f;
|
||||||
ty = (Height - realHeight) * 0.5f;
|
ty = (Height - realHeight) * 0.5f;
|
||||||
}
|
}
|
||||||
|
float ScaleY = Scale;
|
||||||
|
if (IconNameX.contains("sequoia") || IconNameX.contains("vent")) {
|
||||||
|
DBG("[0]=%f [1]=%f [2]=%f [3]=%f\n", bounds[0], bounds[1], bounds[2], bounds[3]);
|
||||||
|
//[0]=1330.129883 [1]=740.651855 [2]=1458.281494 [3]=886.530396
|
||||||
|
// ScaleY = -Scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NSVGrasterizer* rast = nsvg__createRasterizer();
|
NSVGrasterizer* rast = nsvg__createRasterizer();
|
||||||
nsvgRasterize(rast, SVGimage, bounds, IconNameX.c_str(), tx, ty, Scale, Scale, (UINT8*)NewImage.GetPixelPtr(0,0), iWidth, iHeight, iWidth*4);
|
nsvgRasterize(rast, SVGimage, bounds, IconNameX.c_str(), tx, ty, Scale, ScaleY, (UINT8*)NewImage.GetPixelPtr(0,0), iWidth, iHeight, iWidth*4);
|
||||||
nsvg__deleteRasterizer(rast);
|
nsvg__deleteRasterizer(rast);
|
||||||
*Image = NewImage; //copy array
|
*Image = NewImage; //copy array
|
||||||
|
|
||||||
@ -518,7 +525,7 @@ void testSVG()
|
|||||||
float tx = 0; //-SVGimage->realBounds[0] * Scale;
|
float tx = 0; //-SVGimage->realBounds[0] * Scale;
|
||||||
float ty = 0; //-SVGimage->realBounds[1] * Scale;
|
float ty = 0; //-SVGimage->realBounds[1] * Scale;
|
||||||
DBG("timing rasterize start tx=%f ty=%f\n", tx, ty); //the aim is measure duration
|
DBG("timing rasterize start tx=%f ty=%f\n", tx, ty); //the aim is measure duration
|
||||||
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage.GetPixelPtr(0,0), (int)Width, (int)Height, (int)Width*4);
|
nsvgRasterize(rast, SVGimage, tx,ty,Scale, -Scale, (UINT8*)NewImage.GetPixelPtr(0,0), (int)Width, (int)Height, (int)Width*4);
|
||||||
DBG("timing rasterize end\n");
|
DBG("timing rasterize end\n");
|
||||||
NewImage.Draw((UGAWidth - Width) / 2,
|
NewImage.Draw((UGAWidth - Width) / 2,
|
||||||
(UGAHeight - Height) / 2);
|
(UGAHeight - Height) / 2);
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include "../include/OneLinerMacros.h"
|
#include "../include/OneLinerMacros.h"
|
||||||
|
|
||||||
#ifndef DEBUG_ALL
|
#ifndef DEBUG_ALL
|
||||||
#define DEBUG_SVG 1
|
#define DEBUG_SVG 0
|
||||||
#else
|
#else
|
||||||
#define DEBUG_SVG DEBUG_ALL
|
#define DEBUG_SVG DEBUG_ALL
|
||||||
#endif
|
#endif
|
||||||
@ -952,7 +952,7 @@ static NSVGgradientLink* nsvg__createGradientLink(const char* id)
|
|||||||
return grad;
|
return grad;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape); //, float* xform);
|
static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape, bool dump); //, float* xform);
|
||||||
|
|
||||||
static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGgradientLink* link, char* paintType)
|
static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGgradientLink* link, char* paintType)
|
||||||
{
|
{
|
||||||
@ -996,7 +996,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGg
|
|||||||
// The shape width and height.
|
// The shape width and height.
|
||||||
if (data->units == NSVG_OBJECT_SPACE) {
|
if (data->units == NSVG_OBJECT_SPACE) {
|
||||||
float localBounds[4];
|
float localBounds[4];
|
||||||
nsvg__getLocalBounds(localBounds, shape); //, inv); //before any transform
|
nsvg__getLocalBounds(localBounds, shape, false); //, inv); //before any transform
|
||||||
|
|
||||||
ox = localBounds[0];
|
ox = localBounds[0];
|
||||||
oy = localBounds[1];
|
oy = localBounds[1];
|
||||||
@ -1063,7 +1063,7 @@ static float nsvg__getAverageScale(float* t)
|
|||||||
return (nsvg__vmag(t[0], t[2]) + nsvg__vmag(t[1], t[3])) * 0.5f;
|
return (nsvg__vmag(t[0], t[2]) + nsvg__vmag(t[1], t[3])) * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape) //, float* atXform)
|
static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape, bool dump) //, float* atXform)
|
||||||
{
|
{
|
||||||
NSVGpath* path;
|
NSVGpath* path;
|
||||||
float curve[8];
|
float curve[8];
|
||||||
@ -1093,6 +1093,9 @@ static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape) //, float* atX
|
|||||||
curve[0] = curve[6];
|
curve[0] = curve[6];
|
||||||
curve[1] = curve[7];
|
curve[1] = curve[7];
|
||||||
}
|
}
|
||||||
|
// if (dump) {
|
||||||
|
// nsvg__dumpFloat(" local bounds ", bounds, 4);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1133,8 +1136,8 @@ static void nsvg__addShape(NSVGparser* p)
|
|||||||
for (int i=0; i<shape->clip.count; i++) {
|
for (int i=0; i<shape->clip.count; i++) {
|
||||||
shape->clip.index[i] = p->clipPathStack[i];
|
shape->clip.index[i] = p->clipPathStack[i];
|
||||||
}
|
}
|
||||||
|
bool dump = (strstr(shape->id, "path8seq") != NULL);
|
||||||
nsvg__getLocalBounds(shape->bounds, shape); //(dest, src)
|
nsvg__getLocalBounds(shape->bounds, shape, dump); //(dest, src)
|
||||||
|
|
||||||
// Set fill
|
// Set fill
|
||||||
shape->fill.type = NSVG_PAINT_NONE;
|
shape->fill.type = NSVG_PAINT_NONE;
|
||||||
@ -4396,15 +4399,19 @@ int nsvg__shapesBound(/*NSVGimage* image,*/ NSVGshape *shapes, float* bounds, co
|
|||||||
nsvg__takeXformBounds(shape, &xform2[0], bounds);
|
nsvg__takeXformBounds(shape, &xform2[0], bounds);
|
||||||
shape = shape->next;
|
shape = shape->next;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (shapeLink->isText) { //strstr(shapeLink->id, "shar")) {
|
// if ((strstr(shapeLink->id, "seq") != NULL) || (strstr(shapeLink->id, "son") != NULL) ) {
|
||||||
DBG("take Bounds: shapeID=%s\n", shapeLink->id);
|
// DBG("take Bounds: shapeID=%s\n", shapeLink->id);
|
||||||
nsvg__dumpFloat(" transform", xform, 6);
|
// nsvg__dumpFloat(" transform", xform, 6);
|
||||||
nsvg__dumpFloat(" shape initial bounds", shapeLink->bounds, 4);
|
// nsvg__dumpFloat(" shape initial bounds", &shapeLink->bounds[0], 4);
|
||||||
}
|
// }
|
||||||
*/
|
|
||||||
count++; //count visible
|
count++; //count visible
|
||||||
}
|
}
|
||||||
|
// if ((strstr(groupName, "seq") != NULL) || (strstr(groupName, "ven") != NULL)) {
|
||||||
|
// DBG("group Bounds: ID=%s\n", groupName);
|
||||||
|
// nsvg__dumpFloat(" group bounds", &bounds[0], 4);
|
||||||
|
// }
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4446,11 +4453,16 @@ NSVGclipPath* nsvg__getClipPathWithIndex(NSVGimage* image, NSVGclipPathIndex idx
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName)
|
void nsvg__imageBounds(NSVGimage* image, float* bounds, const XString8& IconNameX)
|
||||||
{
|
{
|
||||||
if (!bounds || !image) {
|
if (!bounds || !image) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// bool dump = (IconNameX.contains("sequoia") || IconNameX.contains("sonoma"));
|
||||||
|
// if (dump) {
|
||||||
|
// DBG("dump %s\n", IconNameX.c_str());
|
||||||
|
// }
|
||||||
|
const char* groupName = IconNameX.c_str();
|
||||||
bounds[0] = FLT_MAX;
|
bounds[0] = FLT_MAX;
|
||||||
bounds[1] = FLT_MAX;
|
bounds[1] = FLT_MAX;
|
||||||
bounds[2] = -FLT_MAX;
|
bounds[2] = -FLT_MAX;
|
||||||
@ -4463,16 +4475,33 @@ void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName)
|
|||||||
if ( groupName && !nsvg__isShapeInGroup(shape, groupName) ) {
|
if ( groupName && !nsvg__isShapeInGroup(shape, groupName) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// DBG("nsvg__imageBounds2 found shapes=%s shape->clip.count=%d\n", shape->id, shape->clip.count);
|
// if (dump) {
|
||||||
|
// 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++) {
|
for (int i = 0; i < shape->clip.count; i++) {
|
||||||
NSVGclipPath* clipPath = nsvg__getClipPathWithIndex(image, shape->clip.index[i]);
|
NSVGclipPath* clipPath = nsvg__getClipPathWithIndex(image, shape->clip.index[i]);
|
||||||
|
// if (dump) {
|
||||||
|
// //DBG("clip-id=%s clip index=%d\n", image->clipPaths->id, shape->clip.index[i]);
|
||||||
|
// nsvg__dumpFloat("clip shape bounds", &shape->bounds[0], 4);
|
||||||
|
// }
|
||||||
if ( clipPath ) {
|
if ( clipPath ) {
|
||||||
// DBG("nsvg__imageBounds found clipPath %s\n", clipPath->id);
|
count += nsvg__shapesBound(clipPath->shapes, bounds, NULL); // why NULL);?
|
||||||
count += nsvg__shapesBound(clipPath->shapes, bounds, NULL);
|
// if (dump) {
|
||||||
|
// DBG("nsvg__imageBounds found clipPath %s\n", clipPath->id);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
} //for clips
|
||||||
|
// if (dump) {
|
||||||
|
// nsvg__dumpFloat("clip image bounds", &shape->bounds[0], 4);
|
||||||
|
// }
|
||||||
|
} // for shapes
|
||||||
count += nsvg__shapesBound(image->shapes, bounds, groupName);
|
count += nsvg__shapesBound(image->shapes, bounds, groupName);
|
||||||
|
// if (dump) {
|
||||||
|
// nsvg__dumpFloat("final image real bounds", bounds, 4);
|
||||||
|
// }
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
bounds[0] = bounds[1] = 0.0f;
|
bounds[0] = bounds[1] = 0.0f;
|
||||||
bounds[2] = bounds[3] = 1.0f;
|
bounds[2] = bounds[3] = 1.0f;
|
||||||
@ -4519,7 +4548,7 @@ NSVGparser* nsvg__parse(char* input, /* const char* units,*/ float dpi, float op
|
|||||||
p->image->width = bounds[2] - bounds[0];
|
p->image->width = bounds[2] - bounds[0];
|
||||||
p->image->height = bounds[3] - bounds[1];
|
p->image->height = bounds[3] - bounds[1];
|
||||||
#endif
|
#endif
|
||||||
// DBG("scaled width=%f height=%f\n", p->image->width, p->image->height);
|
// DBG("scaled width=%f height=%f\n", p->image->width, p->image->height);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ void nsvg__xformMultiply(float* t, float* s);
|
|||||||
void nsvg__deleteFont(NSVGfont* font);
|
void nsvg__deleteFont(NSVGfont* font);
|
||||||
void nsvg__deleteFontChain(NSVGfontChain *fontChain);
|
void nsvg__deleteFontChain(NSVGfontChain *fontChain);
|
||||||
void nsvg__imageBounds(NSVGimage* image, float* bounds);
|
void nsvg__imageBounds(NSVGimage* image, float* bounds);
|
||||||
void nsvg__imageBounds(NSVGimage* image, float* bounds, const char* groupName);
|
void nsvg__imageBounds(NSVGimage* image, float* bounds,const XString8& name);
|
||||||
float nsvg__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);
|
void RenderSVGfont(NSVGfont *fontSVG, UINT32 color);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include "../Platform/Utils.h"
|
#include "../Platform/Utils.h"
|
||||||
|
|
||||||
#ifndef DEBUG_ALL
|
#ifndef DEBUG_ALL
|
||||||
#define DEBUG_SVG 1
|
#define DEBUG_SVG 0
|
||||||
#else
|
#else
|
||||||
#define DEBUG_SVG DEBUG_ALL
|
#define DEBUG_SVG DEBUG_ALL
|
||||||
#endif
|
#endif
|
||||||
@ -1634,9 +1634,11 @@ static void nsvg__rasterizeShapes(NSVGrasterizer* r,
|
|||||||
UINT8* dst, int w, int h, int stride,
|
UINT8* dst, int w, int h, int stride,
|
||||||
NSVGscanlineFunction fscanline)
|
NSVGscanlineFunction fscanline)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_TRACE
|
// bool dump = (strstr(groupName, "seq") != NULL) || (strstr(groupName, "ven") != NULL) ; //XXX
|
||||||
DBG("nsvg__rasterizeShapes %s %f %f %f %f\n", groupName ? groupName : "", tx, ty, scalex, scaley);
|
// if (dump) {
|
||||||
#endif
|
// DBG("nsvg__rasterizeShapes %s %f %f %f %f\n", groupName ? groupName : shapes->id, tx, ty, scalex, scaley);
|
||||||
|
// }
|
||||||
|
|
||||||
NSVGshape *shape = NULL, *shapeLink = NULL;
|
NSVGshape *shape = NULL, *shapeLink = NULL;
|
||||||
float xform[6], xform2[6];
|
float xform[6], xform2[6];
|
||||||
float min_scale = fabsf(scalex) < fabsf(scaley) ? fabsf(scalex) : fabsf(scaley);
|
float min_scale = fabsf(scalex) < fabsf(scaley) ? fabsf(scalex) : fabsf(scaley);
|
||||||
@ -1676,7 +1678,11 @@ static void nsvg__rasterizeShapes(NSVGrasterizer* r,
|
|||||||
xform[3] *= scaley;
|
xform[3] *= scaley;
|
||||||
xform[4] = xform[4] * scalex + tx;
|
xform[4] = xform[4] * scalex + tx;
|
||||||
xform[5] = xform[5] * scaley + ty;
|
xform[5] = xform[5] * scaley + ty;
|
||||||
|
// if (dump) {
|
||||||
|
// DBG("shape->id=%s\n", shape->id );
|
||||||
|
// nsvg__dumpFloat(" shape->xform ", xform, 6);
|
||||||
|
// nsvg__dumpFloat(" shape->bounds ", &shape->bounds[0], 4);
|
||||||
|
// }
|
||||||
if (!shape->link) {
|
if (!shape->link) {
|
||||||
renderShape(r, shape, &xform[0], min_scale);
|
renderShape(r, shape, &xform[0], min_scale);
|
||||||
}
|
}
|
||||||
@ -1702,19 +1708,23 @@ static void nsvg__rasterizeShapes(NSVGrasterizer* r,
|
|||||||
static void renderShape(NSVGrasterizer* r,
|
static void renderShape(NSVGrasterizer* r,
|
||||||
NSVGshape* shape, float *xform, float min_scale)
|
NSVGshape* shape, float *xform, float min_scale)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_TRACE
|
// bool dump = (strstr(shape->id, "seq") != NULL) || (strstr(shape->id, "ven") != NULL);
|
||||||
DBG("render shape %s %f %f %f %f %f %f\n", shape->id, xform[0], xform[1], xform[2], xform[3], xform[4], xform[5]);
|
// if (dump) {
|
||||||
#endif
|
// DBG("render shape %s %f %f %f %f %f %f\n", shape->id,
|
||||||
|
// xform[0], xform[1], xform[2], xform[3], xform[4], xform[5]);
|
||||||
|
// }
|
||||||
NSVGedge *e = NULL;
|
NSVGedge *e = NULL;
|
||||||
NSVGcachedPaint cache;
|
NSVGcachedPaint cache;
|
||||||
|
|
||||||
SetMem(&cache, sizeof(NSVGcachedPaint), 0);
|
SetMem(&cache, sizeof(NSVGcachedPaint), 0);
|
||||||
// NSVGclip& clip = shape->clip;
|
// if (dump) {
|
||||||
// DBG("renderShape %s with clips", shape->id);
|
// NSVGclip& clip = shape->clip;
|
||||||
// for (int i=0; i < clip.count; i++) {
|
// DBG("renderShape %s with clips", shape->id);
|
||||||
// DBG(" %d", clip.index[i]);
|
// for (int i=0; i < clip.count; i++) {
|
||||||
|
// DBG(" %d", clip.index[i]);
|
||||||
|
// }
|
||||||
|
// DBG("\n");
|
||||||
// }
|
// }
|
||||||
// DBG("\n");
|
|
||||||
|
|
||||||
if (shape->fill.type != NSVG_PAINT_NONE) {
|
if (shape->fill.type != NSVG_PAINT_NONE) {
|
||||||
nsvg__resetPool(r);
|
nsvg__resetPool(r);
|
||||||
@ -1800,7 +1810,7 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
NSVGimage* image, float tx, float ty, float scalex, float scaley,
|
NSVGimage* image, float tx, float ty, float scalex, float scaley,
|
||||||
UINT8* dst, int w, int h, int stride)
|
UINT8* dst, int w, int h, int stride)
|
||||||
{
|
{
|
||||||
nsvgRasterize(r, image, &image->realBounds[0], NULL, tx, ty, scalex, scaley, dst, w, h, stride);
|
nsvgRasterize(r, image, &image->realBounds[0], NULL, tx, ty, scalex, fabsf(scaley), dst, w, h, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsvgRasterize(NSVGrasterizer* r,
|
void nsvgRasterize(NSVGrasterizer* r,
|
||||||
@ -1810,8 +1820,14 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
{
|
{
|
||||||
tx -= bounds[0] * scalex;
|
tx -= bounds[0] * scalex;
|
||||||
ty -= bounds[1] * scaley;
|
ty -= bounds[1] * scaley;
|
||||||
// DBG(" image %s will be scaled by [%f]\n", image->id, scalex);
|
// if (scaley < 0) {
|
||||||
// nsvg__dumpFloat(" image real bounds ", image->realBounds, 4);
|
// DBG(" image %s will be scaled by [%f]\n", image->id, scalex);
|
||||||
|
// nsvg__dumpFloat(" image real bounds ", image->realBounds, 4);
|
||||||
|
// }
|
||||||
|
// if (strstr(groupName, "seq") != NULL || strstr(groupName, "ven") != NULL) {
|
||||||
|
// DBG(" image %s will be scaled by [%f]\n", groupName, scalex);
|
||||||
|
// nsvg__dumpFloat(" image real bounds ", image->realBounds, 4);
|
||||||
|
// }
|
||||||
|
|
||||||
nsvg__rasterizeClipPaths(r, image, w, h, tx, ty, scalex, scaley);
|
nsvg__rasterizeClipPaths(r, image, w, h, tx, ty, scalex, scaley);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user