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" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "third_party/skia/include/core/SkColorFilter.h" | 14 #include "third_party/skia/include/core/SkColorFilter.h" |
15 #include "third_party/skia/include/core/SkImageFilter.h" | 15 #include "third_party/skia/include/core/SkImageFilter.h" |
16 #include "third_party/skia/include/core/SkPaint.h" | 16 #include "third_party/skia/include/core/SkPaint.h" |
17 #include "third_party/skia/include/core/SkPath.h" | 17 #include "third_party/skia/include/core/SkPath.h" |
18 #include "third_party/skia/include/core/SkPicture.h" | 18 #include "third_party/skia/include/core/SkPicture.h" |
19 #include "third_party/skia/include/core/SkRRect.h" | 19 #include "third_party/skia/include/core/SkRRect.h" |
20 #include "third_party/skia/include/core/SkRegion.h" | 20 #include "third_party/skia/include/core/SkRegion.h" |
21 #include "third_party/skia/include/core/SkString.h" | 21 #include "third_party/skia/include/core/SkString.h" |
22 #include "third_party/skia/include/core/SkTextBlob.h" | 22 #include "third_party/skia/include/core/SkTextBlob.h" |
23 | 23 |
24 extern const char* SkBlendMode_Name(SkBlendMode); | |
f(malita)
2016/11/16 21:10:58
Ditto.
reed1
2016/11/16 21:31:17
Done.
| |
25 | |
24 namespace { | 26 namespace { |
25 | 27 |
26 class FlagsBuilder { | 28 class FlagsBuilder { |
27 public: | 29 public: |
28 FlagsBuilder(char separator) | 30 FlagsBuilder(char separator) |
29 : separator_(separator) {} | 31 : separator_(separator) {} |
30 | 32 |
31 void addFlag(bool flag_val, const char flag_name[]) { | 33 void addFlag(bool flag_val, const char flag_name[]) { |
32 if (!flag_val) | 34 if (!flag_val) |
33 return; | 35 return; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 val->SetInteger("a", SkColorGetA(color)); | 114 val->SetInteger("a", SkColorGetA(color)); |
113 val->SetInteger("r", SkColorGetR(color)); | 115 val->SetInteger("r", SkColorGetR(color)); |
114 val->SetInteger("g", SkColorGetG(color)); | 116 val->SetInteger("g", SkColorGetG(color)); |
115 val->SetInteger("b", SkColorGetB(color)); | 117 val->SetInteger("b", SkColorGetB(color)); |
116 | 118 |
117 return std::move(val); | 119 return std::move(val); |
118 } | 120 } |
119 | 121 |
120 std::unique_ptr<base::Value> AsValue(SkBlendMode mode) { | 122 std::unique_ptr<base::Value> AsValue(SkBlendMode mode) { |
121 std::unique_ptr<base::StringValue> val( | 123 std::unique_ptr<base::StringValue> val( |
122 new base::StringValue(SkXfermode::ModeName(mode))); | 124 new base::StringValue(SkBlendMode_Name(mode))); |
123 | 125 |
124 return std::move(val); | 126 return std::move(val); |
125 } | 127 } |
126 | 128 |
127 std::unique_ptr<base::Value> AsValue(SkCanvas::PointMode mode) { | 129 std::unique_ptr<base::Value> AsValue(SkCanvas::PointMode mode) { |
128 static const char* gModeStrings[] = { "Points", "Lines", "Polygon" }; | 130 static const char* gModeStrings[] = { "Points", "Lines", "Polygon" }; |
129 DCHECK_LT(static_cast<size_t>(mode), SK_ARRAY_COUNT(gModeStrings)); | 131 DCHECK_LT(static_cast<size_t>(mode), SK_ARRAY_COUNT(gModeStrings)); |
130 | 132 |
131 std::unique_ptr<base::StringValue> val( | 133 std::unique_ptr<base::StringValue> val( |
132 new base::StringValue(gModeStrings[mode])); | 134 new base::StringValue(gModeStrings[mode])); |
(...skipping 581 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 |