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

Side by Side Diff: experimental/skpdiff/main.cpp

Issue 18176005: add point of interest API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: constant zero buffer Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « experimental/skpdiff/diff_pixels.cl ('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 2013 Google Inc. 2 * Copyright 2013 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 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr 8 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr
9 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string 9 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string
10 #include <CL/cl.hpp> 10 #include <CL/cl.hpp>
11 11
12 #include "SkCommandLineFlags.h" 12 #include "SkCommandLineFlags.h"
13 #include "SkGraphics.h" 13 #include "SkGraphics.h"
14 #include "SkPoint.h"
14 #include "SkOSFile.h" 15 #include "SkOSFile.h"
15 #include "SkString.h" 16 #include "SkString.h"
16 #include "SkTArray.h" 17 #include "SkTArray.h"
17 #include "SkTDArray.h" 18 #include "SkTDArray.h"
18 19
19 #include "SkImageDiffer.h" 20 #include "SkImageDiffer.h"
20 #include "SkCLImageDiffer.h" 21 #include "SkCLImageDiffer.h"
21 #include "SkPMetric.h" 22 #include "SkPMetric.h"
22 #include "skpdiff_util.h" 23 #include "skpdiff_util.h"
23 24
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Get the files in the baseline, we will then look for those inside the tes t path 77 // Get the files in the baseline, we will then look for those inside the tes t path
77 SkTArray<SkString> baselineEntries; 78 SkTArray<SkString> baselineEntries;
78 if (!get_directory(baselinePath, &baselineEntries)) { 79 if (!get_directory(baselinePath, &baselineEntries)) {
79 SkDebugf("Unable to open path \"%s\"\n", baselinePath); 80 SkDebugf("Unable to open path \"%s\"\n", baselinePath);
80 return; 81 return;
81 } 82 }
82 83
83 SkTDArray<int> queuedDiffIDs; 84 SkTDArray<int> queuedDiffIDs;
84 for (int baselineIndex = 0; baselineIndex < baselineEntries.count(); baselin eIndex++) { 85 for (int baselineIndex = 0; baselineIndex < baselineEntries.count(); baselin eIndex++) {
85 const char* baseFilename = baselineEntries[baselineIndex].c_str(); 86 const char* baseFilename = baselineEntries[baselineIndex].c_str();
86 SkDebugf("%s\n", baseFilename); 87 SkDebugf("\n%s\n", baseFilename);
87 88
88 // Find the real location of each file to compare 89 // Find the real location of each file to compare
89 SkString baselineFile = SkOSPath::SkPathJoin(baselinePath, baseFilename) ; 90 SkString baselineFile = SkOSPath::SkPathJoin(baselinePath, baseFilename) ;
90 SkString testFile = SkOSPath::SkPathJoin(testPath, baseFilename); 91 SkString testFile = SkOSPath::SkPathJoin(testPath, baseFilename);
91 92
92 // Check that the test file exists and is a file 93 // Check that the test file exists and is a file
93 if (sk_exists(testFile.c_str()) && !sk_isdir(testFile.c_str())) { 94 if (sk_exists(testFile.c_str()) && !sk_isdir(testFile.c_str())) {
94 // Queue up the comparison with the differ 95 // Queue up the comparison with the differ
95 int diffID = differ->queueDiffOfFile(baselineFile.c_str(), testFile. c_str()); 96 int diffID = differ->queueDiffOfFile(baselineFile.c_str(), testFile. c_str());
96 if (diffID >= 0) { 97 if (diffID >= 0) {
97 queuedDiffIDs.push(diffID); 98 queuedDiffIDs.push(diffID);
98 SkDebugf("Result: %f\n", differ->getResult(diffID)); 99 SkDebugf("Result: %f\n", differ->getResult(diffID));
100 SkDebugf("POI Count: %i\n", differ->getPointsOfInterestCount(dif fID));
101 differ->deleteDiff(diffID);
99 } 102 }
100 } else { 103 } else {
101 SkDebugf("Baseline file \"%s\" has no corresponding test file\n", ba selineFile.c_str()); 104 SkDebugf("Baseline file \"%s\" has no corresponding test file\n", ba selineFile.c_str());
102 } 105 }
103 } 106 }
104 } 107 }
105 108
106 109
107 /// Compares two sets of images identified by glob style patterns with the given differ 110 /// Compares two sets of images identified by glob style patterns with the given differ
108 static void diff_patterns(const char baselinePattern[], const char testPattern[] , SkImageDiffer* differ) { 111 static void diff_patterns(const char baselinePattern[], const char testPattern[] , SkImageDiffer* differ) {
(...skipping 14 matching lines...) Expand all
123 126
124 if (baselineEntries.count() != testEntries.count()) { 127 if (baselineEntries.count() != testEntries.count()) {
125 SkDebugf("Baseline and test patterns do not yield corresponding number o f files\n"); 128 SkDebugf("Baseline and test patterns do not yield corresponding number o f files\n");
126 return; 129 return;
127 } 130 }
128 131
129 SkTDArray<int> queuedDiffIDs; 132 SkTDArray<int> queuedDiffIDs;
130 for (int entryIndex = 0; entryIndex < baselineEntries.count(); entryIndex++) { 133 for (int entryIndex = 0; entryIndex < baselineEntries.count(); entryIndex++) {
131 const char* baselineFilename = baselineEntries[entryIndex].c_str(); 134 const char* baselineFilename = baselineEntries[entryIndex].c_str();
132 const char* testFilename = testEntries [entryIndex].c_str(); 135 const char* testFilename = testEntries [entryIndex].c_str();
133 SkDebugf("%s %s\n", baselineFilename, testFilename); 136 SkDebugf("\n%s %s\n", baselineFilename, testFilename);
134 137
135 int diffID = differ->queueDiffOfFile(baselineFilename, testFilename); 138 int diffID = differ->queueDiffOfFile(baselineFilename, testFilename);
136 if (diffID >= 0) { 139 if (diffID >= 0) {
137 queuedDiffIDs.push(diffID); 140 queuedDiffIDs.push(diffID);
138 SkDebugf("Result: %f\n", differ->getResult(diffID)); 141 SkDebugf("Result: %f\n", differ->getResult(diffID));
142 SkDebugf("POI Count: %i\n", differ->getPointsOfInterestCount(diffID) );
143 differ->deleteDiff(diffID);
139 } 144 }
140 } 145 }
141 } 146 }
142 147
143 148
144 static bool init_cl_diff(SkImageDiffer* differ) { 149 static bool init_cl_diff(SkImageDiffer* differ) {
145 // Setup OpenCL 150 // Setup OpenCL
146 cl::Device device; 151 cl::Device device;
147 cl::Context context; 152 cl::Context context;
148 if (!init_device_and_context(&device, &context)) { 153 if (!init_device_and_context(&device, &context)) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 257 }
253 258
254 // Perform a pattern diff if one is requested 259 // Perform a pattern diff if one is requested
255 if (!FLAGS_patterns.isEmpty()) { 260 if (!FLAGS_patterns.isEmpty()) {
256 diff_patterns(FLAGS_patterns[0], FLAGS_patterns[1], differ); 261 diff_patterns(FLAGS_patterns[0], FLAGS_patterns[1], differ);
257 } 262 }
258 } 263 }
259 264
260 return 0; 265 return 0;
261 } 266 }
OLDNEW
« no previous file with comments | « experimental/skpdiff/diff_pixels.cl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698