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

Side by Side Diff: src/utils/SkDumpCanvas.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 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/SkDeferredCanvas.cpp ('k') | src/utils/SkLua.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #if 1 98 #if 1
99 SkString s; 99 SkString s;
100 dumpVerbs(path, &s); 100 dumpVerbs(path, &s);
101 str->append(s.c_str()); 101 str->append(s.c_str());
102 #endif 102 #endif
103 str->append("]"); 103 str->append("]");
104 str->prepend("path:["); 104 str->prepend("path:[");
105 } 105 }
106 } 106 }
107 107
108 static const char* toString(SkRegion::Op op) { 108 static const char* toString(SkCanvas::ClipOp op) {
109 static const char* gOpNames[] = { 109 static const char* gOpNames[] = {
110 "DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE" 110 "DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE"
111 }; 111 };
112 return gOpNames[op]; 112 return gOpNames[op];
113 } 113 }
114 114
115 static void toString(const SkRegion& rgn, SkString* str) { 115 static void toString(const SkRegion& rgn, SkString* str) {
116 str->append("Region:["); 116 str->append("Region:[");
117 toString(rgn.getBounds(), str); 117 toString(rgn.getBounds(), str);
118 str->append("]"); 118 str->append("]");
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 this->dump(kMatrix_Verb, nullptr, "setMatrix(%s)", str.c_str()); 251 this->dump(kMatrix_Verb, nullptr, "setMatrix(%s)", str.c_str());
252 this->INHERITED::didSetMatrix(matrix); 252 this->INHERITED::didSetMatrix(matrix);
253 } 253 }
254 254
255 /////////////////////////////////////////////////////////////////////////////// 255 ///////////////////////////////////////////////////////////////////////////////
256 256
257 const char* SkDumpCanvas::EdgeStyleToAAString(ClipEdgeStyle edgeStyle) { 257 const char* SkDumpCanvas::EdgeStyleToAAString(ClipEdgeStyle edgeStyle) {
258 return kSoft_ClipEdgeStyle == edgeStyle ? "AA" : "BW"; 258 return kSoft_ClipEdgeStyle == edgeStyle ? "AA" : "BW";
259 } 259 }
260 260
261 void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) { 261 void SkDumpCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeS tyle) {
262 SkString str; 262 SkString str;
263 toString(rect, &str); 263 toString(rect, &str);
264 this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString( op), 264 this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString( op),
265 EdgeStyleToAAString(edgeStyle)); 265 EdgeStyleToAAString(edgeStyle));
266 this->INHERITED::onClipRect(rect, op, edgeStyle); 266 this->INHERITED::onClipRect(rect, op, edgeStyle);
267 } 267 }
268 268
269 void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeSt yle edgeStyle) { 269 void SkDumpCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle ed geStyle) {
270 SkString str; 270 SkString str;
271 toString(rrect, &str); 271 toString(rrect, &str);
272 this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString (op), 272 this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString (op),
273 EdgeStyleToAAString(edgeStyle)); 273 EdgeStyleToAAString(edgeStyle));
274 this->INHERITED::onClipRRect(rrect, op, edgeStyle); 274 this->INHERITED::onClipRRect(rrect, op, edgeStyle);
275 } 275 }
276 276
277 void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) { 277 void SkDumpCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeS tyle) {
278 SkString str; 278 SkString str;
279 toString(path, &str); 279 toString(path, &str);
280 this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString( op), 280 this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString( op),
281 EdgeStyleToAAString(edgeStyle)); 281 EdgeStyleToAAString(edgeStyle));
282 this->INHERITED::onClipPath(path, op, edgeStyle); 282 this->INHERITED::onClipPath(path, op, edgeStyle);
283 } 283 }
284 284
285 void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 285 void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
286 SkString str; 286 SkString str;
287 toString(deviceRgn, &str); 287 toString(deviceRgn, &str);
288 this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(), 288 this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(),
289 toString(op)); 289 toString(op));
290 this->INHERITED::onClipRegion(deviceRgn, op); 290 this->INHERITED::onClipRegion(deviceRgn, op);
291 } 291 }
292 292
293 /////////////////////////////////////////////////////////////////////////////// 293 ///////////////////////////////////////////////////////////////////////////////
294 294
295 void SkDumpCanvas::onDrawPaint(const SkPaint& paint) { 295 void SkDumpCanvas::onDrawPaint(const SkPaint& paint) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 fProc(msg.c_str(), fRefcon); 560 fProc(msg.c_str(), fRefcon);
561 } 561 }
562 562
563 /////////////////////////////////////////////////////////////////////////////// 563 ///////////////////////////////////////////////////////////////////////////////
564 564
565 static void dumpToDebugf(const char text[], void*) { 565 static void dumpToDebugf(const char text[], void*) {
566 SkDebugf("%s\n", text); 566 SkDebugf("%s\n", text);
567 } 567 }
568 568
569 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, nullptr) {} 569 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, nullptr) {}
OLDNEW
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698