void PlatformContextGL2D::clip(const FloatRect& rect) { FloatRect transformedRect(rect); transformedRect.setX(transformedRect.x() + transform(4)); transformedRect.setY(transformedRect.y() + transform(5)); m_state.m_scissorRect.intersect(enclosingIntRect(transformedRect)); }
QRectF ScreenSetup::transformedRect(QRectF const& _rect) const { auto _zoom = scalingFactor(); /// Transformed desktop rect auto _desktopRect = transformedRect(); return QRectF( _desktopRect.x() + _rect.x() * _zoom, _desktopRect.y() + _rect.y() * _zoom, _rect.width() * _zoom, _rect.height() * _zoom); }
void ScreenSetup::paintEvent(QPaintEvent*) { QPainter _p(this); _p.setPen(QPen(QColor("#ffffff").darker(150),3)); if (screenItems_.empty()) { QFont _font("Helvetica",30 / devicePixelRatio()); _p.setFont(_font); _p.setBrush(QBrush("#cccccc")); _p.drawText(rect(),Qt::AlignCenter,"No screen connected."); return; } _p.setPen(QPen(QColor("#ffffff").darker(150),3)); _p.drawRect(transformedRect()); /// Draw all items for (auto& _item : screenItems_) { _item.second->paint(_p); } }