Sha256: e46ee897d21803abf9670478939f33d590b85f6da3d5c236419a84bac752d0e2
Contents?: true
Size: 815 Bytes
Versions: 2
Compression:
Stored size: 815 Bytes
Contents
#include "ClipRectStack.hpp" #include <stdexcept> void Gosu::ClipRectStack::clear() { m_stack.clear(); m_effective_rect = std::nullopt; } void Gosu::ClipRectStack::push(const Rect& rect) { m_stack.push_back(rect); if (m_effective_rect) { m_effective_rect->clip_to(rect); } else { m_effective_rect = rect; } } void Gosu::ClipRectStack::pop() { if (m_stack.empty()) { throw std::logic_error("ClipRectStack is empty"); } m_stack.pop_back(); // The clip rect is the intersection of all active clip rects (if any). m_effective_rect = std::nullopt; for (const auto& rect : m_stack) { if (m_effective_rect) { m_effective_rect->clip_to(rect); } else { m_effective_rect = rect; } } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gosu-2.0.0.pre8 | src/ClipRectStack.cpp |
gosu-2.0.0.pre7 | src/ClipRectStack.cpp |