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

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: 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') | 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. 391 void SkDebugCanvas::getDrawCommandsAsStrings(SkTArray<SkString>* outCommands) co nst {
392 SkTArray<SkString>* SkDebugCanvas::getDrawCommandsAsStrings() const { 392 outCommands->resize_back(fCommandVector.count());
393 SkTArray<SkString>* commandString = new SkTArray<SkString>(fCommandVector.co unt());
394 if (!fCommandVector.isEmpty()) { 393 if (!fCommandVector.isEmpty()) {
395 for (int i = 0; i < fCommandVector.count(); i ++) { 394 for (int i = 0; i < fCommandVector.count(); i ++) {
396 commandString->push_back() = fCommandVector[i]->toString(); 395 (*outCommands)[i] = fCommandVector[i]->toString();
397 } 396 }
398 } 397 }
robertphillips 2014/12/22 15:25:36 else { outCommands->reset(); } ??
Kimmo Kinnunen 2014/12/29 07:23:13 it tried to do that with resize_back(count), in ca
399 return commandString;
400 } 398 }
401 399
402 SkTDArray<size_t>* SkDebugCanvas::getDrawCommandOffsets() const { 400 void SkDebugCanvas::getDrawCommandOffsets(SkTDArray<size_t>* outCommandOffsets) const {
403 SkTDArray<size_t>* commandOffsets = new SkTDArray<size_t>;
404 if (!fCommandVector.isEmpty()) { 401 if (!fCommandVector.isEmpty()) {
402 outCommandOffsets->setCount(fCommandVector.count());
405 for (int i = 0; i < fCommandVector.count(); i ++) { 403 for (int i = 0; i < fCommandVector.count(); i ++) {
406 *commandOffsets->push() = fCommandVector[i]->offset(); 404 (*outCommandOffsets)[i] = fCommandVector[i]->offset();
407 } 405 }
406 } else {
407 outCommandOffsets->reset();
408 } 408 }
409 return commandOffsets;
410 } 409 }
411 410
412 void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::Fil terLevel level) { 411 void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::Fil terLevel level) {
413 if (NULL == fTexOverrideFilter) { 412 if (NULL == fTexOverrideFilter) {
414 fTexOverrideFilter = new SkTexOverrideFilter; 413 fTexOverrideFilter = new SkTexOverrideFilter;
415 } 414 }
416 415
417 fOverrideTexFiltering = overrideTexFiltering; 416 fOverrideTexFiltering = overrideTexFiltering;
418 fTexOverrideFilter->setFilterLevel(level); 417 fTexOverrideFilter->setFilterLevel(level);
419 } 418 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 706 }
708 707
709 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 708 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
710 if (fCalledAddStackData) { 709 if (fCalledAddStackData) {
711 fClipStackData.appendf("<br>"); 710 fClipStackData.appendf("<br>");
712 addPathData(devPath, "pathOut"); 711 addPathData(devPath, "pathOut");
713 return true; 712 return true;
714 } 713 }
715 return false; 714 return false;
716 } 715 }
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