[pitivi] viewer: Fix blurred overlay lines
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] viewer: Fix blurred overlay lines
- Date: Sun, 12 May 2019 04:25:35 +0000 (UTC)
commit dc0165d658153491f093ed7bb597c6490dec1859
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu May 9 05:05:28 2019 +0200
viewer: Fix blurred overlay lines
pitivi/viewer/move_scale_overlay.py | 13 +++++++++----
pitivi/viewer/title_overlay.py | 19 ++++---------------
2 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/pitivi/viewer/move_scale_overlay.py b/pitivi/viewer/move_scale_overlay.py
index eb1b3cee..91a05568 100644
--- a/pitivi/viewer/move_scale_overlay.py
+++ b/pitivi/viewer/move_scale_overlay.py
@@ -103,7 +103,12 @@ class Handle:
return 2 * Handle.MINIMAL_SIZE / self._overlay.stack.window_size
def get_window_position(self):
- return self.__window_position.tolist()
+ x, y = [int(v) + 0.5 for v in self.__window_position]
+ if Edge.right in self.placement:
+ x -= 1
+ if Edge.bottom in self.placement:
+ y -= 1
+ return x, y
def get_source_position(self):
"""Returns a source translation when handles at TOP or LEFT are dragged.
@@ -194,16 +199,16 @@ class Handle:
cr.rectangle(x, y, self.__size, self.__size)
cr.fill()
- # Black outline around the boxes
+ # Black outline around the box
cr.set_source_rgb(0, 0, 0)
cr.set_line_width(3)
- cr.rectangle(x, y, self.__size, self.__size)
+ cr.rectangle(x, y, self.__size + 1, self.__size + 1)
cr.stroke()
# Inner white line
cr.set_source_rgb(1, 1, 1)
cr.set_line_width(1)
- cr.rectangle(x, y, self.__size, self.__size)
+ cr.rectangle(x, y, self.__size + 1, self.__size + 1)
cr.stroke()
diff --git a/pitivi/viewer/title_overlay.py b/pitivi/viewer/title_overlay.py
index c490f5fb..4581051f 100644
--- a/pitivi/viewer/title_overlay.py
+++ b/pitivi/viewer/title_overlay.py
@@ -27,7 +27,6 @@ class TitleOverlay(Overlay):
def __init__(self, stack, source):
Overlay.__init__(self, stack, source)
- self.__corners = []
self.__position = numpy.array([0, 0])
self.__size = None
self.__click_source_position = None
@@ -43,9 +42,9 @@ class TitleOverlay(Overlay):
self.update_from_source()
def __draw_rectangle(self, cr):
- cr.move_to(*self.__corners[-1])
- for corner in self.__corners:
- cr.line_to(*corner.tolist())
+ x, y = [int(v) + 0.5 for v in self.__position]
+ w, h = [int(v) - 1 for v in self.__size]
+ cr.rectangle(x, y, w, h)
def __get_source_position(self):
res_x, x = self._source.get_child_property("x-absolute")
@@ -69,17 +68,8 @@ class TitleOverlay(Overlay):
self._source.set_child_property("x-absolute", float(position[0]))
self._source.set_child_property("y-absolute", float(position[1]))
- def __update_corners(self):
- self.__corners = [
- self.__position,
- self.__position + numpy.array([self.__size[0], 0]),
- self.__position + self.__size,
- self.__position + numpy.array([0, self.__size[1]])
- ]
-
def __update_from_motion(self, title_position):
self.__position = title_position
- self.__update_corners()
def update_from_source(self):
position = self.__get_text_position()
@@ -87,7 +77,6 @@ class TitleOverlay(Overlay):
self.__position = position * self.stack.window_size / self.project_size
self.__size = size * self.stack.window_size / self.project_size
- self.__update_corners()
self.queue_draw()
def on_hover(self, cursor_position):
@@ -119,7 +108,7 @@ class TitleOverlay(Overlay):
def on_motion_notify(self, cursor_position):
if not isinstance(self.stack.click_position, numpy.ndarray):
- return
+ return
self.__update_from_motion(self.__click_window_position +
self.stack.get_drag_distance(cursor_position))
self.queue_draw()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]