scene: Make SurfaceItem provide device texture coordinates
The main motivation behind this change is to make the ItemRendererOpenGL use a homogeneous coordinate space for texture coordinates in order to simplify rendering code. The device pixels have been chosen because they are more agnostic about the graphics api.
This commit is contained in:
parent
8a5f469f95
commit
f002e20354
2 changed files with 5 additions and 5 deletions
|
@ -195,7 +195,7 @@ void ItemRendererOpenGL::createRenderNode(Item *item, RenderContext *context)
|
|||
.transformMatrix = context->transformStack.top(),
|
||||
.opacity = context->opacityStack.top(),
|
||||
.hasAlpha = pixmap->hasAlphaChannel(),
|
||||
.coordinateType = NormalizedCoordinates,
|
||||
.coordinateType = UnnormalizedCoordinates,
|
||||
.colorDescription = item->colorDescription(),
|
||||
.renderingIntent = item->renderingIntent(),
|
||||
.bufferReleasePoint = surfaceItem->bufferReleasePoint(),
|
||||
|
|
|
@ -255,10 +255,10 @@ WindowQuadList SurfaceItem::buildQuads() const
|
|||
const QPointF bufferBottomRight = snapToPixelGridF(m_bufferSourceBox.topLeft() + m_surfaceToBufferTransform.map(QPointF(rect.right() * xScale, rect.bottom() * yScale), sourceBox.size()));
|
||||
const QPointF bufferBottomLeft = snapToPixelGridF(m_bufferSourceBox.topLeft() + m_surfaceToBufferTransform.map(QPointF(rect.left() * xScale, rect.bottom() * yScale), sourceBox.size()));
|
||||
|
||||
quad[0] = WindowVertex(rect.topLeft(), QPointF{bufferTopLeft.x() / m_bufferSize.width(), bufferTopLeft.y() / m_bufferSize.height()});
|
||||
quad[1] = WindowVertex(rect.topRight(), QPointF{bufferTopRight.x() / m_bufferSize.width(), bufferTopRight.y() / m_bufferSize.height()});
|
||||
quad[2] = WindowVertex(rect.bottomRight(), QPointF{bufferBottomRight.x() / m_bufferSize.width(), bufferBottomRight.y() / m_bufferSize.height()});
|
||||
quad[3] = WindowVertex(rect.bottomLeft(), QPointF{bufferBottomLeft.x() / m_bufferSize.width(), bufferBottomLeft.y() / m_bufferSize.height()});
|
||||
quad[0] = WindowVertex(rect.topLeft(), bufferTopLeft);
|
||||
quad[1] = WindowVertex(rect.topRight(), bufferTopRight);
|
||||
quad[2] = WindowVertex(rect.bottomRight(), bufferBottomRight);
|
||||
quad[3] = WindowVertex(rect.bottomLeft(), bufferBottomLeft);
|
||||
|
||||
quads << quad;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue