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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/android/SkAndroidSDKCanvas.cpp ('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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkClipStack.h" 8 #include "SkClipStack.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkDebugCanvas.h" 10 #include "SkDebugCanvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 idx = 7 - (SkColorGetB(dst)+21)/42; 43 idx = 7 - (SkColorGetB(dst)+21)/42;
44 } else { // 7-9 44 } else { // 7-9
45 idx = 10 - (SkColorGetG(dst)+22)/45; 45 idx = 10 - (SkColorGetG(dst)+22)/45;
46 } 46 }
47 ++idx; 47 ++idx;
48 SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable)); 48 SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable));
49 49
50 return gTable[idx]; 50 return gTable[idx];
51 } 51 }
52 52
53 Factory getFactory() const override { return NULL; } 53 Factory getFactory() const override { return nullptr; }
54 #ifndef SK_IGNORE_TO_STRING 54 #ifndef SK_IGNORE_TO_STRING
55 void toString(SkString* str) const override { str->set("OverdrawXfermode"); } 55 void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
56 #endif 56 #endif
57 }; 57 };
58 58
59 class DebugPaintFilterCanvas : public SkPaintFilterCanvas { 59 class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
60 public: 60 public:
61 DebugPaintFilterCanvas(int width, 61 DebugPaintFilterCanvas(int width,
62 int height, 62 int height,
63 bool overdrawViz, 63 bool overdrawViz,
64 bool overrideFilterQuality, 64 bool overrideFilterQuality,
65 SkFilterQuality quality) 65 SkFilterQuality quality)
66 : INHERITED(width, height) 66 : INHERITED(width, height)
67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : NULL) 67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr)
68 , fOverrideFilterQuality(overrideFilterQuality) 68 , fOverrideFilterQuality(overrideFilterQuality)
69 , fFilterQuality(quality) {} 69 , fFilterQuality(quality) {}
70 70
71 protected: 71 protected:
72 void onFilterPaint(SkPaint* paint, Type) const override { 72 void onFilterPaint(SkPaint* paint, Type) const override {
73 if (NULL != fOverdrawXfermode.get()) { 73 if (nullptr != fOverdrawXfermode.get()) {
74 paint->setAntiAlias(false); 74 paint->setAntiAlias(false);
75 paint->setXfermode(fOverdrawXfermode.get()); 75 paint->setXfermode(fOverdrawXfermode.get());
76 } 76 }
77 77
78 if (fOverrideFilterQuality) { 78 if (fOverrideFilterQuality) {
79 paint->setFilterQuality(fFilterQuality); 79 paint->setFilterQuality(fFilterQuality);
80 } 80 }
81 } 81 }
82 82
83 void onDrawPicture(const SkPicture* picture, 83 void onDrawPicture(const SkPicture* picture,
84 const SkMatrix* matrix, 84 const SkMatrix* matrix,
85 const SkPaint* paint) override { 85 const SkPaint* paint) override {
86 // We need to replay the picture onto this canvas in order to filter its internal paints. 86 // We need to replay the picture onto this canvas in order to filter its internal paints.
87 this->SkCanvas::onDrawPicture(picture, matrix, paint); 87 this->SkCanvas::onDrawPicture(picture, matrix, paint);
88 } 88 }
89 89
90 private: 90 private:
91 SkAutoTUnref<SkXfermode> fOverdrawXfermode; 91 SkAutoTUnref<SkXfermode> fOverdrawXfermode;
92 92
93 bool fOverrideFilterQuality; 93 bool fOverrideFilterQuality;
94 SkFilterQuality fFilterQuality; 94 SkFilterQuality fFilterQuality;
95 95
96 typedef SkPaintFilterCanvas INHERITED; 96 typedef SkPaintFilterCanvas INHERITED;
97 }; 97 };
98 98
99 } 99 }
100 100
101 SkDebugCanvas::SkDebugCanvas(int width, int height) 101 SkDebugCanvas::SkDebugCanvas(int width, int height)
102 : INHERITED(width, height) 102 : INHERITED(width, height)
103 , fPicture(NULL) 103 , fPicture(nullptr)
104 , fFilter(false) 104 , fFilter(false)
105 , fMegaVizMode(false) 105 , fMegaVizMode(false)
106 , fOverdrawViz(false) 106 , fOverdrawViz(false)
107 , fOverrideFilterQuality(false) 107 , fOverrideFilterQuality(false)
108 , fFilterQuality(kNone_SkFilterQuality) { 108 , fFilterQuality(kNone_SkFilterQuality) {
109 fUserMatrix.reset(); 109 fUserMatrix.reset();
110 110
111 // SkPicturePlayback uses the base-class' quickReject calls to cull clipped 111 // SkPicturePlayback uses the base-class' quickReject calls to cull clipped
112 // operations. This can lead to problems in the debugger which expects all 112 // operations. This can lead to problems in the debugger which expects all
113 // the operations in the captured skp to appear in the debug canvas. To 113 // the operations in the captured skp to appear in the debug canvas. To
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() const { 352 const SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() const {
353 return fCommandVector; 353 return fCommandVector;
354 } 354 }
355 355
356 SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() { 356 SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
357 return fCommandVector; 357 return fCommandVector;
358 } 358 }
359 359
360 void SkDebugCanvas::updatePaintFilterCanvas() { 360 void SkDebugCanvas::updatePaintFilterCanvas() {
361 if (!fOverdrawViz && !fOverrideFilterQuality) { 361 if (!fOverdrawViz && !fOverrideFilterQuality) {
362 fPaintFilterCanvas.reset(NULL); 362 fPaintFilterCanvas.reset(nullptr);
363 return; 363 return;
364 } 364 }
365 365
366 const SkImageInfo info = this->imageInfo(); 366 const SkImageInfo info = this->imageInfo();
367 fPaintFilterCanvas.reset(new DebugPaintFilterCanvas(info.width(), info.heigh t(), fOverdrawViz, 367 fPaintFilterCanvas.reset(new DebugPaintFilterCanvas(info.width(), info.heigh t(), fOverdrawViz,
368 fOverrideFilterQuality, fFilterQuality)); 368 fOverrideFilterQuality, fFilterQuality));
369 } 369 }
370 370
371 void SkDebugCanvas::setOverdrawViz(bool overdrawViz) { 371 void SkDebugCanvas::setOverdrawViz(bool overdrawViz) {
372 if (fOverdrawViz == overdrawViz) { 372 if (fOverdrawViz == overdrawViz) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 const SkPoint texCoords[4], SkXfermode* xmode, 508 const SkPoint texCoords[4], SkXfermode* xmode,
509 const SkPaint& paint) { 509 const SkPaint& paint) {
510 this->addDrawCommand(new SkDrawPatchCommand(cubics, colors, texCoords, xmode , paint)); 510 this->addDrawCommand(new SkDrawPatchCommand(cubics, colors, texCoords, xmode , paint));
511 } 511 }
512 512
513 void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPo int vertices[], 513 void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPo int vertices[],
514 const SkPoint texs[], const SkColor colors[], 514 const SkPoint texs[], const SkColor colors[],
515 SkXfermode*, const uint16_t indices[], int in dexCount, 515 SkXfermode*, const uint16_t indices[], int in dexCount,
516 const SkPaint& paint) { 516 const SkPaint& paint) {
517 this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices, 517 this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
518 texs, colors, NULL, indices, indexCount, paint)); 518 texs, colors, nullptr, indices, indexCount, paint));
519 } 519 }
520 520
521 void SkDebugCanvas::willRestore() { 521 void SkDebugCanvas::willRestore() {
522 this->addDrawCommand(new SkRestoreCommand()); 522 this->addDrawCommand(new SkRestoreCommand());
523 this->INHERITED::willRestore(); 523 this->INHERITED::willRestore();
524 } 524 }
525 525
526 void SkDebugCanvas::willSave() { 526 void SkDebugCanvas::willSave() {
527 this->addDrawCommand(new SkSaveCommand()); 527 this->addDrawCommand(new SkSaveCommand());
528 this->INHERITED::willSave(); 528 this->INHERITED::willSave();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 663 }
664 664
665 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 665 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
666 if (fCalledAddStackData) { 666 if (fCalledAddStackData) {
667 fClipStackData.appendf("<br>"); 667 fClipStackData.appendf("<br>");
668 addPathData(devPath, "pathOut"); 668 addPathData(devPath, "pathOut");
669 return true; 669 return true;
670 } 670 }
671 return false; 671 return false;
672 } 672 }
OLDNEW
« no previous file with comments | « src/utils/android/SkAndroidSDKCanvas.cpp ('k') | src/utils/debugger/SkDrawCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698