Skip to content

Commit

Permalink
Merge pull request #40 from Jarod42/IconFix
Browse files Browse the repository at this point in the history
Icon optimization
  • Loading branch information
Jarod42 authored Aug 13, 2024
2 parents 5a191c3 + fffe84c commit aedc8ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 1d9590907eb3a8cc298f660c1436d0e90808d684
* Continue rebasing from 2f431b404983b49adfd3cca1c39a9b0a9616e70d
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
7 changes: 3 additions & 4 deletions src/widgets/checkbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ namespace gcn
else
graphics->setColor(Color(128, 128, 128));

int h = getHeight() + getHeight() / 2;
const int h = getHeight() + getHeight() / 2;

graphics->drawText(getCaption(), h - 2, 0);
}

void CheckBox::drawBox(Graphics* graphics)
{
int h = getHeight() - 2;

int alpha = getBaseColor().a;
const int h = getHeight() - 2;
const int alpha = getBaseColor().a;
Color faceColor = getBaseColor();
faceColor.a = alpha;
Color highlightColor = faceColor + 0x303030;
Expand Down
10 changes: 4 additions & 6 deletions src/widgets/icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ namespace gcn
: mImage(0)
, mInternalImage(false)
{
setWidth(0);
setHeight(0);
setSize(0, 0);
}

Icon::Icon(const std::string& filename)
Expand All @@ -80,16 +79,14 @@ namespace gcn
{
mImage = Image::load(filename);
mInternalImage = true;
setHeight(mImage->getHeight());
setWidth(mImage->getWidth());
setSize(mImage->getWidth(), mImage->getHeight());
}

Icon::Icon(const Image* image)
: mImage(image),
mInternalImage(false)
{
setHeight(mImage->getHeight());
setWidth(mImage->getWidth());
setSize(mImage->getWidth(), mImage->getHeight());
}

Icon::~Icon()
Expand All @@ -109,6 +106,7 @@ namespace gcn

mImage = image;
mInternalImage = false;
setSize(mImage->getWidth(), mImage->getHeight());
}

const Image* Icon::getImage() const
Expand Down

0 comments on commit aedc8ac

Please sign in to comment.