Skip to content

Commit 2de1c32

Browse files
committed
Set SVG scale limit to 0.1
1 parent 4a94a3f commit 2de1c32

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

ScratchCPPGui/renderedtarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using namespace scratchcppgui;
1414
using namespace libscratchcpp;
1515

16-
static const double SVG_SCALE_LIMIT = 0.25; // the maximum viewport dimensions are multiplied by this
16+
static const double SVG_SCALE_LIMIT = 0.1; // the maximum viewport dimensions are multiplied by this
1717

1818
RenderedTarget::RenderedTarget(QNanoQuickItem *parent) :
1919
IRenderedTarget(parent)

test/renderedtarget/renderedtarget_test.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ TEST_F(RenderedTargetTest, LoadSvgCostume)
316316
context.makeCurrent(&surface);
317317
GLint dims[2];
318318
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
319-
double maxWidth = dims[0] * 0.25;
320-
double maxHeight = dims[1] * 0.25;
319+
double maxWidth = dims[0] * 0.1;
320+
double maxHeight = dims[1] * 0.1;
321321
double maxSize = std::min(maxWidth / (1143 / 90.0), maxHeight / (1143 / 90.0));
322322
context.doneCurrent();
323323

@@ -369,10 +369,10 @@ TEST_F(RenderedTargetTest, LoadSvgCostume)
369369
ASSERT_EQ(std::round(target.width() * 100) / 100, maxWidth);
370370
ASSERT_EQ(std::round(target.height() * 100) / 100, maxHeight);
371371
ASSERT_EQ(target.scale(), 1);
372-
ASSERT_EQ(std::round(target.x() * 100) / 100, 27381.35);
373-
ASSERT_EQ(std::round(target.y() * 100) / 100, -16849.39);
374-
ASSERT_EQ(std::round(target.transformOriginPoint().x() * 100) / 100, -27091.65);
375-
ASSERT_EQ(std::round(target.transformOriginPoint().y() * 100) / 100, 17093.54);
372+
ASSERT_EQ(std::round(target.x() * 100) / 100, 11126.36);
373+
ASSERT_EQ(std::round(target.y() * 100) / 100, -6593.27);
374+
ASSERT_EQ(std::round(target.transformOriginPoint().x() * 100) / 100, -10836.66);
375+
ASSERT_EQ(std::round(target.transformOriginPoint().y() * 100) / 100, 6837.42);
376376

377377
// Test scale limit
378378
sprite.setSize(maxSize * 250);
@@ -405,11 +405,11 @@ TEST_F(RenderedTargetTest, LoadSvgCostume)
405405

406406
ASSERT_EQ(std::round(target.width() * 100) / 100, maxWidth);
407407
ASSERT_EQ(std::round(target.height() * 100) / 100, maxHeight);
408-
ASSERT_EQ(target.scale(), 2.5);
409-
ASSERT_EQ(std::round(target.x() * 100) / 100, 27381.35);
410-
ASSERT_EQ(std::round(target.y() * 100) / 100, -16849.39);
411-
ASSERT_EQ(std::round(target.transformOriginPoint().x() * 100) / 100, -27091.65);
412-
ASSERT_EQ(std::round(target.transformOriginPoint().y() * 100) / 100, 17093.54);
408+
ASSERT_EQ(std::round(target.scale() * 100) / 100, 2.5);
409+
ASSERT_EQ(std::round(target.x() * 100) / 100, 11126.36);
410+
ASSERT_EQ(std::round(target.y() * 100) / 100, -6593.27);
411+
ASSERT_EQ(std::round(target.transformOriginPoint().x() * 100) / 100, -10836.66);
412+
ASSERT_EQ(std::round(target.transformOriginPoint().y() * 100) / 100, 6837.42);
413413
}
414414

415415
TEST_F(RenderedTargetTest, PaintSvg)

0 commit comments

Comments
 (0)