Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: debugger/SkDebugger.cpp

Issue 211383003: Debugger improvements (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix Mac 10.8 compilation issue Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « debugger/SkDebugger.h ('k') | src/utils/debugger/SkDebugCanvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkDebugger.h" 9 #include "SkDebugger.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 13 matching lines...) Expand all
24 SkSafeUnref(fDebugCanvas); 24 SkSafeUnref(fDebugCanvas);
25 SkSafeUnref(fPicture); 25 SkSafeUnref(fPicture);
26 } 26 }
27 27
28 void SkDebugger::loadPicture(SkPicture* picture) { 28 void SkDebugger::loadPicture(SkPicture* picture) {
29 fPictureWidth = picture->width(); 29 fPictureWidth = picture->width();
30 fPictureHeight = picture->height(); 30 fPictureHeight = picture->height();
31 delete fDebugCanvas; 31 delete fDebugCanvas;
32 fDebugCanvas = new SkDebugCanvas(fPictureWidth, fPictureHeight); 32 fDebugCanvas = new SkDebugCanvas(fPictureWidth, fPictureHeight);
33 fDebugCanvas->setBounds(fPictureWidth, fPictureHeight); 33 fDebugCanvas->setBounds(fPictureWidth, fPictureHeight);
34 fDebugCanvas->setPicture(picture);
34 picture->draw(fDebugCanvas); 35 picture->draw(fDebugCanvas);
36 fDebugCanvas->setPicture(NULL);
35 fIndex = fDebugCanvas->getSize() - 1; 37 fIndex = fDebugCanvas->getSize() - 1;
36 SkRefCnt_SafeAssign(fPicture, picture); 38 SkRefCnt_SafeAssign(fPicture, picture);
37 } 39 }
38 40
39 SkPicture* SkDebugger::copyPicture() { 41 SkPicture* SkDebugger::copyPicture() {
40 // We can't just call clone here since we want to removed the "deleted" 42 // We can't just call clone here since we want to removed the "deleted"
41 // commands. Playing back will strip those out. 43 // commands. Playing back will strip those out.
42 SkPicture* newPicture = new SkPicture; 44 SkPicture* newPicture = new SkPicture;
43 SkCanvas* canvas = newPicture->beginRecording(fPictureWidth, fPictureHeight) ; 45 SkCanvas* canvas = newPicture->beginRecording(fPictureWidth, fPictureHeight) ;
46
47 bool vizMode = fDebugCanvas->getMegaVizMode();
48 fDebugCanvas->setMegaVizMode(false);
49 bool overDraw = fDebugCanvas->getOverdrawViz();
50 fDebugCanvas->setOverdrawViz(false);
51 int saveCount = fDebugCanvas->getOutstandingSaveCount();
52 fDebugCanvas->setOutstandingSaveCount(0);
53
44 fDebugCanvas->draw(canvas); 54 fDebugCanvas->draw(canvas);
55
56 int temp = fDebugCanvas->getOutstandingSaveCount();
57 for (int i = 0; i < temp; ++i) {
58 canvas->restore();
59 }
60
61 fDebugCanvas->setMegaVizMode(vizMode);
62 fDebugCanvas->setOverdrawViz(overDraw);
63 fDebugCanvas->setOutstandingSaveCount(saveCount);
64
45 newPicture->endRecording(); 65 newPicture->endRecording();
46 return newPicture; 66 return newPicture;
47 } 67 }
48 68
49 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes, 69 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
50 double totTime, 70 double totTime,
51 SkString* overview, 71 SkString* overview,
52 int numRuns) { 72 int numRuns) {
53 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands(); 73 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands();
54 74
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 overview->insert(0, totalStr); 141 overview->insert(0, totalStr);
122 142
123 overview->append("<br/>"); 143 overview->append("<br/>");
124 overview->append("SkPicture Width: "); 144 overview->append("SkPicture Width: ");
125 overview->appendS32(pictureWidth()); 145 overview->appendS32(pictureWidth());
126 overview->append("px<br/>"); 146 overview->append("px<br/>");
127 overview->append("SkPicture Height: "); 147 overview->append("SkPicture Height: ");
128 overview->appendS32(pictureHeight()); 148 overview->appendS32(pictureHeight());
129 overview->append("px"); 149 overview->append("px");
130 } 150 }
OLDNEW
« no previous file with comments | « debugger/SkDebugger.h ('k') | src/utils/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698