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

Return-To-The-Roots / s25client / 15361566545

31 May 2025 07:38AM UTC coverage: 50.46% (+0.2%) from 50.286%
15361566545

Pull #1536

github

web-flow
Merge ce0f21f7d into 5dd0526f9
Pull Request #1536: Add support for image cropping inside ctrlImageButton

55 of 64 new or added lines in 6 files covered. (85.94%)

32 existing lines in 11 files now uncovered.

22453 of 44497 relevant lines covered (50.46%)

34868.73 hits per line

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

84.21
/libs/s25main/controls/ctrlImageButton.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 "ctrlImageButton.h"
6
#include <ogl/ITexture.h>
7

8
ctrlImageButton::ctrlImageButton(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size,
339✔
9
                                 const TextureColor tc, ITexture* const image, const std::string& tooltip)
339✔
10
    : ctrlButton(parent, id, pos, size, tc, tooltip), ctrlBaseImage(image)
339✔
11
{}
339✔
12

13
void ctrlImageButton::DrawContent() const
36✔
14
{
15
    // Adding of origin compensates for its substraction inside ITexture::Draw()
16
    auto pos = GetDrawPos() + GetImage()->GetOrigin();
36✔
17
    auto size = GetSize();
36✔
18

19
    if(hasBorder)
36✔
20
    {
21
        // Ensure that 3D border is not drawn on
22
        const unsigned borderThickness = 2;
8✔
23
        pos += DrawPoint::all(borderThickness);
8✔
24
        size -= Extent::all(2 * borderThickness);
8✔
25
    }
26

27
    if((state == ButtonState::Pressed || isChecked) && isEnabled)
36✔
28
    {
UNCOV
29
        pos += DrawPoint::all(2);
×
NEW
30
        size -= Extent::all(2);
×
31
    }
32

33
    Rect drawRect(pos, size);
36✔
34
    if(!isEnabled && GetModulationColor() == COLOR_WHITE)
36✔
NEW
35
        DrawImage(drawRect, 0xFF555555);
×
36
    else
37
        DrawImage(drawRect);
36✔
38
}
36✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc