aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project.conf3
-rw-r--r--src/Body.cpp8
2 files changed, 10 insertions, 1 deletions
diff --git a/project.conf b/project.conf
index d54fd08..757df82 100644
--- a/project.conf
+++ b/project.conf
@@ -11,4 +11,5 @@ version = "c++17"
sfml-graphics = "2"
x11 = "1"
jsoncpp = "1"
-cppcodec-1 = "0" \ No newline at end of file
+cppcodec-1 = "0"
+gl = ">=0" \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index a9dc18f..0297072 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -3,6 +3,7 @@
#include "../plugins/Plugin.hpp"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Sprite.hpp>
+#include <SFML/OpenGL.hpp>
#include <assert.h>
#include <cmath>
@@ -136,6 +137,8 @@ namespace QuickMedia {
// TODO: Load thumbnails with more than one thread.
// TODO: Show chapters (rows) that have been read differently to make it easier to see what hasn't been read yet.
void Body::draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress) {
+ sf::Vector2f scissor_pos = pos;
+
const float image_max_height = 100.0f;
const float spacing_y = 15.0f;
const float padding_x = 10.0f;
@@ -209,6 +212,10 @@ namespace QuickMedia {
}
}
+ sf::Vector2u window_size = window.getSize();
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(scissor_pos.x, (int)window_size.y - (int)scissor_pos.y - (int)size.y, size.x, size.y);
+
for(int i = first_visible_item + 1; i < num_items; ++i) {
const auto &item = items[i];
@@ -331,6 +338,7 @@ namespace QuickMedia {
pos.y += item_height + spacing_y;
}
+ glDisable(GL_SCISSOR_TEST);
for(auto it = item_thumbnail_textures.begin(); it != item_thumbnail_textures.end();) {
if(!it->second.referenced)