| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
| 9 | 9 |
| 10 #include "ProcStats.h" | 10 #include "ProcStats.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 { | 51 { |
| 52 SkAutoMutexAcquire lock(&gBitmapResultLock); | 52 SkAutoMutexAcquire lock(&gBitmapResultLock); |
| 53 for (int i = 0; i < gBitmapResults.count(); i++) { | 53 for (int i = 0; i < gBitmapResults.count(); i++) { |
| 54 Json::Value result; | 54 Json::Value result; |
| 55 result["key"]["name"] = gBitmapResults[i].name.c_str(); | 55 result["key"]["name"] = gBitmapResults[i].name.c_str(); |
| 56 result["key"]["config"] = gBitmapResults[i].config.c_str(
); | 56 result["key"]["config"] = gBitmapResults[i].config.c_str(
); |
| 57 result["key"]["source_type"] = gBitmapResults[i].sourceType.c_
str(); | 57 result["key"]["source_type"] = gBitmapResults[i].sourceType.c_
str(); |
| 58 result["options"]["ext"] = gBitmapResults[i].ext.c_str(); | 58 result["options"]["ext"] = gBitmapResults[i].ext.c_str(); |
| 59 result["options"]["gamma_correct"] = gBitmapResults[i].gammaCorrect; | 59 result["options"]["gamma_correct"] = gBitmapResults[i].gammaCorrect
? "yes" : "no"; |
| 60 result["md5"] = gBitmapResults[i].md5.c_str(); | 60 result["md5"] = gBitmapResults[i].md5.c_str(); |
| 61 | 61 |
| 62 // Source options only need to be part of the key if they exist. | 62 // Source options only need to be part of the key if they exist. |
| 63 // Source type by source type, we either always set options or never
set options. | 63 // Source type by source type, we either always set options or never
set options. |
| 64 if (!gBitmapResults[i].sourceOptions.isEmpty()) { | 64 if (!gBitmapResults[i].sourceOptions.isEmpty()) { |
| 65 result["key"]["source_options"] = gBitmapResults[i].sourceOption
s.c_str(); | 65 result["key"]["source_options"] = gBitmapResults[i].sourceOption
s.c_str(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 root["results"].append(result); | 68 root["results"].append(result); |
| 69 } | 69 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 const Json::Value& results = root["results"]; | 110 const Json::Value& results = root["results"]; |
| 111 BitmapResult br; | 111 BitmapResult br; |
| 112 for (unsigned i = 0; i < results.size(); i++) { | 112 for (unsigned i = 0; i < results.size(); i++) { |
| 113 const Json::Value& r = results[i]; | 113 const Json::Value& r = results[i]; |
| 114 br.name = r["key"]["name"].asCString(); | 114 br.name = r["key"]["name"].asCString(); |
| 115 br.config = r["key"]["config"].asCString(); | 115 br.config = r["key"]["config"].asCString(); |
| 116 br.sourceType = r["key"]["source_type"].asCString(); | 116 br.sourceType = r["key"]["source_type"].asCString(); |
| 117 br.ext = r["options"]["ext"].asCString(); | 117 br.ext = r["options"]["ext"].asCString(); |
| 118 br.gammaCorrect = r["options"]["gamma_correct"].asBool(); | 118 br.gammaCorrect = 0 == strcmp("yes", r["options"]["gamma_correct"].asCSt
ring()); |
| 119 br.md5 = r["md5"].asCString(); | 119 br.md5 = r["md5"].asCString(); |
| 120 | 120 |
| 121 if (!r["key"]["source_options"].isNull()) { | 121 if (!r["key"]["source_options"].isNull()) { |
| 122 br.sourceOptions = r["key"]["source_options"].asCString(); | 122 br.sourceOptions = r["key"]["source_options"].asCString(); |
| 123 } | 123 } |
| 124 callback(br); | 124 callback(br); |
| 125 } | 125 } |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace DM | 129 } // namespace DM |
| OLD | NEW |