• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Return-To-The-Roots / s25client / 44076625557

17 Nov 2026 11:43AM UTC coverage: 51.803% (-0.002%) from 51.805%
44076625557

push

github

web-flow
Merge pull request #2018 from Return-To-The-Roots/refactor/lowerCamelCase-methods

Rename Msg_* handlers to lowerCamelCase

8121 of 16693 new or added lines in 565 files covered. (48.65%)

323 existing lines in 133 files now uncovered.

24236 of 46785 relevant lines covered (51.8%)

49647.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/libs/s25main/controls/ctrlBaseImage.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "ctrlBaseImage.h"
6
#include "ogl/ITexture.h"
7
#include "s25util/colors.h"
8

9
ctrlBaseImage::ctrlBaseImage(ITexture* img /*= nullptr*/) : img_(img), modulationColor_(COLOR_WHITE) {}
579 ✔
10

NEW
11
void ctrlBaseImage::swapImage(ctrlBaseImage& other)
×
12
{
13
    std::swap(img_, other.img_);
×
14
}
×
15

16
Rect ctrlBaseImage::getImageRect() const
2 ✔
17
{
18
    if(!img_)
2 ✔
19
        return Rect();
×
20
    return Rect(-img_->getOrigin(), img_->getSize());
2 ✔
21
}
22

23
void ctrlBaseImage::drawImage(const Rect& dstArea) const
42 ✔
24
{
25
    drawImage(dstArea, modulationColor_);
42 ✔
26
}
42 ✔
27

28
void ctrlBaseImage::drawImage(const Rect& dstArea, unsigned color) const
42 ✔
29
{
30
    if(img_ == nullptr)
42 ✔
31
        return;
×
32

33
    auto dst = dstArea;
42 ✔
34
    auto imageSize = img_->getSize();
42 ✔
35
    auto dstSize = dstArea.getSize();
42 ✔
36
    Rect srcArea = Rect(DrawPoint::all(0), imageSize);
42 ✔
37

38
    if(imageSize.x > dstSize.x)
42 ✔
39
    {
40
        auto halfDelta = (imageSize.x - dstSize.x) / 2;
2 ✔
41
        srcArea.left += halfDelta;
2 ✔
42
        srcArea.right -= halfDelta;
2 ✔
43
    } else if(imageSize.x < dstSize.x)
40 ✔
44
    {
45
        auto halfDelta = (dstSize.x - imageSize.x) / 2;
39 ✔
46
        dst.left += halfDelta;
39 ✔
47
        dst.right -= halfDelta;
39 ✔
48
    }
49

50
    if(imageSize.y > dstSize.y)
42 ✔
51
    {
52
        auto halfDelta = (imageSize.y - dstSize.y) / 2;
2 ✔
53
        srcArea.top += halfDelta;
2 ✔
54
        srcArea.bottom -= halfDelta;
2 ✔
55
    } else if(imageSize.y < dstSize.y)
40 ✔
56
    {
57
        auto halfDelta = (dstSize.y - imageSize.y) / 2;
39 ✔
58
        dst.top += halfDelta;
39 ✔
59
        dst.bottom -= halfDelta;
39 ✔
60
    }
61

62
    img_->draw(dst, srcArea, color);
42 ✔
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc