Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |