OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/chromeos/test/action_logger_util.h" | 5 #include "ui/display/chromeos/test/action_logger_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", | 50 size.height(), out1 ? DisplaySnapshotToString(*out1).c_str() : "NULL", |
51 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); | 51 out2 ? DisplaySnapshotToString(*out2).c_str() : "NULL"); |
52 } | 52 } |
53 | 53 |
54 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, | 54 std::string GetSetHDCPStateAction(const DisplaySnapshot& output, |
55 HDCPState state) { | 55 HDCPState state) { |
56 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", | 56 return base::StringPrintf("set_hdcp(id=%" PRId64 ",state=%d)", |
57 output.display_id(), state); | 57 output.display_id(), state); |
58 } | 58 } |
59 | 59 |
60 std::string SetGammaRampAction(const ui::DisplaySnapshot& output, | 60 std::string SetColorCorrectionAction( |
61 const std::vector<GammaRampRGBEntry>& lut) { | 61 const ui::DisplaySnapshot& output, |
62 std::string table; | 62 const std::vector<GammaRampRGBEntry>& degamma_lut, |
63 for (size_t i = 0; i < lut.size(); ++i) { | 63 const std::vector<GammaRampRGBEntry>& gamma_lut, |
64 table += base::StringPrintf(",rgb[%" PRIuS "]=%04x%04x%04x", i, lut[i].r, | 64 const std::vector<float>& correction_matrix) { |
65 lut[i].g, lut[i].b); | 65 std::string degamma_table; |
| 66 for (size_t i = 0; i < degamma_lut.size(); ++i) { |
| 67 degamma_table += base::StringPrintf(",degamma[%" PRIuS "]=%04x%04x%04x", i, |
| 68 degamma_lut[i].r, degamma_lut[i].g, |
| 69 degamma_lut[i].b); |
| 70 } |
| 71 std::string gamma_table; |
| 72 for (size_t i = 0; i < gamma_lut.size(); ++i) { |
| 73 gamma_table += |
| 74 base::StringPrintf(",gamma[%" PRIuS "]=%04x%04x%04x", i, gamma_lut[i].r, |
| 75 gamma_lut[i].g, gamma_lut[i].b); |
66 } | 76 } |
67 | 77 |
68 return base::StringPrintf("set_gamma_ramp(id=%" PRId64 "%s)", | 78 std::string ctm; |
69 output.display_id(), table.c_str()); | 79 for (size_t i = 0; i < correction_matrix.size(); ++i) { |
| 80 ctm += base::StringPrintf(",ctm[%" PRIuS "]=%f", i, correction_matrix[i]); |
| 81 } |
| 82 |
| 83 return base::StringPrintf("set_color_correction(id=%" PRId64 "%s%s%s)", |
| 84 output.display_id(), degamma_table.c_str(), |
| 85 gamma_table.c_str(), ctm.c_str()); |
70 } | 86 } |
71 | 87 |
72 std::string JoinActions(const char* action, ...) { | 88 std::string JoinActions(const char* action, ...) { |
73 std::string actions; | 89 std::string actions; |
74 | 90 |
75 va_list arg_list; | 91 va_list arg_list; |
76 va_start(arg_list, action); | 92 va_start(arg_list, action); |
77 while (action) { | 93 while (action) { |
78 if (!actions.empty()) | 94 if (!actions.empty()) |
79 actions += ","; | 95 actions += ","; |
80 actions += action; | 96 actions += action; |
81 action = va_arg(arg_list, const char*); | 97 action = va_arg(arg_list, const char*); |
82 } | 98 } |
83 va_end(arg_list); | 99 va_end(arg_list); |
84 return actions; | 100 return actions; |
85 } | 101 } |
86 | 102 |
87 } // namespace test | 103 } // namespace test |
88 } // namespace ui | 104 } // namespace ui |
OLD | NEW |