blob: b53b9ed1d9f1e6ac37c43b0c82584d5fdf689b21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "ninepatchnode.h"
#include "pixmaptexture.h"
NinePatchNode::NinePatchNode()
{
setMaterial((QSGMaterial*)1);
setGeometry((QSGGeometry*)1);
}
void NinePatchNode::setTexture(QSGTexture *texture)
{
PixmapTexture *pt = qobject_cast<PixmapTexture*>(texture);
if (!pt) {
qWarning() << "Image used with invalid texture format.";
return;
}
m_pixmap = pt->pixmap();
}
void NinePatchNode::setBounds(const QRectF &bounds)
{
m_bounds = bounds;
}
void NinePatchNode::setDevicePixelRatio(qreal ratio)
{
}
void NinePatchNode::setPadding(int left, int top, int right, int bottom)
{
}
void NinePatchNode::update()
{
}
void NinePatchNode::paint(QPainter *painter)
{
painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height()));
}
|