{"action":"created","comment":{"url":"https://api.github.com/repos/nemomobile/lipstick/pulls/comments/27020708","id":27020708,"diff_hunk":"@@ -480,13 +496,119 @@ QSGNode *WindowPixmapItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData\n     SurfaceNode *node = static_cast<SurfaceNode *>(oldNode);\n \n     if (m_item == 0) {\n+        node->setTextureProvider(0, false);\n         delete node;\n         return 0;\n     }\n \n     if (!node) node = new SurfaceNode;\n \n-    node->setTextureProvider(m_item->textureProvider());\n+    class SnapshotTextureProvider : public QSGTextureProvider\n+    {\n+    public:\n+        ~SnapshotTextureProvider()\n+        {\n+            delete fbo;\n+            delete program;\n+            delete t;\n+        }\n+        QSGTexture *texture() const Q_DECL_OVERRIDE\n+        {\n+            return t;\n+        }\n+        QSGTexture *t;\n+        QOpenGLFramebufferObject *fbo;\n+        QOpenGLShaderProgram *program;\n+        int vertexLocation;\n+        int sizeLocation;\n+        int textureLocation;\n+        int matrixLocation;\n+    };\n+\n+    QSGTextureProvider *provider = m_item->textureProvider();\n+    QSGTexture *texture = provider->texture();\n+\n+    if (!m_hasBuffer && texture) {\n+        if (!m_textureProvider) {\n+            SnapshotTextureProvider *prov = new SnapshotTextureProvider;\n+            m_textureProvider = prov;\n+\n+            prov->fbo = 0;\n+            prov->program = new QOpenGLShaderProgram;\n+            prov->program->addShaderFromSourceCode(QOpenGLShader::Vertex,\n+                \"attribute highp vec4 vertex;\\n\"\n+                \"uniform highp mat4 matrix;\\n\"\n+                \"uniform highp vec2 size;\\n\"\n+                \"varying highp vec2 texPos;\\n\"\n+                \"void main(void) {\\n\"\n+                \"   texPos = vertex.xy;\\n\"\n+                \"   gl_Position = matrix * vec4(vertex.xy * size, vertex.zw);\\n\"\n+                \"}\");\n+            prov->program->addShaderFromSourceCode(QOpenGLShader::Fragment,\n+                \"uniform sampler2D texture;\\n\"\n+                \"varying highp vec2 texPos;\\n\"\n+                \"void main(void) {\\n\"\n+                \"   gl_FragColor = texture2D(texture, texPos);\\n\"\n+                \"}\");\n+            if (!prov->program->link())\n+                qDebug() << prov->program->log();\n+\n+            prov->vertexLocation = prov->program->attributeLocation(\"vertex\");\n+            prov->sizeLocation = prov->program->uniformLocation(\"size\");\n+            prov->textureLocation = prov->program->uniformLocation(\"texture\");\n+            prov->matrixLocation = prov->program->uniformLocation(\"matrix\");\n+        }\n+        provider = m_textureProvider;\n+\n+        if (m_unmapLock) {\n+            SnapshotTextureProvider *prov = static_cast<SnapshotTextureProvider *>(provider);\n+\n+            if (!prov->fbo || prov->fbo->size() != QSize(width(), height())) {\n+                delete prov->fbo;\n+                prov->fbo = new QOpenGLFramebufferObject(width(), height());\n+            }\n+\n+            prov->fbo->bind();\n+            prov->program->bind();\n+\n+            glActiveTexture(GL_TEXTURE0);","path":"src/compositor/windowpixmapitem.cpp","position":175,"original_position":175,"commit_id":"0ac2f3d8e0df39d047f3ac3e7f9c80db93c9982f","original_commit_id":"0ac2f3d8e0df39d047f3ac3e7f9c80db93c9982f","user":{"login":"sletta","id":6309668,"avatar_url":"https://avatars.githubusercontent.com/u/6309668?v=3","gravatar_id":"","url":"https://api.github.com/users/sletta","html_url":"https://github.com/sletta","followers_url":"https://api.github.com/users/sletta/followers","following_url":"https://api.github.com/users/sletta/following{/other_user}","gists_url":"https://api.github.com/users/sletta/gists{/gist_id}","starred_url":"https://api.github.com/users/sletta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sletta/subscriptions","organizations_url":"https://api.github.com/users/sletta/orgs","repos_url":"https://api.github.com/users/sletta/repos","events_url":"https://api.github.com/users/sletta/events{/privacy}","received_events_url":"https://api.github.com/users/sletta/received_events","type":"User","site_admin":false},"body":"you can, but most of the built in sg code assumes tex0 by default. Only when you change it are you expected to reset it.","created_at":"2015-03-24T11:54:08Z","updated_at":"2015-03-24T11:54:08Z","html_url":"https://github.com/nemomobile/lipstick/pull/256#discussion_r27020708","pull_request_url":"https://api.github.com/repos/nemomobile/lipstick/pulls/256","_links":{"self":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/comments/27020708"},"html":{"href":"https://github.com/nemomobile/lipstick/pull/256#discussion_r27020708"},"pull_request":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/256"}}},"pull_request":{"url":"https://api.github.com/repos/nemomobile/lipstick/pulls/256","id":31520362,"html_url":"https://github.com/nemomobile/lipstick/pull/256","diff_url":"https://github.com/nemomobile/lipstick/pull/256.diff","patch_url":"https://github.com/nemomobile/lipstick/pull/256.patch","issue_url":"https://api.github.com/repos/nemomobile/lipstick/issues/256","number":256,"state":"open","locked":false,"title":"[lipstick] Make a screenshot of the WindowPixmanItem's surface when hidden","user":{"login":"giucam","id":680260,"avatar_url":"https://avatars.githubusercontent.com/u/680260?v=3","gravatar_id":"","url":"https://api.github.com/users/giucam","html_url":"https://github.com/giucam","followers_url":"https://api.github.com/users/giucam/followers","following_url":"https://api.github.com/users/giucam/following{/other_user}","gists_url":"https://api.github.com/users/giucam/gists{/gist_id}","starred_url":"https://api.github.com/users/giucam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giucam/subscriptions","organizations_url":"https://api.github.com/users/giucam/orgs","repos_url":"https://api.github.com/users/giucam/repos","events_url":"https://api.github.com/users/giucam/events{/privacy}","received_events_url":"https://api.github.com/users/giucam/received_events","type":"User","site_admin":false},"body":"When the surface being used by a WindowPixmapItem gets a NULL buffer\r\nmake a screenshot of it, scaled down to the size of the WindowPixmapItem,\r\nand only then release the last wayland buffer.\r\nThis makes sure we won't be showing random content due to the current NULL buffer attached.\r\n\r\nNeeds https://github.com/mer-qt/qtwayland/pull/26","created_at":"2015-03-19T12:57:52Z","updated_at":"2015-03-24T11:54:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"875ae883d4bc664a702fc4511473468ce94ab5ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nemomobile/lipstick/pulls/256/commits","review_comments_url":"https://api.github.com/repos/nemomobile/lipstick/pulls/256/comments","review_comment_url":"https://api.github.com/repos/nemomobile/lipstick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nemomobile/lipstick/issues/256/comments","statuses_url":"https://api.github.com/repos/nemomobile/lipstick/statuses/0ac2f3d8e0df39d047f3ac3e7f9c80db93c9982f","head":{"label":"giucam:screenshots","ref":"screenshots","sha":"0ac2f3d8e0df39d047f3ac3e7f9c80db93c9982f","user":{"login":"giucam","id":680260,"avatar_url":"https://avatars.githubusercontent.com/u/680260?v=3","gravatar_id":"","url":"https://api.github.com/users/giucam","html_url":"https://github.com/giucam","followers_url":"https://api.github.com/users/giucam/followers","following_url":"https://api.github.com/users/giucam/following{/other_user}","gists_url":"https://api.github.com/users/giucam/gists{/gist_id}","starred_url":"https://api.github.com/users/giucam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giucam/subscriptions","organizations_url":"https://api.github.com/users/giucam/orgs","repos_url":"https://api.github.com/users/giucam/repos","events_url":"https://api.github.com/users/giucam/events{/privacy}","received_events_url":"https://api.github.com/users/giucam/received_events","type":"User","site_admin":false},"repo":{"id":13298745,"name":"lipstick","full_name":"giucam/lipstick","owner":{"login":"giucam","id":680260,"avatar_url":"https://avatars.githubusercontent.com/u/680260?v=3","gravatar_id":"","url":"https://api.github.com/users/giucam","html_url":"https://github.com/giucam","followers_url":"https://api.github.com/users/giucam/followers","following_url":"https://api.github.com/users/giucam/following{/other_user}","gists_url":"https://api.github.com/users/giucam/gists{/gist_id}","starred_url":"https://api.github.com/users/giucam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giucam/subscriptions","organizations_url":"https://api.github.com/users/giucam/orgs","repos_url":"https://api.github.com/users/giucam/repos","events_url":"https://api.github.com/users/giucam/events{/privacy}","received_events_url":"https://api.github.com/users/giucam/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/giucam/lipstick","description":"QML desktop","fork":true,"url":"https://api.github.com/repos/giucam/lipstick","forks_url":"https://api.github.com/repos/giucam/lipstick/forks","keys_url":"https://api.github.com/repos/giucam/lipstick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/giucam/lipstick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/giucam/lipstick/teams","hooks_url":"https://api.github.com/repos/giucam/lipstick/hooks","issue_events_url":"https://api.github.com/repos/giucam/lipstick/issues/events{/number}","events_url":"https://api.github.com/repos/giucam/lipstick/events","assignees_url":"https://api.github.com/repos/giucam/lipstick/assignees{/user}","branches_url":"https://api.github.com/repos/giucam/lipstick/branches{/branch}","tags_url":"https://api.github.com/repos/giucam/lipstick/tags","blobs_url":"https://api.github.com/repos/giucam/lipstick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/giucam/lipstick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/giucam/lipstick/git/refs{/sha}","trees_url":"https://api.github.com/repos/giucam/lipstick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/giucam/lipstick/statuses/{sha}","languages_url":"https://api.github.com/repos/giucam/lipstick/languages","stargazers_url":"https://api.github.com/repos/giucam/lipstick/stargazers","contributors_url":"https://api.github.com/repos/giucam/lipstick/contributors","subscribers_url":"https://api.github.com/repos/giucam/lipstick/subscribers","subscription_url":"https://api.github.com/repos/giucam/lipstick/subscription","commits_url":"https://api.github.com/repos/giucam/lipstick/commits{/sha}","git_commits_url":"https://api.github.com/repos/giucam/lipstick/git/commits{/sha}","comments_url":"https://api.github.com/repos/giucam/lipstick/comments{/number}","issue_comment_url":"https://api.github.com/repos/giucam/lipstick/issues/comments{/number}","contents_url":"https://api.github.com/repos/giucam/lipstick/contents/{+path}","compare_url":"https://api.github.com/repos/giucam/lipstick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/giucam/lipstick/merges","archive_url":"https://api.github.com/repos/giucam/lipstick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/giucam/lipstick/downloads","issues_url":"https://api.github.com/repos/giucam/lipstick/issues{/number}","pulls_url":"https://api.github.com/repos/giucam/lipstick/pulls{/number}","milestones_url":"https://api.github.com/repos/giucam/lipstick/milestones{/number}","notifications_url":"https://api.github.com/repos/giucam/lipstick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/giucam/lipstick/labels{/name}","releases_url":"https://api.github.com/repos/giucam/lipstick/releases{/id}","created_at":"2013-10-03T13:12:33Z","updated_at":"2015-02-18T11:32:12Z","pushed_at":"2015-03-23T17:16:54Z","git_url":"git://github.com/giucam/lipstick.git","ssh_url":"git@github.com:giucam/lipstick.git","clone_url":"https://github.com/giucam/lipstick.git","svn_url":"https://github.com/giucam/lipstick","homepage":"","size":12646,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nemomobile:master","ref":"master","sha":"16160a96f2b31761e9b5e170ee89e8970cec0b09","user":{"login":"nemomobile","id":1088947,"avatar_url":"https://avatars.githubusercontent.com/u/1088947?v=3","gravatar_id":"","url":"https://api.github.com/users/nemomobile","html_url":"https://github.com/nemomobile","followers_url":"https://api.github.com/users/nemomobile/followers","following_url":"https://api.github.com/users/nemomobile/following{/other_user}","gists_url":"https://api.github.com/users/nemomobile/gists{/gist_id}","starred_url":"https://api.github.com/users/nemomobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemomobile/subscriptions","organizations_url":"https://api.github.com/users/nemomobile/orgs","repos_url":"https://api.github.com/users/nemomobile/repos","events_url":"https://api.github.com/users/nemomobile/events{/privacy}","received_events_url":"https://api.github.com/users/nemomobile/received_events","type":"Organization","site_admin":false},"repo":{"id":2480286,"name":"lipstick","full_name":"nemomobile/lipstick","owner":{"login":"nemomobile","id":1088947,"avatar_url":"https://avatars.githubusercontent.com/u/1088947?v=3","gravatar_id":"","url":"https://api.github.com/users/nemomobile","html_url":"https://github.com/nemomobile","followers_url":"https://api.github.com/users/nemomobile/followers","following_url":"https://api.github.com/users/nemomobile/following{/other_user}","gists_url":"https://api.github.com/users/nemomobile/gists{/gist_id}","starred_url":"https://api.github.com/users/nemomobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemomobile/subscriptions","organizations_url":"https://api.github.com/users/nemomobile/orgs","repos_url":"https://api.github.com/users/nemomobile/repos","events_url":"https://api.github.com/users/nemomobile/events{/privacy}","received_events_url":"https://api.github.com/users/nemomobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nemomobile/lipstick","description":"QML desktop","fork":false,"url":"https://api.github.com/repos/nemomobile/lipstick","forks_url":"https://api.github.com/repos/nemomobile/lipstick/forks","keys_url":"https://api.github.com/repos/nemomobile/lipstick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nemomobile/lipstick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nemomobile/lipstick/teams","hooks_url":"https://api.github.com/repos/nemomobile/lipstick/hooks","issue_events_url":"https://api.github.com/repos/nemomobile/lipstick/issues/events{/number}","events_url":"https://api.github.com/repos/nemomobile/lipstick/events","assignees_url":"https://api.github.com/repos/nemomobile/lipstick/assignees{/user}","branches_url":"https://api.github.com/repos/nemomobile/lipstick/branches{/branch}","tags_url":"https://api.github.com/repos/nemomobile/lipstick/tags","blobs_url":"https://api.github.com/repos/nemomobile/lipstick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nemomobile/lipstick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nemomobile/lipstick/git/refs{/sha}","trees_url":"https://api.github.com/repos/nemomobile/lipstick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nemomobile/lipstick/statuses/{sha}","languages_url":"https://api.github.com/repos/nemomobile/lipstick/languages","stargazers_url":"https://api.github.com/repos/nemomobile/lipstick/stargazers","contributors_url":"https://api.github.com/repos/nemomobile/lipstick/contributors","subscribers_url":"https://api.github.com/repos/nemomobile/lipstick/subscribers","subscription_url":"https://api.github.com/repos/nemomobile/lipstick/subscription","commits_url":"https://api.github.com/repos/nemomobile/lipstick/commits{/sha}","git_commits_url":"https://api.github.com/repos/nemomobile/lipstick/git/commits{/sha}","comments_url":"https://api.github.com/repos/nemomobile/lipstick/comments{/number}","issue_comment_url":"https://api.github.com/repos/nemomobile/lipstick/issues/comments{/number}","contents_url":"https://api.github.com/repos/nemomobile/lipstick/contents/{+path}","compare_url":"https://api.github.com/repos/nemomobile/lipstick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nemomobile/lipstick/merges","archive_url":"https://api.github.com/repos/nemomobile/lipstick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nemomobile/lipstick/downloads","issues_url":"https://api.github.com/repos/nemomobile/lipstick/issues{/number}","pulls_url":"https://api.github.com/repos/nemomobile/lipstick/pulls{/number}","milestones_url":"https://api.github.com/repos/nemomobile/lipstick/milestones{/number}","notifications_url":"https://api.github.com/repos/nemomobile/lipstick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nemomobile/lipstick/labels{/name}","releases_url":"https://api.github.com/repos/nemomobile/lipstick/releases{/id}","created_at":"2011-09-29T06:34:07Z","updated_at":"2015-03-24T06:03:01Z","pushed_at":"2015-03-24T06:03:20Z","git_url":"git://github.com/nemomobile/lipstick.git","ssh_url":"git@github.com:nemomobile/lipstick.git","clone_url":"https://github.com/nemomobile/lipstick.git","svn_url":"https://github.com/nemomobile/lipstick","homepage":"","size":15434,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":9,"forks":52,"open_issues":9,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/256"},"html":{"href":"https://github.com/nemomobile/lipstick/pull/256"},"issue":{"href":"https://api.github.com/repos/nemomobile/lipstick/issues/256"},"comments":{"href":"https://api.github.com/repos/nemomobile/lipstick/issues/256/comments"},"review_comments":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/256/comments"},"review_comment":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nemomobile/lipstick/pulls/256/commits"},"statuses":{"href":"https://api.github.com/repos/nemomobile/lipstick/statuses/0ac2f3d8e0df39d047f3ac3e7f9c80db93c9982f"}}}}