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

Side by Side Diff: src/utils/debugger/SkDebugCanvas.cpp

Issue 794263002: Cull pushCull and popCull from Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix debugger Created 6 years 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
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | src/utils/debugger/SkDrawCommand.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 9
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SkCanvas* fCanvas; 202 SkCanvas* fCanvas;
203 203
204 private: 204 private:
205 typedef SkCanvas::ClipVisitor INHERITED; 205 typedef SkCanvas::ClipVisitor INHERITED;
206 }; 206 };
207 207
208 // set up the saveLayer commands so that the active ones 208 // set up the saveLayer commands so that the active ones
209 // return true in their 'active' method 209 // return true in their 'active' method
210 void SkDebugCanvas::markActiveCommands(int index) { 210 void SkDebugCanvas::markActiveCommands(int index) {
211 fActiveLayers.rewind(); 211 fActiveLayers.rewind();
212 fActiveCulls.rewind();
213 212
214 for (int i = 0; i < fCommandVector.count(); ++i) { 213 for (int i = 0; i < fCommandVector.count(); ++i) {
215 fCommandVector[i]->setActive(false); 214 fCommandVector[i]->setActive(false);
216 } 215 }
217 216
218 for (int i = 0; i < index; ++i) { 217 for (int i = 0; i < index; ++i) {
219 SkDrawCommand::Action result = fCommandVector[i]->action(); 218 SkDrawCommand::Action result = fCommandVector[i]->action();
220 if (SkDrawCommand::kPushLayer_Action == result) { 219 if (SkDrawCommand::kPushLayer_Action == result) {
221 fActiveLayers.push(fCommandVector[i]); 220 fActiveLayers.push(fCommandVector[i]);
222 } else if (SkDrawCommand::kPopLayer_Action == result) { 221 } else if (SkDrawCommand::kPopLayer_Action == result) {
223 fActiveLayers.pop(); 222 fActiveLayers.pop();
224 } else if (SkDrawCommand::kPushCull_Action == result) {
225 fActiveCulls.push(fCommandVector[i]);
226 } else if (SkDrawCommand::kPopCull_Action == result) {
227 fActiveCulls.pop();
228 } 223 }
229 } 224 }
230 225
231 for (int i = 0; i < fActiveLayers.count(); ++i) { 226 for (int i = 0; i < fActiveLayers.count(); ++i) {
232 fActiveLayers[i]->setActive(true); 227 fActiveLayers[i]->setActive(true);
233 } 228 }
234 229
235 for (int i = 0; i < fActiveCulls.count(); ++i) {
236 fActiveCulls[i]->setActive(true);
237 }
238 } 230 }
239 231
240 void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { 232 void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
241 SkASSERT(!fCommandVector.isEmpty()); 233 SkASSERT(!fCommandVector.isEmpty());
242 SkASSERT(index < fCommandVector.count()); 234 SkASSERT(index < fCommandVector.count());
243 int i = 0; 235 int i = 0;
244 236
245 bool pathOpsMode = getAllowSimplifyClip(); 237 bool pathOpsMode = getAllowSimplifyClip();
246 canvas->setAllowSimplifyClip(pathOpsMode); 238 canvas->setAllowSimplifyClip(pathOpsMode);
247 // This only works assuming the canvas and device are the same ones that 239 // This only works assuming the canvas and device are the same ones that
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } else { 300 } else {
309 fCommandVector[i]->setUserMatrix(fUserMatrix); 301 fCommandVector[i]->setUserMatrix(fUserMatrix);
310 fCommandVector[i]->execute(canvas); 302 fCommandVector[i]->execute(canvas);
311 } 303 }
312 304
313 fCommandVector[i]->trackSaveState(&fOutstandingSaveCount); 305 fCommandVector[i]->trackSaveState(&fOutstandingSaveCount);
314 } 306 }
315 } 307 }
316 308
317 if (fMegaVizMode) { 309 if (fMegaVizMode) {
318 SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth), 310 SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth),
319 SkIntToScalar(fWindowSize.fHeight)); 311 SkIntToScalar(fWindowSize.fHeight));
320 r.outset(SK_Scalar1, SK_Scalar1); 312 r.outset(SK_Scalar1, SK_Scalar1);
321 313
322 canvas->save(); 314 canvas->save();
323 // nuke the CTM 315 // nuke the CTM
324 canvas->resetMatrix(); 316 canvas->resetMatrix();
325 // turn off clipping 317 // turn off clipping
326 canvas->clipRect(r, SkRegion::kReplace_Op); 318 canvas->clipRect(r, SkRegion::kReplace_Op);
327 319
328 // visualize existing clips 320 // visualize existing clips
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 490 }
499 491
500 void SkDebugCanvas::drawPaint(const SkPaint& paint) { 492 void SkDebugCanvas::drawPaint(const SkPaint& paint) {
501 this->addDrawCommand(new SkDrawPaintCommand(paint)); 493 this->addDrawCommand(new SkDrawPaintCommand(paint));
502 } 494 }
503 495
504 void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) { 496 void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
505 this->addDrawCommand(new SkDrawPathCommand(path, paint)); 497 this->addDrawCommand(new SkDrawPathCommand(path, paint));
506 } 498 }
507 499
508 void SkDebugCanvas::onDrawPicture(const SkPicture* picture, 500 void SkDebugCanvas::onDrawPicture(const SkPicture* picture,
509 const SkMatrix* matrix, 501 const SkMatrix* matrix,
510 const SkPaint* paint) { 502 const SkPaint* paint) {
511 this->addDrawCommand(new SkDrawPictureCommand(picture, matrix, paint)); 503 this->addDrawCommand(new SkDrawPictureCommand(picture, matrix, paint));
512 } 504 }
513 505
514 void SkDebugCanvas::drawPoints(PointMode mode, size_t count, 506 void SkDebugCanvas::drawPoints(PointMode mode, size_t count,
515 const SkPoint pts[], const SkPaint& paint) { 507 const SkPoint pts[], const SkPaint& paint) {
516 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); 508 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint));
517 } 509 }
518 510
519 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP oint pos[], 511 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP oint pos[],
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 555 }
564 556
565 void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount, 557 void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount,
566 const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], 558 const SkPoint vertices[], const SkPoint texs[], const SkColor colors[],
567 SkXfermode*, const uint16_t indices[], int indexCount, 559 SkXfermode*, const uint16_t indices[], int indexCount,
568 const SkPaint& paint) { 560 const SkPaint& paint) {
569 this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices, 561 this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
570 texs, colors, NULL, indices, indexCount, paint)); 562 texs, colors, NULL, indices, indexCount, paint));
571 } 563 }
572 564
573 void SkDebugCanvas::onPushCull(const SkRect& cullRect) {
574 this->addDrawCommand(new SkPushCullCommand(cullRect));
575 }
576
577 void SkDebugCanvas::onPopCull() {
578 this->addDrawCommand(new SkPopCullCommand());
579 }
580
581 void SkDebugCanvas::willRestore() { 565 void SkDebugCanvas::willRestore() {
582 this->addDrawCommand(new SkRestoreCommand()); 566 this->addDrawCommand(new SkRestoreCommand());
583 this->INHERITED::willRestore(); 567 this->INHERITED::willRestore();
584 } 568 }
585 569
586 void SkDebugCanvas::willSave() { 570 void SkDebugCanvas::willSave() {
587 this->addDrawCommand(new SkSaveCommand()); 571 this->addDrawCommand(new SkSaveCommand());
588 this->INHERITED::willSave(); 572 this->INHERITED::willSave();
589 } 573 }
590 574
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 707 }
724 708
725 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 709 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
726 if (fCalledAddStackData) { 710 if (fCalledAddStackData) {
727 fClipStackData.appendf("<br>"); 711 fClipStackData.appendf("<br>");
728 addPathData(devPath, "pathOut"); 712 addPathData(devPath, "pathOut");
729 return true; 713 return true;
730 } 714 }
731 return false; 715 return false;
732 } 716 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | src/utils/debugger/SkDrawCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698