| 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 <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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |