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

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

Issue 997913002: Fix debugger's overdraw color filter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SK_ARRAY_COUNT (again) Created 5 years, 9 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 | « no previous file | 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 SkPackARGB32(0xFF, 170, 185, 212), 98 SkPackARGB32(0xFF, 170, 185, 212),
99 SkPackARGB32(0xFF, 213, 195, 170), 99 SkPackARGB32(0xFF, 213, 195, 170),
100 SkPackARGB32(0xFF, 255, 192, 127), 100 SkPackARGB32(0xFF, 255, 192, 127),
101 SkPackARGB32(0xFF, 255, 185, 85), 101 SkPackARGB32(0xFF, 255, 185, 85),
102 SkPackARGB32(0xFF, 255, 165, 42), 102 SkPackARGB32(0xFF, 255, 165, 42),
103 SkPackARGB32(0xFF, 255, 135, 0), 103 SkPackARGB32(0xFF, 255, 135, 0),
104 SkPackARGB32(0xFF, 255, 95, 0), 104 SkPackARGB32(0xFF, 255, 95, 0),
105 SkPackARGB32(0xFF, 255, 50, 0), 105 SkPackARGB32(0xFF, 255, 50, 0),
106 SkPackARGB32(0xFF, 255, 0, 0) 106 SkPackARGB32(0xFF, 255, 0, 0)
107 }; 107 };
108
108 109
109 for (size_t i = 0; i < SK_ARRAY_COUNT(gTable)-1; ++i) { 110 int idx;
110 if (gTable[i] == dst) { 111 if (SkColorGetR(dst) < 64) { // 0
111 return gTable[i+1]; 112 idx = 0;
112 } 113 } else if (SkColorGetG(dst) < 25) { // 10
114 idx = 9; // cap at 9 for upcoming increment
115 } else if ((SkColorGetB(dst)+21)/42 > 0) { // 1-6
116 idx = 7 - (SkColorGetB(dst)+21)/42;
117 } else { // 7-9
118 idx = 10 - (SkColorGetG(dst)+22)/45;
113 } 119 }
120 ++idx;
121 SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable));
114 122
115 return gTable[SK_ARRAY_COUNT(gTable)-1]; 123 return gTable[idx];
116 } 124 }
117 125
118 Factory getFactory() const SK_OVERRIDE { return NULL; } 126 Factory getFactory() const SK_OVERRIDE { return NULL; }
119 #ifndef SK_IGNORE_TO_STRING 127 #ifndef SK_IGNORE_TO_STRING
120 virtual void toString(SkString* str) const SK_OVERRIDE { str->set("OverdrawX fermode"); } 128 virtual void toString(SkString* str) const SK_OVERRIDE { str->set("OverdrawX fermode"); }
121 #endif 129 #endif
122 }; 130 };
123 131
124 class SkOverdrawFilter : public SkDrawFilter { 132 class SkOverdrawFilter : public SkDrawFilter {
125 public: 133 public:
126 SkOverdrawFilter() { 134 SkOverdrawFilter() {
127 fXferMode = SkNEW(OverdrawXfermode); 135 fXferMode = SkNEW(OverdrawXfermode);
128 } 136 }
129 137
130 virtual ~SkOverdrawFilter() { 138 virtual ~SkOverdrawFilter() {
131 delete fXferMode; 139 delete fXferMode;
132 } 140 }
133 141
134 bool filter(SkPaint* p, Type) SK_OVERRIDE { 142 bool filter(SkPaint* p, Type) SK_OVERRIDE {
135 p->setXfermode(fXferMode); 143 p->setXfermode(fXferMode);
144 p->setAntiAlias(false);
136 return true; 145 return true;
137 } 146 }
138 147
139 protected: 148 protected:
140 SkXfermode* fXferMode; 149 SkXfermode* fXferMode;
141 150
142 private: 151 private:
143 typedef SkDrawFilter INHERITED; 152 typedef SkDrawFilter INHERITED;
144 }; 153 };
145 154
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 } 673 }
665 674
666 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 675 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
667 if (fCalledAddStackData) { 676 if (fCalledAddStackData) {
668 fClipStackData.appendf("<br>"); 677 fClipStackData.appendf("<br>");
669 addPathData(devPath, "pathOut"); 678 addPathData(devPath, "pathOut");
670 return true; 679 return true;
671 } 680 }
672 return false; 681 return false;
673 } 682 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698