Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
promto-c committed Aug 20, 2023
1 parent 6863377 commit 2e7bcf0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 5 deletions.
49 changes: 48 additions & 1 deletion ui/player_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="top_layout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
Expand All @@ -66,7 +69,51 @@
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_3" native="true"/>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="prefetch_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Prefetch</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_9" native="true"/>
</item>
<item>
<widget class="QWidget" name="widget_7" native="true">
Expand Down
16 changes: 12 additions & 4 deletions viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,18 @@ def _update_viewer_transformation(self):
scaled_width = (self.image_width/self.width()) * self._viewer_zoom
scaled_height = (self.image_height/self.height()) * self._viewer_zoom

translation_matrix = create_translation_matrix(x_offset, y_offset)
scale_matrix = create_scale_matrix(scaled_width, scaled_height)

self.viewer_transformation_matrix = np.dot(translation_matrix, scale_matrix)
# translation_matrix = create_translation_matrix(x_offset, y_offset)
# scale_matrix = create_scale_matrix(scaled_width, scaled_height)

# self.viewer_transformation_matrix = np.dot(translation_matrix, scale_matrix)

# Directly compute the required transformation matrix
self.viewer_transformation_matrix = np.array([
[scaled_width, 0, 0, x_offset],
[0, scaled_height, 0, y_offset],
[0, 0, 1, 0],
[0, 0, 0, 1]
])

# Update the uniform variable in the shader
self.shader_program.set_tranformation(self.viewer_transformation_matrix)
Expand Down

0 comments on commit 2e7bcf0

Please sign in to comment.