Skip to content

Commit

Permalink
gui: Remove BlendPreserver object.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Sep 27, 2023
1 parent cb15a4f commit fa05d5e
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions libopenage/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,41 @@ void GUI::process_events() {
// return not this->input.process(event);
// }

namespace {
/**
* Restores blending function.
*/
class BlendPreserver {
public:
BlendPreserver() :
was_on{},
src{},
dst{} {
glGetBooleanv(GL_BLEND, &this->was_on);

if (this->was_on != GL_FALSE) {
glGetIntegerv(GL_BLEND_SRC_ALPHA, &this->src);
glGetIntegerv(GL_BLEND_DST_ALPHA, &this->dst);
}
}

~BlendPreserver() {
if (this->was_on != GL_FALSE) {
glEnable(GL_BLEND);
glBlendFunc(this->src, this->dst);
}
else {
glDisable(GL_BLEND);
}
}

private:
GLboolean was_on;
GLint src;
GLint dst;
};

} // namespace
// namespace {
// /**
// * Restores blending function.
// */
// class BlendPreserver {
// public:
// BlendPreserver() :
// was_on{},
// src{},
// dst{} {
// glGetBooleanv(GL_BLEND, &this->was_on);

// if (this->was_on != GL_FALSE) {
// glGetIntegerv(GL_BLEND_SRC_ALPHA, &this->src);
// glGetIntegerv(GL_BLEND_DST_ALPHA, &this->dst);
// }
// }

// ~BlendPreserver() {
// if (this->was_on != GL_FALSE) {
// glEnable(GL_BLEND);
// glBlendFunc(this->src, this->dst);
// }
// else {
// glDisable(GL_BLEND);
// }
// }

// private:
// GLboolean was_on;
// GLint src;
// GLint dst;
// };

// } // namespace

// bool GUI::on_drawhud() {
// this->render_updater.process_callbacks();
Expand Down

0 comments on commit fa05d5e

Please sign in to comment.