{"thread":{"id":"5957","subject":"[PATCH 2/2] Remove dead code after direct graph drawing","startedAt":"2006-10-19T14:13:18Z","lastAt":"2006-10-21T19:33:14Z","messageCount":7,"participants":["Josef Weidendorfer","Marco Costalba","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"29233","messageId":"200610191613.19142.Josef.Weidendorfer@gmx.de","threadId":"5957","inReplyTo":null,"subject":"[PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2006-10-19T14:13:18Z","receivedAt":"2006-10-19T14:13:18Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n---\n\nSorry, I forgot: this is on top of your public master as of today.\n\nJosef\n\n src/listview.cpp |   94 +-----------------------------------------------------\n src/listview.h   |    2 -\n 2 files changed, 1 insertions(+), 95 deletions(-)\n\ndiff --git a/src/listview.cpp b/src/listview.cpp\nindex 418836b..84cbfe9 100644\n--- a/src/listview.cpp\n+++ b/src/listview.cpp\n@@ -37,9 +37,6 @@ ListView::ListView(Domain* dm, Git* g, Q\n \tconnect(lv, SIGNAL(currentChanged(QListViewItem*)),\n \t        this, SLOT(on_currentChanged(QListViewItem*)));\n \n-\tconnect(lv, SIGNAL(contentsMoving(int,int)),\n-\t        this, SLOT(on_contentsMoving(int,int)));\n-\n \tconnect(lv, SIGNAL(mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),\n \t        this, SLOT(on_mouseButtonPressed(int,QListViewItem*,const QPoint&,int)));\n \n@@ -82,11 +79,6 @@ void ListView::setupListView() {\n \n void ListView::on_repaintListViews(QFont& f) {\n \n-\tQListViewItemIterator it(lv);\n-\twhile (it.current()) {\n-\t\tit.current()->setPixmap(GRAPH_COL, NULL);\n-\t\t++it;\n-\t}\n \tlv->setFont(f);\n \tlv->ensureItemVisible(lv->currentItem());\n }\n@@ -298,41 +290,6 @@ void ListView::on_contextMenuRequested(Q\n \temit contextMenu(((ListViewItem*)item)->sha(), POPUP_LIST_EV);\n }\n \n-void ListView::on_contentsMoving(int, int newY) {\n-// in case of very big archives pixmap memory can became huge.\n-// so we free pixmap memory for not visible items, avoiding\n-// traversing the list and using only the fast iterator\n-// itemBelow() and NOT the slower itemAbove()\n-\n-\tint ph = d->m()->gm.height();\n-\tint h = lv->visibleHeight();\n-\tif (lv->childCount() < h / ph + 10)\n-\t\treturn;\n-\n-\tint curY, dummy;\n-\tlv->viewportToContents(0, 0, dummy, curY);\n-\tint delta = newY - curY;\n-\tQListViewItem* item;\n-\tif (delta > 0)\n-\t\titem = lv->itemAt(QPoint(0, 0));\n-\telse {\n-\t\titem = lv->itemAt(QPoint(0, h + delta));\n-\t\tdelta = -delta;\n-\t\tif (item)\n-\t\t\titem = item->itemBelow();\n-\t}\n-\tif (item == NULL)\n-\t\treturn;\n-\n-\tint cnt = 0;\n-\tdelta /= ph;\n-\twhile (cnt++ < delta) {\n-\t\titem->setPixmap(GRAPH_COL, NULL); // free pixmap memory\n-\t\titem = item->itemBelow();\n-\t\tif (item == NULL)\n-\t\t\tbreak;\n-\t}\n-}\n \n bool ListView::eventFilter(QObject* obj, QEvent* ev) {\n // we need an event filter for:\n@@ -463,7 +420,6 @@ void ListViewItem::paintGraph(const Rev&\n     else\n \tp->fillRect( 0, 0, width, height(), cg.brush( crole ) );\n \t\n-    // Copy from getGraph(), modified to directly draw into cell\n     const QValueVector<int>& lanes(c.lanes);\n     uint laneNum = lanes.count();\n     int pw = pms[0]->width();\n@@ -507,19 +463,11 @@ void ListViewItem::paintCell(QPainter* p\n \tif (!populated)\n \t\tsetupData(c);\n \n-#if 1\n \tif (column == GRAPH_COL) {\n \t        paintGraph(c, p, _cg, width);\n \t\treturn;\n \t}\n-#else\n-\t// pixmap graph, separated from setupData to allow deleting\n-\tif (!pixmap(GRAPH_COL)) {\n-\t\tQPixmap* pm = getGraph(c);\n-\t\tsetPixmap(GRAPH_COL, *pm);\n-\t\tdelete pm;\n-\t}\n-#endif\n+\n \t// adjust for annotation id column presence\n \tint mycolumn = (fh) ? column : column + 1;\n \n@@ -655,46 +603,6 @@ const QString ListViewItem::timeDiff(uns\n \treturn tmp;\n }\n \n-QPixmap* ListViewItem::getGraph(const Rev& c) {\n-\n-\tconst QValueVector<int>& lanes(c.lanes);\n-\tuint laneNum = lanes.count();\n-\tint pw = pms[0]->width();\n-\tint ph = pms[0]->height();\n-\tQPixmap* pm = new QPixmap(pw * laneNum, ph);\n-\tpm->fill(ODD_LINE_COL); // faster then drawRect()\n-\tint mergeLane = -1;\n-\tfor (uint i = 0; i < laneNum; i++)\n-\t\tif (isMerge(lanes[i])) {\n-\t\t\tmergeLane = i;\n-\t\t\tbreak;\n-\t\t}\n-\tQPainter p;\n-\tp.begin(pm);\n-\tfor (uint i = 0; i < laneNum; i++) {\n-\n-\t\tint ln = lanes[i], idx;\n-\t\tif (ln == EMPTY)\n-\t\t\tcontinue;\n-\n-\t\tif (ln == CROSS)\n-\t\t\tidx = COLORS_NUM * (NOT_ACTIVE - 1);\n-\t\telse\n-\t\t\tidx = COLORS_NUM * (ln - 1);\n-\n-\t\tint col = (   isHead(ln) || isTail(ln) || isJoin(ln)\n-\t\t           || ln == CROSS_EMPTY) ? mergeLane : i;\n-\n-\t\tidx += col % COLORS_NUM;\n-\t\tp.drawPixmap(i * pw, 0, *pms[idx]);\n-\t\tif (ln == CROSS) {\n-\t\t\tidx = COLORS_NUM * (CROSS - 1) + mergeLane % COLORS_NUM;\n-\t\t\tp.drawPixmap(i * pw, 0, *pms[idx]);\n-\t\t}\n-\t}\n-\tp.end();\n-\treturn pm;\n-}\n \n // ***************** GraphMetrics related methods *********************\n \ndiff --git a/src/listview.h b/src/listview.h\nindex 25de935..5a49512 100644\n--- a/src/listview.h\n+++ b/src/listview.h\n@@ -34,7 +34,6 @@ public:\n private:\n \tvoid setupData(const Rev& c);\n \tvoid paintGraph(const Rev& c, QPainter *p, const QColorGroup &cg, int width);\n-\tQPixmap* getGraph(const Rev& c);\n \tvoid addTextPixmap(SCRef text, const QColor& color, bool bold = false);\n \tQPixmap* doAddTextPixmap(SCRef text, const QColor& color, int col, bool bold);\n \tconst QString timeDiff(unsigned long secs) const;\n@@ -80,7 +79,6 @@ private slots:\n \tvoid on_mouseButtonPressed(int, QListViewItem*, const QPoint&, int);\n \tvoid on_clicked(QListViewItem*);\n \tvoid on_onItem(QListViewItem*);\n-\tvoid on_contentsMoving(int, int newY);\n \n private:\n \tvoid setupListView();\n-- \n1.4.3.rc2.gf8ffb\n"},{"id":"29269","messageId":"200610200111.26259.Josef.Weidendorfer@gmx.de","threadId":"5957","inReplyTo":"200610191613.19142.Josef.Weidendorfer@gmx.de","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2006-10-19T23:11:26Z","receivedAt":"2006-10-19T23:11:26Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"On Thursday 19 October 2006 16:13, Josef Weidendorfer wrote:\n> Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n\nHmmm...\n\nIs the git mailing list the right place for qgit patches?\nProbably, I should have prefixed them with \"qgit:\" ...\n\nJosef\n"},{"id":"29335","messageId":"e5bfff550610200449j245f9014r984b8372fcd602d0@mail.gmail.com","threadId":"5957","inReplyTo":"200610200111.26259.Josef.Weidendorfer@gmx.de","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-10-20T11:49:17Z","receivedAt":"2006-10-20T11:49:17Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 10/20/06, Josef Weidendorfer <Josef.Weidendorfer@gmx.de> wrote:\n> On Thursday 19 October 2006 16:13, Josef Weidendorfer wrote:\n> > Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n>\n> Hmmm...\n>\n> Is the git mailing list the right place for qgit patches?\n\nYes, I don't see other competitors ;-)\n\n> Probably, I should have prefixed them with \"qgit:\" ...\n>\n\nNo problem, I should found them anyway and I don't need to manually\nremove \"qgit\" prefix before to apply to repository.\n"},{"id":"29381","messageId":"eharte$jq9$1@sea.gmane.org","threadId":"5957","inReplyTo":"e5bfff550610200449j245f9014r984b8372fcd602d0@mail.gmail.com","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-20T16:01:55Z","receivedAt":"2006-10-20T16:01:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Marco Costalba wrote:\n\n> On 10/20/06, Josef Weidendorfer <Josef.Weidendorfer@gmx.de> wrote:\n>> On Thursday 19 October 2006 16:13, Josef Weidendorfer wrote:\n>> > Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>\n>>\n>> Hmmm...\n>>\n>> Is the git mailing list the right place for qgit patches?\n> \n> Yes, I don't see other competitors ;-)\n> \n>> Probably, I should have prefixed them with \"qgit:\" ...\n\nOr use [PATCH (qgit)] or equivalent...\n \n> No problem, I should found them anyway and I don't need to manually\n> remove \"qgit\" prefix before to apply to repository.\n\n...which would be stripped automatically\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"29469","messageId":"e5bfff550610202335rcb83ea8mf7ec2dd79ec6dd90@mail.gmail.com","threadId":"5957","inReplyTo":"200610200111.26259.Josef.Weidendorfer@gmx.de","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-10-21T06:35:46Z","receivedAt":"2006-10-21T06:35:46Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"Josef,\n\n I think ther's a leak somewhere.\n\nChecking memory use with ksysguard is see memory use going up\nscrolling up and down also on the same revisions list view subset.\n\nI'm not sure it depends on your patch though.\n\nMarco\n"},{"id":"29504","messageId":"200610211740.26128.Josef.Weidendorfer@gmx.de","threadId":"5957","inReplyTo":"e5bfff550610202335rcb83ea8mf7ec2dd79ec6dd90@mail.gmail.com","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2006-10-21T15:40:25Z","receivedAt":"2006-10-21T15:40:25Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"On Saturday 21 October 2006 08:35, you wrote:\n> Josef,\n> \n>  I think ther's a leak somewhere.\n\nI am not really sure...\nI just scrolled up and down through\nthe kernel repo with the page up/down keys (around 34K revisions).\n\nOn the first pass down, the memory increases by around 26 MB,\nwhich could by correct, as you do setupData() lazy (no idea what\nthis function does...).\nOn the 2nd pass up again, I only get an increase of around 2 MB.\nThat could be other effects, as on further passes, I do not see\nany change with pure scrolling.\n\n> Checking memory use with ksysguard is see memory use going up\n> scrolling up and down also on the same revisions list view subset.\n> \n> I'm not sure it depends on your patch though.\n\nCan you compare with/without my patch?\nI have no idea what could have introduced any leak here. I do not\ncreate any new class instance / structures, but only get rid of pixmap\ncreations/deletions.\n\nHow did you check for leaks in the past?\nDid you try valgrind (memcheck or massif)?\n\nJosef\n\n> \n> Marco\n> \n> \n"},{"id":"29548","messageId":"e5bfff550610211233i1af1c6a5nf2d50a6759dab061@mail.gmail.com","threadId":"5957","inReplyTo":"200610211740.26128.Josef.Weidendorfer@gmx.de","subject":"Re: [PATCH 2/2] Remove dead code after direct graph drawing","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-10-21T19:33:14Z","receivedAt":"2006-10-21T19:33:14Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":">\n> On the first pass down, the memory increases by around 26 MB,\n> which could by correct, as you do setupData() lazy (no idea what\n> this function does...).\n\nPopulates the list view item and calculates (only calculation not\ndrawing) the graph of the item (see Git::updateLanes() )\n\n> >\n> > I'm not sure it depends on your patch though.\n>\n> Can you compare with/without my patch?\n\nYes. You are right, I have a memory increase also without your last patch.\n\n>\n> How did you check for leaks in the past?\n> Did you try valgrind (memcheck or massif)?\n>\n\nI tried with valgrind but with little success due to a lot of noise\nfrom qt libraries. Perhaps I was not using it right.\n\n\nSorry for the noise\n\nMarco\n"}]}