OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "skia/ext/benchmarking_canvas.h" | 5 #include "skia/ext/benchmarking_canvas.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 if (paint.getColorFilter()) | 267 if (paint.getColorFilter()) |
268 val->Set("ColorFilter", AsValue(*paint.getColorFilter())); | 268 val->Set("ColorFilter", AsValue(*paint.getColorFilter())); |
269 | 269 |
270 if (paint.getImageFilter()) | 270 if (paint.getImageFilter()) |
271 val->Set("ImageFilter", AsValue(*paint.getImageFilter())); | 271 val->Set("ImageFilter", AsValue(*paint.getImageFilter())); |
272 | 272 |
273 return std::move(val); | 273 return std::move(val); |
274 } | 274 } |
275 | 275 |
276 WARN_UNUSED_RESULT | 276 WARN_UNUSED_RESULT |
277 scoped_ptr<base::Value> AsValue(SkCanvas::SaveFlags flags) { | 277 scoped_ptr<base::Value> SaveLayerFlagsAsValue(SkCanvas::SaveLayerFlags flags) { |
f(malita)
2015/12/19 18:09:14
Bummer, we're breaking the overload-fest :)
| |
278 FlagsBuilder builder('|'); | 278 FlagsBuilder builder('|'); |
279 builder.addFlag(flags & SkCanvas::kHasAlphaLayer_SaveFlag, | 279 builder.addFlag(flags & SkCanvas::kIsOpaque_SaveLayerFlag, |
280 "kHasAlphaLayer"); | 280 "kIsOpaque"); |
281 builder.addFlag(flags & SkCanvas::kFullColorLayer_SaveFlag, | 281 builder.addFlag(flags & SkCanvas::kPreserveLCDText_SaveLayerFlag, |
282 "kFullColorLayer"); | 282 "kPreserveLCDText"); |
283 builder.addFlag(flags & SkCanvas::kClipToLayer_SaveFlag, | |
284 "kClipToLayer"); | |
285 | 283 |
286 scoped_ptr<base::StringValue> val(new base::StringValue(builder.str())); | 284 scoped_ptr<base::StringValue> val(new base::StringValue(builder.str())); |
287 | 285 |
288 return std::move(val); | 286 return std::move(val); |
289 } | 287 } |
290 | 288 |
291 WARN_UNUSED_RESULT | 289 WARN_UNUSED_RESULT |
292 scoped_ptr<base::Value> AsValue(SkRegion::Op op) { | 290 scoped_ptr<base::Value> AsValue(SkRegion::Op op) { |
293 static const char* gOpStrings[] = { "Difference", | 291 static const char* gOpStrings[] = { "Difference", |
294 "Intersect", | 292 "Intersect", |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 | 541 |
544 INHERITED::willSave(); | 542 INHERITED::willSave(); |
545 } | 543 } |
546 | 544 |
547 SkCanvas::SaveLayerStrategy BenchmarkingCanvas::getSaveLayerStrategy( | 545 SkCanvas::SaveLayerStrategy BenchmarkingCanvas::getSaveLayerStrategy( |
548 const SaveLayerRec& rec) { | 546 const SaveLayerRec& rec) { |
549 AutoOp op(this, "SaveLayer", rec.fPaint); | 547 AutoOp op(this, "SaveLayer", rec.fPaint); |
550 if (rec.fBounds) | 548 if (rec.fBounds) |
551 op.addParam("bounds", AsValue(*rec.fBounds)); | 549 op.addParam("bounds", AsValue(*rec.fBounds)); |
552 if (rec.fSaveLayerFlags) | 550 if (rec.fSaveLayerFlags) |
553 op.addParam("flags", AsValue(rec.fSaveLayerFlags)); | 551 op.addParam("flags", SaveLayerFlagsAsValue(rec.fSaveLayerFlags)); |
554 | 552 |
555 return INHERITED::getSaveLayerStrategy(rec); | 553 return INHERITED::getSaveLayerStrategy(rec); |
556 } | 554 } |
557 | 555 |
558 void BenchmarkingCanvas::willRestore() { | 556 void BenchmarkingCanvas::willRestore() { |
559 AutoOp op(this, "Restore"); | 557 AutoOp op(this, "Restore"); |
560 | 558 |
561 INHERITED::willRestore(); | 559 INHERITED::willRestore(); |
562 } | 560 } |
563 | 561 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
797 DCHECK(blob); | 795 DCHECK(blob); |
798 AutoOp op(this, "DrawTextBlob", &paint); | 796 AutoOp op(this, "DrawTextBlob", &paint); |
799 op.addParam("blob", AsValue(*blob)); | 797 op.addParam("blob", AsValue(*blob)); |
800 op.addParam("x", AsValue(x)); | 798 op.addParam("x", AsValue(x)); |
801 op.addParam("y", AsValue(y)); | 799 op.addParam("y", AsValue(y)); |
802 | 800 |
803 INHERITED::onDrawTextBlob(blob, x, y, *op.paint()); | 801 INHERITED::onDrawTextBlob(blob, x, y, *op.paint()); |
804 } | 802 } |
805 | 803 |
806 } // namespace skia | 804 } // namespace skia |
OLD | NEW |