GitHub PullRequestReviewCommentEvent at 2014-08-08 18:08:40
Repository: residualvm
Actor: somaen
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/residualvm/residualvm/pulls/comments/16007396","id":16007396,"diff_hunk":"@@ -0,0 +1,677 @@\n+#include \"graphics/tinygl/zdirtyrect.h\"\n+#include \"graphics/tinygl/zgl.h\"\n+#include \"graphics/tinygl/gl.h\"\n+#include \"common/debug.h\"\n+\n+namespace TinyGL {\n+\n+void tglIssueDrawCall(Graphics::DrawCall *drawCall) {\n+\tTinyGL::GLContext *c = TinyGL::gl_get_context();\n+\tc->_drawCallsQueue.push_back(drawCall);\n+}\n+\n+} // end of namespace TinyGL\n+\n+\n+void tglDrawRectangle(Common::Rect rect, int r, int g, int b) {\n+\tTinyGL::GLContext *c = TinyGL::gl_get_context();\n+\n+\tif (rect.left < 0)\n+\t\trect.left = 0;\n+\tif (rect.right >= c->fb->xsize) \n+\t\trect.right = c->fb->xsize - 1;\n+\tif (rect.top < 0)\n+\t\trect.top = 0;\n+\tif (rect.bottom >= c->fb->ysize) \n+\t\trect.bottom = c->fb->ysize - 1;\n+\n+\tfor(int x = rect.left; x < rect.right; x++) {\n+\t\tc->fb->writePixel(rect.top * c->fb->xsize + x, 255, r, g, b);\n+\t\tc->fb->writePixel(rect.bottom * c->fb->xsize + x, 255, r, g, b);\n+\t}\n+\tfor(int y = rect.top; y < rect.bottom; y++) {\n+\t\tc->fb->writePixel(y * c->fb->xsize + rect.left, 255, r, g, b);\n+\t\tc->fb->writePixel(y * c->fb->xsize + rect.right, 255, r, g, b);\n+\t}\n+}\n+\n+struct DirtyRectangle {\n+\tCommon::Rect rectangle;\n+\tint r, g, b;\n+\n+\tDirtyRectangle() { }\n+\tDirtyRectangle(Common::Rect rect, int red, int green, int blue) {\n+\t\tthis->rectangle = rect;\n+\t\tthis->r = red;\n+\t\tthis->g = green;\n+\t\tthis->b = blue;\n+\t}\n+};\n+\n+void tglPresentBuffer() {\n+\tTinyGL::GLContext *c = TinyGL::gl_get_context();\n+\n+\tCommon::List<DirtyRectangle> rectangles;\n+\n+\tCommon::List<Graphics::DrawCall *>::const_iterator itFrame = c->_drawCallsQueue.begin();\n+\tCommon::List<Graphics::DrawCall *>::const_iterator endFrame = c->_drawCallsQueue.end();\n+\n+\tCommon::List<Graphics::DrawCall *>::const_iterator itPrevFrame = c->_previousFrameDrawCallsQueue.begin();\n+\tCommon::List<Graphics::DrawCall *>::const_iterator endPrevFrame = c->_previousFrameDrawCallsQueue.end();\n+\t\n+\t// Compare draw calls.\n+\tif (itFrame != endFrame) {\n+\t\twhile (itPrevFrame != endPrevFrame) {\n+\t\t\tconst Graphics::DrawCall &currentCall = **itFrame;\n+\t\t\tconst Graphics::DrawCall &previousCall = **itPrevFrame;\n+\n+\t\t\tif (!(previousCall == currentCall)) {\n+\t\t\t\twhile (itPrevFrame != endPrevFrame) {\n+\t\t\t\t\tGraphics::DrawCall *dirtyDrawCall = *itPrevFrame;\n+\t\t\t\t\trectangles.push_back(DirtyRectangle(dirtyDrawCall->getDirtyRegion(), 255, 255, 255));\n+\t\t\t\t\t++itPrevFrame;\n+\t\t\t\t}\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\t++itFrame;\n+\t\t\t++itPrevFrame;\n+\t\t}\n+\t}\n+\n+\twhile (itFrame != endFrame) {\n+\t\tconst Graphics::DrawCall &currentCall = **itFrame;\n+\t\trectangles.push_back(DirtyRectangle(currentCall.getDirtyRegion(), 255, 0, 0));\n+\t\t++itFrame;\n+\t}\n+\n+\tCommon::List<DirtyRectangle>::iterator it1, it2, itRectangles;","path":"graphics/tinygl/zdirtyrect.cpp","position":88,"original_position":88,"commit_id":"808e2ede6a801ebcfa016b44d291bae34bcfdb86","original_commit_id":"808e2ede6a801ebcfa016b44d291bae34bcfdb86","user":{"login":"somaen","id":543402,"avatar_url":"https://avatars.githubusercontent.com/u/543402?v=2","gravatar_id":"56a5794477b5e955b43be3eac341b358","url":"https://api.github.com/users/somaen","html_url":"https://github.com/somaen","followers_url":"https://api.github.com/users/somaen/followers","following_url":"https://api.github.com/users/somaen/following{/other_user}","gists_url":"https://api.github.com/users/somaen/gists{/gist_id}","starred_url":"https://api.github.com/users/somaen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somaen/subscriptions","organizations_url":"https://api.github.com/users/somaen/orgs","repos_url":"https://api.github.com/users/somaen/repos","events_url":"https://api.github.com/users/somaen/events{/privacy}","received_events_url":"https://api.github.com/users/somaen/received_events","type":"User","site_admin":false},"body":"Declare these at first use, if you find the type name long to write, consider a typedef.","created_at":"2014-08-08T18:08:40Z","updated_at":"2014-08-08T18:08:40Z","html_url":"https://github.com/residualvm/residualvm/pull/1002#discussion_r16007396","pull_request_url":"https://api.github.com/repos/residualvm/residualvm/pulls/1002","_links":{"self":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/comments/16007396"},"html":{"href":"https://github.com/residualvm/residualvm/pull/1002#discussion_r16007396"},"pull_request":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/1002"}}},"pull_request":{"url":"https://api.github.com/repos/residualvm/residualvm/pulls/1002","id":19477232,"html_url":"https://github.com/residualvm/residualvm/pull/1002","diff_url":"https://github.com/residualvm/residualvm/pull/1002.diff","patch_url":"https://github.com/residualvm/residualvm/pull/1002.patch","issue_url":"https://api.github.com/repos/residualvm/residualvm/issues/1002","number":1002,"state":"open","title":"TINYGL: Dirty rects system.","user":{"login":"subr3v","id":5153412,"avatar_url":"https://avatars.githubusercontent.com/u/5153412?v=2","gravatar_id":"76c3bbee0e912b0afd37d1d3c7ffbcdc","url":"https://api.github.com/users/subr3v","html_url":"https://github.com/subr3v","followers_url":"https://api.github.com/users/subr3v/followers","following_url":"https://api.github.com/users/subr3v/following{/other_user}","gists_url":"https://api.github.com/users/subr3v/gists{/gist_id}","starred_url":"https://api.github.com/users/subr3v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subr3v/subscriptions","organizations_url":"https://api.github.com/users/subr3v/orgs","repos_url":"https://api.github.com/users/subr3v/repos","events_url":"https://api.github.com/users/subr3v/events{/privacy}","received_events_url":"https://api.github.com/users/subr3v/received_events","type":"User","site_admin":false},"body":"This PR contains an implementation of dirty rects system.\r\nYou can find more information behind the design and implementation in the following blog posts: \r\nhttp://subr3v.blogspot.co.uk/\r\n","created_at":"2014-08-07T16:14:58Z","updated_at":"2014-08-08T18:08:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1b5ba12de89c8744231c0c86c516705fa1cda37","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/residualvm/residualvm/pulls/1002/commits","review_comments_url":"https://api.github.com/repos/residualvm/residualvm/pulls/1002/comments","review_comment_url":"https://api.github.com/repos/residualvm/residualvm/pulls/comments/{number}","comments_url":"https://api.github.com/repos/residualvm/residualvm/issues/1002/comments","statuses_url":"https://api.github.com/repos/residualvm/residualvm/statuses/808e2ede6a801ebcfa016b44d291bae34bcfdb86","head":{"label":"subr3v:tinygl-dirty-rects","ref":"tinygl-dirty-rects","sha":"808e2ede6a801ebcfa016b44d291bae34bcfdb86","user":{"login":"subr3v","id":5153412,"avatar_url":"https://avatars.githubusercontent.com/u/5153412?v=2","gravatar_id":"76c3bbee0e912b0afd37d1d3c7ffbcdc","url":"https://api.github.com/users/subr3v","html_url":"https://github.com/subr3v","followers_url":"https://api.github.com/users/subr3v/followers","following_url":"https://api.github.com/users/subr3v/following{/other_user}","gists_url":"https://api.github.com/users/subr3v/gists{/gist_id}","starred_url":"https://api.github.com/users/subr3v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subr3v/subscriptions","organizations_url":"https://api.github.com/users/subr3v/orgs","repos_url":"https://api.github.com/users/subr3v/repos","events_url":"https://api.github.com/users/subr3v/events{/privacy}","received_events_url":"https://api.github.com/users/subr3v/received_events","type":"User","site_admin":false},"repo":{"id":19983316,"name":"residualvm","full_name":"subr3v/residualvm","owner":{"login":"subr3v","id":5153412,"avatar_url":"https://avatars.githubusercontent.com/u/5153412?v=2","gravatar_id":"76c3bbee0e912b0afd37d1d3c7ffbcdc","url":"https://api.github.com/users/subr3v","html_url":"https://github.com/subr3v","followers_url":"https://api.github.com/users/subr3v/followers","following_url":"https://api.github.com/users/subr3v/following{/other_user}","gists_url":"https://api.github.com/users/subr3v/gists{/gist_id}","starred_url":"https://api.github.com/users/subr3v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subr3v/subscriptions","organizations_url":"https://api.github.com/users/subr3v/orgs","repos_url":"https://api.github.com/users/subr3v/repos","events_url":"https://api.github.com/users/subr3v/events{/privacy}","received_events_url":"https://api.github.com/users/subr3v/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/subr3v/residualvm","description":"ResidualVM main repository","fork":true,"url":"https://api.github.com/repos/subr3v/residualvm","forks_url":"https://api.github.com/repos/subr3v/residualvm/forks","keys_url":"https://api.github.com/repos/subr3v/residualvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/subr3v/residualvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/subr3v/residualvm/teams","hooks_url":"https://api.github.com/repos/subr3v/residualvm/hooks","issue_events_url":"https://api.github.com/repos/subr3v/residualvm/issues/events{/number}","events_url":"https://api.github.com/repos/subr3v/residualvm/events","assignees_url":"https://api.github.com/repos/subr3v/residualvm/assignees{/user}","branches_url":"https://api.github.com/repos/subr3v/residualvm/branches{/branch}","tags_url":"https://api.github.com/repos/subr3v/residualvm/tags","blobs_url":"https://api.github.com/repos/subr3v/residualvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/subr3v/residualvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/subr3v/residualvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/subr3v/residualvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/subr3v/residualvm/statuses/{sha}","languages_url":"https://api.github.com/repos/subr3v/residualvm/languages","stargazers_url":"https://api.github.com/repos/subr3v/residualvm/stargazers","contributors_url":"https://api.github.com/repos/subr3v/residualvm/contributors","subscribers_url":"https://api.github.com/repos/subr3v/residualvm/subscribers","subscription_url":"https://api.github.com/repos/subr3v/residualvm/subscription","commits_url":"https://api.github.com/repos/subr3v/residualvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/subr3v/residualvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/subr3v/residualvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/subr3v/residualvm/issues/comments/{number}","contents_url":"https://api.github.com/repos/subr3v/residualvm/contents/{+path}","compare_url":"https://api.github.com/repos/subr3v/residualvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/subr3v/residualvm/merges","archive_url":"https://api.github.com/repos/subr3v/residualvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/subr3v/residualvm/downloads","issues_url":"https://api.github.com/repos/subr3v/residualvm/issues{/number}","pulls_url":"https://api.github.com/repos/subr3v/residualvm/pulls{/number}","milestones_url":"https://api.github.com/repos/subr3v/residualvm/milestones{/number}","notifications_url":"https://api.github.com/repos/subr3v/residualvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/subr3v/residualvm/labels{/name}","releases_url":"https://api.github.com/repos/subr3v/residualvm/releases{/id}","created_at":"2014-05-20T14:07:24Z","updated_at":"2014-06-28T16:54:22Z","pushed_at":"2014-08-08T11:10:13Z","git_url":"git://github.com/subr3v/residualvm.git","ssh_url":"git@github.com:subr3v/residualvm.git","clone_url":"https://github.com/subr3v/residualvm.git","svn_url":"https://github.com/subr3v/residualvm","homepage":"http://residualvm.org","size":21157,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"residualvm:master","ref":"master","sha":"79354c42c49f39d3dd93a353bfd20e22a15e9b20","user":{"login":"residualvm","id":679821,"avatar_url":"https://avatars.githubusercontent.com/u/679821?v=2","gravatar_id":"7761a5514fdb424dc90679c290363355","url":"https://api.github.com/users/residualvm","html_url":"https://github.com/residualvm","followers_url":"https://api.github.com/users/residualvm/followers","following_url":"https://api.github.com/users/residualvm/following{/other_user}","gists_url":"https://api.github.com/users/residualvm/gists{/gist_id}","starred_url":"https://api.github.com/users/residualvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/residualvm/subscriptions","organizations_url":"https://api.github.com/users/residualvm/orgs","repos_url":"https://api.github.com/users/residualvm/repos","events_url":"https://api.github.com/users/residualvm/events{/privacy}","received_events_url":"https://api.github.com/users/residualvm/received_events","type":"Organization","site_admin":false},"repo":{"id":1503443,"name":"residualvm","full_name":"residualvm/residualvm","owner":{"login":"residualvm","id":679821,"avatar_url":"https://avatars.githubusercontent.com/u/679821?v=2","gravatar_id":"7761a5514fdb424dc90679c290363355","url":"https://api.github.com/users/residualvm","html_url":"https://github.com/residualvm","followers_url":"https://api.github.com/users/residualvm/followers","following_url":"https://api.github.com/users/residualvm/following{/other_user}","gists_url":"https://api.github.com/users/residualvm/gists{/gist_id}","starred_url":"https://api.github.com/users/residualvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/residualvm/subscriptions","organizations_url":"https://api.github.com/users/residualvm/orgs","repos_url":"https://api.github.com/users/residualvm/repos","events_url":"https://api.github.com/users/residualvm/events{/privacy}","received_events_url":"https://api.github.com/users/residualvm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/residualvm/residualvm","description":"ResidualVM main repository","fork":false,"url":"https://api.github.com/repos/residualvm/residualvm","forks_url":"https://api.github.com/repos/residualvm/residualvm/forks","keys_url":"https://api.github.com/repos/residualvm/residualvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/residualvm/residualvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/residualvm/residualvm/teams","hooks_url":"https://api.github.com/repos/residualvm/residualvm/hooks","issue_events_url":"https://api.github.com/repos/residualvm/residualvm/issues/events{/number}","events_url":"https://api.github.com/repos/residualvm/residualvm/events","assignees_url":"https://api.github.com/repos/residualvm/residualvm/assignees{/user}","branches_url":"https://api.github.com/repos/residualvm/residualvm/branches{/branch}","tags_url":"https://api.github.com/repos/residualvm/residualvm/tags","blobs_url":"https://api.github.com/repos/residualvm/residualvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/residualvm/residualvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/residualvm/residualvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/residualvm/residualvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/residualvm/residualvm/statuses/{sha}","languages_url":"https://api.github.com/repos/residualvm/residualvm/languages","stargazers_url":"https://api.github.com/repos/residualvm/residualvm/stargazers","contributors_url":"https://api.github.com/repos/residualvm/residualvm/contributors","subscribers_url":"https://api.github.com/repos/residualvm/residualvm/subscribers","subscription_url":"https://api.github.com/repos/residualvm/residualvm/subscription","commits_url":"https://api.github.com/repos/residualvm/residualvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/residualvm/residualvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/residualvm/residualvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/residualvm/residualvm/issues/comments/{number}","contents_url":"https://api.github.com/repos/residualvm/residualvm/contents/{+path}","compare_url":"https://api.github.com/repos/residualvm/residualvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/residualvm/residualvm/merges","archive_url":"https://api.github.com/repos/residualvm/residualvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/residualvm/residualvm/downloads","issues_url":"https://api.github.com/repos/residualvm/residualvm/issues{/number}","pulls_url":"https://api.github.com/repos/residualvm/residualvm/pulls{/number}","milestones_url":"https://api.github.com/repos/residualvm/residualvm/milestones{/number}","notifications_url":"https://api.github.com/repos/residualvm/residualvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/residualvm/residualvm/labels{/name}","releases_url":"https://api.github.com/repos/residualvm/residualvm/releases{/id}","created_at":"2011-03-20T15:50:51Z","updated_at":"2014-08-08T01:50:48Z","pushed_at":"2014-08-07T17:32:00Z","git_url":"git://github.com/residualvm/residualvm.git","ssh_url":"git@github.com:residualvm/residualvm.git","clone_url":"https://github.com/residualvm/residualvm.git","svn_url":"https://github.com/residualvm/residualvm","homepage":"http://residualvm.org","size":29251,"stargazers_count":145,"watchers_count":145,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":62,"mirror_url":null,"open_issues_count":115,"forks":62,"open_issues":115,"watchers":145,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/1002"},"html":{"href":"https://github.com/residualvm/residualvm/pull/1002"},"issue":{"href":"https://api.github.com/repos/residualvm/residualvm/issues/1002"},"comments":{"href":"https://api.github.com/repos/residualvm/residualvm/issues/1002/comments"},"review_comments":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/1002/comments"},"review_comment":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/residualvm/residualvm/pulls/1002/commits"},"statuses":{"href":"https://api.github.com/repos/residualvm/residualvm/statuses/808e2ede6a801ebcfa016b44d291bae34bcfdb86"}}}}