Skip to content

Commit 2812dda

Browse files
committed
Logo bottom padding fixed.
1 parent bc29c6e commit 2812dda

File tree

4 files changed

+42
-29
lines changed

4 files changed

+42
-29
lines changed

src/chart/main/chart.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,18 @@ void Chart::draw(Gfx::ICanvas &canvas) const
125125
layout.boundary.size.minSize(),
126126
Styles::Sheet::baseFontSize(layout.boundary.size, false));
127127

128-
auto logoPad = logoStyle.toMargin(Geom::Size(logoWidth, logoWidth),
128+
auto logoHeight = Draw::Logo::height(logoWidth);
129+
130+
auto logoPad = logoStyle.toMargin(Geom::Size(logoWidth, logoHeight),
129131
Styles::Sheet::baseFontSize(layout.boundary.size, false));
130132

131133
auto filter = *logoStyle.filter;
132-
134+
133135
Draw::Logo(canvas).draw(
134136
layout.boundary.topRight()
135-
- Geom::Point(logoPad.right + logoWidth, logoPad.bottom),
137+
- Geom::Point(
138+
logoPad.right + logoWidth,
139+
logoPad.bottom + logoHeight),
136140
logoWidth, filter);
137141
}
138142
}

src/chart/main/style.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ Chart Chart::def()
388388
},
389389
.logo = {
390390
{
391-
.paddingTop = Gfx::Length::Relative(0.375),
392-
.paddingRight = Gfx::Length::Relative(0.375),
393-
.paddingBottom = Gfx::Length::Relative(0.375),
394-
.paddingLeft = Gfx::Length::Relative(0.375)
391+
.paddingTop = Gfx::Length::Relative(0.475),
392+
.paddingRight = Gfx::Length::Relative(0.4),
393+
.paddingBottom = Gfx::Length::Relative(0.475),
394+
.paddingLeft = Gfx::Length::Relative(0.4)
395395
},
396-
.width = Gfx::Length::Emphemeral(40/12.13526042),
396+
.width = Gfx::Length::Emphemeral(40.0*2900/3000/12.13526042),
397397
.filter = Gfx::ColorTransform::OverrideColor(Gfx::Color::Gray(0.85))
398398
}
399399
};

src/chart/rendering/logo.cpp

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,43 @@ Logo::circleColors{{
1919
//todo: create Gfx::Path, Gfx::Drawing classes
2020
const Logo::Points Logo::points
2121
{{
22-
{56, 0}, {370, 760}, {684, 0}, {532, 0}, {370, 425}, {208, 0}, // V
23-
{784, 0}, {784, 752}, {924, 752}, {924, 0}, // I
24-
{1188, 752}, {1620, 0}, {1464, 0}, {1034, 752}, // Z
25-
{1862, 752}, {2294, 0}, {2138, 0}, {1708, 752}, // Z
22+
{0, 0}, {314, 760}, {628, 0}, {476, 0}, {314, 425}, {152, 0}, // V
23+
{728, 0}, {728, 752}, {868, 752}, {868, 0}, // I
24+
{1132, 752}, {1564, 0}, {1408, 0}, {978, 752}, // Z
25+
{1806, 752}, {2238, 0}, {2082, 0}, {1652, 752}, // Z
2626

2727
// U
28-
{2530, 0},
29-
{2390, 0},
30-
{2390, 480},
31-
{2390, 650}, {2522, 766}, {2673, 766},
32-
{2824, 766}, {2956, 650}, {2956, 480},
33-
{2956, 0},
34-
{2816, 0},
35-
{2816, 480},
36-
{2820, 578}, {2762, 634}, {2673, 634},
37-
{2584, 634}, {2530, 578}, {2530, 480},
28+
{2474, 0},
29+
{2334, 0},
30+
{2334, 480},
31+
{2334, 650}, {2466, 766}, {2617, 766},
32+
{2768, 766}, {2900, 650}, {2900, 480},
33+
{2900, 0},
34+
{2760, 0},
35+
{2760, 480},
36+
{2764, 578}, {2706, 634}, {2617, 634},
37+
{2528, 634}, {2474, 578}, {2474, 480},
3838

3939
// circles
40-
{1146, 99},
41-
{1820, 99},
42-
{1522, 652},
43-
{2196, 652}
40+
{1090, 99},
41+
{1764, 99},
42+
{1466, 652},
43+
{2140, 652}
4444
}};
4545

46+
47+
double Logo::height(double width)
48+
{
49+
return defaultHeight * width / defaultWidth;
50+
}
51+
4652
void Logo::draw(Geom::Point pos,
4753
double width,
4854
const Gfx::ColorTransform &colorTransform)
4955
{
5056
this->index = 0;
5157
this->pos = pos;
52-
this->factor = width / defaultSize;
58+
this->factor = width / defaultWidth;
5359

5460
setColor(colorTransform(Gfx::Color::Black()));
5561
canvas.setLineWidth(0);

src/chart/rendering/logo.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ class Logo
1818
Logo(Gfx::ICanvas &canvas) : canvas(canvas) {}
1919
void draw(Geom::Point pos, double width,
2020
const Gfx::ColorTransform &colorTransform);
21-
21+
22+
static double height(double width);
23+
2224
private:
2325
struct Point { uint16_t x; uint16_t y; };
2426
typedef std::array<Point, 6 + 4 + 4 + 4 + (10 + 4*2) + 4> Points;
2527

2628
static const Points points;
27-
static const size_t defaultSize = 3000;
29+
static const size_t defaultWidth = 2900;
30+
static const size_t defaultHeight = 766;
2831
static const size_t defaultRadius;
2932
static const std::array<Gfx::Color, 4> circleColors;
3033

0 commit comments

Comments
 (0)