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

Side by Side Diff: skia/ext/benchmarking_canvas.cc

Issue 1537203002: switch to using SaveLayerFlags (SaveFlags are deprecated) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 // 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
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
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
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
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