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

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

Issue 2575533002: SkClipOp is an enum class now (Closed)
Patch Set: Created 4 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
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 266
267 std::unique_ptr<base::Value> AsValue(SkClipOp op) { 267 std::unique_ptr<base::Value> AsValue(SkClipOp op) {
268 static const char* gOpStrings[] = { "Difference", 268 static const char* gOpStrings[] = { "Difference",
269 "Intersect", 269 "Intersect",
270 "Union", 270 "Union",
271 "XOR", 271 "XOR",
272 "ReverseDifference", 272 "ReverseDifference",
273 "Replace" 273 "Replace"
274 }; 274 };
275 DCHECK_LT(static_cast<size_t>(op), SK_ARRAY_COUNT(gOpStrings)); 275 size_t index = static_cast<size_t>(op);
276 std::unique_ptr<base::StringValue> val(new base::StringValue(gOpStrings[op])); 276 DCHECK_LT(index, SK_ARRAY_COUNT(gOpStrings));
277 std::unique_ptr<base::StringValue> val(
278 new base::StringValue(gOpStrings[index]));
277 return std::move(val); 279 return std::move(val);
278 } 280 }
279 281
280 std::unique_ptr<base::Value> AsValue(const SkRegion& region) { 282 std::unique_ptr<base::Value> AsValue(const SkRegion& region) {
281 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue()); 283 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue());
282 val->Set("bounds", AsValue(SkRect::Make(region.getBounds()))); 284 val->Set("bounds", AsValue(SkRect::Make(region.getBounds())));
283 285
284 return std::move(val); 286 return std::move(val);
285 } 287 }
286 288
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 DCHECK(blob); 716 DCHECK(blob);
715 AutoOp op(this, "DrawTextBlob", &paint); 717 AutoOp op(this, "DrawTextBlob", &paint);
716 op.addParam("blob", AsValue(*blob)); 718 op.addParam("blob", AsValue(*blob));
717 op.addParam("x", AsValue(x)); 719 op.addParam("x", AsValue(x));
718 op.addParam("y", AsValue(y)); 720 op.addParam("y", AsValue(y));
719 721
720 INHERITED::onDrawTextBlob(blob, x, y, *op.paint()); 722 INHERITED::onDrawTextBlob(blob, x, y, *op.paint());
721 } 723 }
722 724
723 } // namespace skia 725 } // namespace skia
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698