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

Side by Side Diff: dm/DMJsonWriter.cpp

Issue 1741973002: Add gamma_correct option field to dm.json (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « dm/DMJsonWriter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 root[FLAGS_properties[i-1]] = FLAGS_properties[i]; 45 root[FLAGS_properties[i-1]] = FLAGS_properties[i];
46 } 46 }
47 for (int i = 1; i < FLAGS_key.count(); i += 2) { 47 for (int i = 1; i < FLAGS_key.count(); i += 2) {
48 root["key"][FLAGS_key[i-1]] = FLAGS_key[i]; 48 root["key"][FLAGS_key[i-1]] = FLAGS_key[i];
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["md5"] = gBitmapResults[i].md5.c_str(); 59 result["options"]["gamma_correct"] = gBitmapResults[i].gammaCorrect;
60 result["md5"] = gBitmapResults[i].md5.c_str();
60 61
61 // 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.
62 // 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.
63 if (!gBitmapResults[i].sourceOptions.isEmpty()) { 64 if (!gBitmapResults[i].sourceOptions.isEmpty()) {
64 result["key"]["source_options"] = gBitmapResults[i].sourceOption s.c_str(); 65 result["key"]["source_options"] = gBitmapResults[i].sourceOption s.c_str();
65 } 66 }
66 67
67 root["results"].append(result); 68 root["results"].append(result);
68 } 69 }
69 } 70 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 Json::Value root; 104 Json::Value root;
104 const char* data = (const char*)json->data(); 105 const char* data = (const char*)json->data();
105 if (!reader.parse(data, data+json->size(), root)) { 106 if (!reader.parse(data, data+json->size(), root)) {
106 return false; 107 return false;
107 } 108 }
108 109
109 const Json::Value& results = root["results"]; 110 const Json::Value& results = root["results"];
110 BitmapResult br; 111 BitmapResult br;
111 for (unsigned i = 0; i < results.size(); i++) { 112 for (unsigned i = 0; i < results.size(); i++) {
112 const Json::Value& r = results[i]; 113 const Json::Value& r = results[i];
113 br.name = r["key"]["name"].asCString(); 114 br.name = r["key"]["name"].asCString();
114 br.config = r["key"]["config"].asCString(); 115 br.config = r["key"]["config"].asCString();
115 br.sourceType = r["key"]["source_type"].asCString(); 116 br.sourceType = r["key"]["source_type"].asCString();
116 br.ext = r["options"]["ext"].asCString(); 117 br.ext = r["options"]["ext"].asCString();
117 br.md5 = r["md5"].asCString(); 118 br.gammaCorrect = r["options"]["gamma_correct"].asBool();
119 br.md5 = r["md5"].asCString();
118 120
119 if (!r["key"]["source_options"].isNull()) { 121 if (!r["key"]["source_options"].isNull()) {
120 br.sourceOptions = r["key"]["source_options"].asCString(); 122 br.sourceOptions = r["key"]["source_options"].asCString();
121 } 123 }
122 callback(br); 124 callback(br);
123 } 125 }
124 return true; 126 return true;
125 } 127 }
126 128
127 } // namespace DM 129 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMJsonWriter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698