Browse Source

Improve performance of inline display rendering

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
ed1e66bc97
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 4 additions and 12 deletions
  1. +2
    -1
      source/frontend/carla_backend.py
  2. +2
    -11
      source/frontend/patchcanvas/canvasbox.py

+ 2
- 1
source/frontend/carla_backend.py View File

@@ -22,6 +22,7 @@
from abc import abstractmethod
from ctypes import *
from platform import architecture
from struct import pack
from sys import platform, maxsize

# ------------------------------------------------------------------------------------------------------------
@@ -3107,7 +3108,7 @@ class CarlaHostDLL(CarlaHostMeta):
return None
contents = ptr.contents
datalen = contents.height * contents.stride
databuf = tuple(contents.data[i] for i in range(datalen))
databuf = pack("%iB" % datalen, *contents.data[:datalen])
data = {
'data': databuf,
'width': contents.width,


+ 2
- 11
source/frontend/patchcanvas/canvasbox.py View File

@@ -19,9 +19,6 @@
# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

from sip import voidptr
from struct import pack

from PyQt5.QtCore import pyqtSignal, pyqtSlot, qCritical, QT_VERSION, Qt, QPointF, QRectF, QTimer
from PyQt5.QtGui import QCursor, QFont, QFontMetrics, QImage, QLinearGradient, QPainter, QPen
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsObject, QMenu
@@ -118,7 +115,6 @@ class CanvasBox(QGraphicsObject):
self.m_cursor_moving = False
self.m_forced_split = False
self.m_mouse_down = False
self.m_inline_data = None
self.m_inline_image = None
self.m_inline_scaling = 1.0
self.m_inline_first = True
@@ -199,7 +195,6 @@ class CanvasBox(QGraphicsObject):

def removeAsPlugin(self):
#del self.m_inline_image
#self.m_inline_data = None
#self.m_inline_image = None
#self.m_inline_scaling = 1.0

@@ -213,7 +208,6 @@ class CanvasBox(QGraphicsObject):

if not hasInlineDisplay:
del self.m_inline_image
self.m_inline_data = None
self.m_inline_image = None
self.m_inline_scaling = 1.0

@@ -765,11 +759,8 @@ class CanvasBox(QGraphicsObject):
if data is None:
return

new_inline_data = pack("%iB" % (data['height'] * data['stride']), *data['data'])
self.m_inline_image = QImage(voidptr(new_inline_data),
data['width'], data['height'], data['stride'],
QImage.Format_ARGB32)
self.m_inline_data = new_inline_data
self.m_inline_image = QImage(data['data'], data['width'], data['height'], data['stride'],
QImage.Format_ARGB32)
self.m_inline_scaling = scaling
self.m_plugin_inline = self.INLINE_DISPLAY_CACHED



Loading…
Cancel
Save