OLD | NEW |
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 vsnprintf(buffer, BUFFER_SIZE, format, args); | 185 vsnprintf(buffer, BUFFER_SIZE, format, args); |
186 va_end(args); | 186 va_end(args); |
187 | 187 |
188 if (fDumper) { | 188 if (fDumper) { |
189 fDumper->dump(this, verb, buffer, paint); | 189 fDumper->dump(this, verb, buffer, paint); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 /////////////////////////////////////////////////////////////////////////////// | 193 /////////////////////////////////////////////////////////////////////////////// |
194 | 194 |
195 void SkDumpCanvas::onSave(SaveFlags flags) { | 195 int SkDumpCanvas::save(SaveFlags flags) { |
196 this->dump(kSave_Verb, NULL, "save(0x%X)", flags); | 196 this->dump(kSave_Verb, NULL, "save(0x%X)", flags); |
197 this->INHERITED::onSave(flags); | 197 return this->INHERITED::save(flags); |
198 } | 198 } |
199 | 199 |
200 bool SkDumpCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint, | 200 int SkDumpCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, |
201 SaveFlags flags) { | 201 SaveFlags flags) { |
202 SkString str; | 202 SkString str; |
203 str.printf("saveLayer(0x%X)", flags); | 203 str.printf("saveLayer(0x%X)", flags); |
204 if (bounds) { | 204 if (bounds) { |
205 str.append(" bounds"); | 205 str.append(" bounds"); |
206 toString(*bounds, &str); | 206 toString(*bounds, &str); |
207 } | 207 } |
208 if (paint) { | 208 if (paint) { |
209 if (paint->getAlpha() != 0xFF) { | 209 if (paint->getAlpha() != 0xFF) { |
210 str.appendf(" alpha:0x%02X", paint->getAlpha()); | 210 str.appendf(" alpha:0x%02X", paint->getAlpha()); |
211 } | 211 } |
212 if (paint->getXfermode()) { | 212 if (paint->getXfermode()) { |
213 str.appendf(" xfermode:%p", paint->getXfermode()); | 213 str.appendf(" xfermode:%p", paint->getXfermode()); |
214 } | 214 } |
215 } | 215 } |
216 this->dump(kSave_Verb, paint, str.c_str()); | 216 this->dump(kSave_Verb, paint, str.c_str()); |
217 return this->INHERITED::onSaveLayer(bounds, paint, flags); | 217 return this->INHERITED::saveLayer(bounds, paint, flags); |
218 } | 218 } |
219 | 219 |
220 void SkDumpCanvas::onRestore() { | 220 void SkDumpCanvas::restore() { |
| 221 this->INHERITED::restore(); |
221 this->dump(kRestore_Verb, NULL, "restore"); | 222 this->dump(kRestore_Verb, NULL, "restore"); |
222 this->INHERITED::onRestore(); | |
223 } | 223 } |
224 | 224 |
225 bool SkDumpCanvas::translate(SkScalar dx, SkScalar dy) { | 225 bool SkDumpCanvas::translate(SkScalar dx, SkScalar dy) { |
226 this->dump(kMatrix_Verb, NULL, "translate(%g %g)", | 226 this->dump(kMatrix_Verb, NULL, "translate(%g %g)", |
227 SkScalarToFloat(dx), SkScalarToFloat(dy)); | 227 SkScalarToFloat(dx), SkScalarToFloat(dy)); |
228 return this->INHERITED::translate(dx, dy); | 228 return this->INHERITED::translate(dx, dy); |
229 } | 229 } |
230 | 230 |
231 bool SkDumpCanvas::scale(SkScalar sx, SkScalar sy) { | 231 bool SkDumpCanvas::scale(SkScalar sx, SkScalar sy) { |
232 this->dump(kMatrix_Verb, NULL, "scale(%g %g)", | 232 this->dump(kMatrix_Verb, NULL, "scale(%g %g)", |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 528 |
529 /////////////////////////////////////////////////////////////////////////////// | 529 /////////////////////////////////////////////////////////////////////////////// |
530 | 530 |
531 static void dumpToDebugf(const char text[], void*) { | 531 static void dumpToDebugf(const char text[], void*) { |
532 SkDebugf("%s\n", text); | 532 SkDebugf("%s\n", text); |
533 } | 533 } |
534 | 534 |
535 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 535 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
536 | 536 |
537 #endif | 537 #endif |
OLD | NEW |