Skip to content

Commit 9d2a355

Browse files
getBmpTexture().draw()
1 parent c860676 commit 9d2a355

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

CIO/CButton.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,8 @@ void CButton::draw(Position parentOrigin) const
135135
if(button_picture >= 0)
136136
{
137137
auto& picTex = getBmpTexture(button_picture);
138-
if(picTex.isValid())
139-
{
140-
const Position picPos = absPos + size_ / 2 - Position(picTex.getSize()) / 2;
141-
picTex.draw(picPos);
142-
}
138+
const Position picPos = absPos + size_ / 2 - Position(picTex.getSize()) / 2;
139+
picTex.draw(picPos);
143140
} else if(button_text)
144141
{
145142
// Draw text centered (using native-size texture drawing for each character)

CIO/CControlContainer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ void CControlContainer::drawChildren(Position origin)
189189
button->draw(origin);
190190
for(const auto& static_picture : static_pictures)
191191
{
192-
auto& tex = getBmpTexture(static_picture.pic);
193-
if(tex.isValid())
194-
tex.draw(origin + static_picture.pos);
192+
getBmpTexture(static_picture.pic).draw(origin + static_picture.pos);
195193
}
196194
}

CIO/CPicture.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,5 @@ void CPicture::setMouseData(const SDL_MouseButtonEvent& button)
6666

6767
void CPicture::draw(Position parentOrigin) const
6868
{
69-
auto& tex = getBmpTexture(picture_);
70-
if(!tex.isValid())
71-
return;
72-
tex.draw(parentOrigin + pos_);
69+
getBmpTexture(picture_).draw(parentOrigin + pos_);
7370
}

0 commit comments

Comments
 (0)