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

Side by Side Diff: gm/gmmain.cpp

Issue 23587029: gm: add a flag to force perspective usage in all gms (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add reset of matrix in GM constructor too Created 7 years, 3 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 | « gm/gm.cpp ('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 2011 Google Inc. 2 * Copyright 2011 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 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 "each test)."); 1416 "each test).");
1417 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-" 1417 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
1418 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage"); 1418 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage");
1419 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file."); 1419 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file.");
1420 DEFINE_string2(writePath, w, "", "Write rendered images into this directory."); 1420 DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
1421 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ; 1421 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ;
1422 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " 1422 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, "
1423 "which can be in range 0-100). N = -1 will disable JPEG compression . " 1423 "which can be in range 0-100). N = -1 will disable JPEG compression . "
1424 "Default is N = 100, maximum quality."); 1424 "Default is N = 100, maximum quality.");
1425 1425
1426 // TODO(edisonn): pass a matrix instead of forcePerspectiveMatrix
1427 // Either the 9 numbers defining the matrix
1428 // or probably more readable would be to replace it with a set of a few predicat es
1429 // Like --prerotate 100 200 10 --posttranslate 10, 10
1430 // Probably define spacial names like centerx, centery, top, bottom, left, right
1431 // then we can write something reabable like --rotate centerx centery 90
1432 DEFINE_bool(forcePerspectiveMatrix, false, "Force a perspective matrix.");
1433
1426 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect) { 1434 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect) {
1427 // Filter output of warnings that JPEG is not available for the image. 1435 // Filter output of warnings that JPEG is not available for the image.
1428 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false; 1436 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false;
1429 if (FLAGS_pdfJpegQuality == -1) return false; 1437 if (FLAGS_pdfJpegQuality == -1) return false;
1430 1438
1431 SkIRect bitmapBounds; 1439 SkIRect bitmapBounds;
1432 SkBitmap subset; 1440 SkBitmap subset;
1433 const SkBitmap* bitmapToUse = &bitmap; 1441 const SkBitmap* bitmapToUse = &bitmap;
1434 bitmap.getBounds(&bitmapBounds); 1442 bitmap.getBounds(&bitmapBounds);
1435 if (rect != bitmapBounds) { 1443 if (rect != bitmapBounds) {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 if (NULL != gmmain.fMissingExpectationsPath) { 2155 if (NULL != gmmain.fMissingExpectationsPath) {
2148 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUse FileHierarchy, 2156 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUse FileHierarchy,
2149 configs, pdfRasterizers)) { 2157 configs, pdfRasterizers)) {
2150 return -1; 2158 return -1;
2151 } 2159 }
2152 } 2160 }
2153 2161
2154 Iter iter; 2162 Iter iter;
2155 GM* gm; 2163 GM* gm;
2156 while ((gm = iter.next()) != NULL) { 2164 while ((gm = iter.next()) != NULL) {
2165 if (FLAGS_forcePerspectiveMatrix) {
2166 SkMatrix perspective;
2167 perspective.setIdentity();
2168 perspective.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000)));
2169 perspective.setSkewX(SkScalarDiv(SkIntToScalar(8),
2170 SkIntToScalar(25)));
2171
2172 gm->setStarterMatrix(perspective);
2173 }
2157 SkAutoTDelete<GM> adgm(gm); 2174 SkAutoTDelete<GM> adgm(gm);
2158 ++gmIndex; 2175 ++gmIndex;
2159 if (moduloRemainder >= 0) { 2176 if (moduloRemainder >= 0) {
2160 if ((gmIndex % moduloDivisor) != moduloRemainder) { 2177 if ((gmIndex % moduloDivisor) != moduloRemainder) {
2161 continue; 2178 continue;
2162 } 2179 }
2163 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); 2180 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor);
2164 } 2181 }
2165 2182
2166 const char* shortName = gm->shortName(); 2183 const char* shortName = gm->shortName();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 if (FLAGS_forceBWtext) { 2271 if (FLAGS_forceBWtext) {
2255 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2272 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2256 } 2273 }
2257 } 2274 }
2258 2275
2259 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2276 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2260 int main(int argc, char * const argv[]) { 2277 int main(int argc, char * const argv[]) {
2261 return tool_main(argc, (char**) argv); 2278 return tool_main(argc, (char**) argv);
2262 } 2279 }
2263 #endif 2280 #endif
OLDNEW
« no previous file with comments | « gm/gm.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698