##// END OF EJS Templates
Merge remote-tracking branch 'origin/5.6.0' into 5.6...
Frederik Gladhorn -
r2874:b2259e94e953 merge
parent child
Show More
@@ -512,14 +512,16 QSGNode *DeclarativeChart::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdateP
512 512
513 513 if (!node) {
514 514 node = new DeclarativeChartNode(window());
515 if (node->glRenderNode()) {
515 516 connect(window(), &QQuickWindow::beforeRendering,
516 517 node->glRenderNode(), &DeclarativeRenderNode::render);
517 518 }
519 }
518 520
519 521 const QRectF &bRect = boundingRect();
520 522
521 523 // Update GL data
522 if (m_glXYDataManager->dataMap().size() || m_glXYDataManager->mapDirty()) {
524 if (node->glRenderNode() && (m_glXYDataManager->dataMap().size() || m_glXYDataManager->mapDirty())) {
523 525 const QRectF &plotArea = m_chart->plotArea();
524 526 const QSizeF &chartAreaSize = m_chart->size();
525 527
@@ -39,28 +39,28 DeclarativeChartNode::DeclarativeChartNode(QQuickWindow *window) :
39 39 m_textureSize(1, 1),
40 40 m_glRenderNode(0)
41 41 {
42 initializeOpenGLFunctions();
43
44 42 // Our texture node must have a texture, so use a default one pixel texture
45 GLuint defaultTexture = 0;
46 glGenTextures(1, &defaultTexture);
47 glBindTexture(GL_TEXTURE_2D, defaultTexture);
48 uchar buf[4] = { 0, 0, 0, 0 };
49 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &buf);
50
43 QImage dummyImage(QSize(1, 1), QImage::Format_ARGB32);
44 uchar *imageData = dummyImage.bits();
45 imageData[0] = 0;
46 imageData[1] = 0;
47 imageData[2] = 0;
48 imageData[3] = 0;
51 49 QQuickWindow::CreateTextureOptions defaultTextureOptions = QQuickWindow::CreateTextureOptions(
52 50 QQuickWindow::TextureHasAlphaChannel | QQuickWindow::TextureOwnsGLTexture);
53 m_texture = m_window->createTextureFromId(defaultTexture, QSize(1, 1), defaultTextureOptions);
51 m_texture = m_window->createTextureFromImage(dummyImage, defaultTextureOptions);
54 52
55 53 setTexture(m_texture);
56 54 setFiltering(QSGTexture::Linear);
57 55
56 if (QOpenGLContext::currentContext()) {
58 57 // Create child node for rendering GL graphics
59 58 m_glRenderNode = new DeclarativeRenderNode(m_window);
60 59 m_glRenderNode->setFlag(OwnedByParent);
61 60 appendChildNode(m_glRenderNode);
62 61 m_glRenderNode->setRect(0, 0, 0, 0); // Hide child node by default
63 62 }
63 }
64 64
65 65 DeclarativeChartNode::~DeclarativeChartNode()
66 66 {
General Comments 0
You need to be logged in to leave comments. Login now