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

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

Issue 203203004: Consolidate SkCanvas matrix virtuals. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated per review. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLuaCanvas.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 this->dump(kSave_Verb, paint, str.c_str()); 216 this->dump(kSave_Verb, paint, str.c_str());
217 return this->INHERITED::willSaveLayer(bounds, paint, flags); 217 return this->INHERITED::willSaveLayer(bounds, paint, flags);
218 } 218 }
219 219
220 void SkDumpCanvas::willRestore() { 220 void SkDumpCanvas::willRestore() {
221 this->dump(kRestore_Verb, NULL, "restore"); 221 this->dump(kRestore_Verb, NULL, "restore");
222 this->INHERITED::willRestore(); 222 this->INHERITED::willRestore();
223 } 223 }
224 224
225 void SkDumpCanvas::didTranslate(SkScalar dx, SkScalar dy) {
226 this->dump(kMatrix_Verb, NULL, "translate(%g %g)",
227 SkScalarToFloat(dx), SkScalarToFloat(dy));
228 this->INHERITED::didTranslate(dx, dy);
229 }
230
231 void SkDumpCanvas::didScale(SkScalar sx, SkScalar sy) {
232 this->dump(kMatrix_Verb, NULL, "scale(%g %g)",
233 SkScalarToFloat(sx), SkScalarToFloat(sy));
234 this->INHERITED::didScale(sx, sy);
235 }
236
237 void SkDumpCanvas::didRotate(SkScalar degrees) {
238 this->dump(kMatrix_Verb, NULL, "rotate(%g)", SkScalarToFloat(degrees));
239 this->INHERITED::didRotate(degrees);
240 }
241
242 void SkDumpCanvas::didSkew(SkScalar sx, SkScalar sy) {
243 this->dump(kMatrix_Verb, NULL, "skew(%g %g)",
244 SkScalarToFloat(sx), SkScalarToFloat(sy));
245 this->INHERITED::didSkew(sx, sy);
246 }
247
248 void SkDumpCanvas::didConcat(const SkMatrix& matrix) { 225 void SkDumpCanvas::didConcat(const SkMatrix& matrix) {
249 SkString str; 226 SkString str;
250 matrix.toString(&str); 227
251 this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str()); 228 switch (matrix.getType()) {
229 case SkMatrix::kTranslate_Mask:
230 this->dump(kMatrix_Verb, NULL, "translate(%g %g)",
231 SkScalarToFloat(matrix.getTranslateX()),
232 SkScalarToFloat(matrix.getTranslateY()));
233 break;
234 case SkMatrix::kScale_Mask:
235 this->dump(kMatrix_Verb, NULL, "scale(%g %g)",
236 SkScalarToFloat(matrix.getScaleX()),
237 SkScalarToFloat(matrix.getScaleY()));
238 break;
239 default:
240 matrix.toString(&str);
241 this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str());
242 break;
243 }
244
252 this->INHERITED::didConcat(matrix); 245 this->INHERITED::didConcat(matrix);
253 } 246 }
254 247
255 void SkDumpCanvas::didSetMatrix(const SkMatrix& matrix) { 248 void SkDumpCanvas::didSetMatrix(const SkMatrix& matrix) {
256 SkString str; 249 SkString str;
257 matrix.toString(&str); 250 matrix.toString(&str);
258 this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str()); 251 this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str());
259 this->INHERITED::didSetMatrix(matrix); 252 this->INHERITED::didSetMatrix(matrix);
260 } 253 }
261 254
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 521
529 /////////////////////////////////////////////////////////////////////////////// 522 ///////////////////////////////////////////////////////////////////////////////
530 523
531 static void dumpToDebugf(const char text[], void*) { 524 static void dumpToDebugf(const char text[], void*) {
532 SkDebugf("%s\n", text); 525 SkDebugf("%s\n", text);
533 } 526 }
534 527
535 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} 528 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {}
536 529
537 #endif 530 #endif
OLDNEW
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698