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

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

Issue 821663003: Change DebugCanvas API to not encourage memory leaks (Closed) Base URL: https://skia.googlesource.com/skia.git@debugger-raster-black-bg
Patch Set: ..nacl Created 5 years, 11 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
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | no next file » | 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 const SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() const { 383 const SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() const {
384 return fCommandVector; 384 return fCommandVector;
385 } 385 }
386 386
387 SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() { 387 SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
388 return fCommandVector; 388 return fCommandVector;
389 } 389 }
390 390
391 // TODO(chudy): Free command string memory.
392 SkTArray<SkString>* SkDebugCanvas::getDrawCommandsAsStrings() const {
393 SkTArray<SkString>* commandString = new SkTArray<SkString>(fCommandVector.co unt());
394 if (!fCommandVector.isEmpty()) {
395 for (int i = 0; i < fCommandVector.count(); i ++) {
396 commandString->push_back() = fCommandVector[i]->toString();
397 }
398 }
399 return commandString;
400 }
401
402 SkTDArray<size_t>* SkDebugCanvas::getDrawCommandOffsets() const {
403 SkTDArray<size_t>* commandOffsets = new SkTDArray<size_t>;
404 if (!fCommandVector.isEmpty()) {
405 for (int i = 0; i < fCommandVector.count(); i ++) {
406 *commandOffsets->push() = fCommandVector[i]->offset();
407 }
408 }
409 return commandOffsets;
410 }
411
412 void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::Fil terLevel level) { 391 void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::Fil terLevel level) {
413 if (NULL == fTexOverrideFilter) { 392 if (NULL == fTexOverrideFilter) {
414 fTexOverrideFilter = new SkTexOverrideFilter; 393 fTexOverrideFilter = new SkTexOverrideFilter;
415 } 394 }
416 395
417 fOverrideTexFiltering = overrideTexFiltering; 396 fOverrideTexFiltering = overrideTexFiltering;
418 fTexOverrideFilter->setFilterLevel(level); 397 fTexOverrideFilter->setFilterLevel(level);
419 } 398 }
420 399
421 void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyl e edgeStyle) { 400 void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyl e edgeStyle) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 686 }
708 687
709 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 688 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
710 if (fCalledAddStackData) { 689 if (fCalledAddStackData) {
711 fClipStackData.appendf("<br>"); 690 fClipStackData.appendf("<br>");
712 addPathData(devPath, "pathOut"); 691 addPathData(devPath, "pathOut");
713 return true; 692 return true;
714 } 693 }
715 return false; 694 return false;
716 } 695 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698