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

Side by Side Diff: gm/gmmain.cpp

Issue 24615006: rebaseline drawbitmap gms (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove expectation included by mistake in another cl Created 7 years, 2 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
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 *
11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh 11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh
12 * to make sure they still pass... you may need to change the expected 12 * to make sure they still pass... you may need to change the expected
13 * results of the self-test. 13 * results of the self-test.
14 */ 14 */
15 15
16 #include "gm.h" 16 #include "gm.h"
17 #include "gm_error.h" 17 #include "gm_error.h"
18 #include "gm_expectations.h" 18 #include "gm_expectations.h"
19 #include "system_preferences.h" 19 #include "system_preferences.h"
20 #include "SkBitmap.h" 20 #include "SkBitmap.h"
21 #include "SkCanvasSimplifier.h"
21 #include "SkColorPriv.h" 22 #include "SkColorPriv.h"
22 #include "SkCommandLineFlags.h" 23 #include "SkCommandLineFlags.h"
23 #include "SkData.h" 24 #include "SkData.h"
24 #include "SkDeferredCanvas.h" 25 #include "SkDeferredCanvas.h"
25 #include "SkDevice.h" 26 #include "SkDevice.h"
27 #include "SkDocument.h"
26 #include "SkDrawFilter.h" 28 #include "SkDrawFilter.h"
27 #include "SkForceLinking.h" 29 #include "SkForceLinking.h"
28 #include "SkGPipe.h" 30 #include "SkGPipe.h"
29 #include "SkGraphics.h" 31 #include "SkGraphics.h"
30 #include "SkImageDecoder.h" 32 #include "SkImageDecoder.h"
31 #include "SkImageEncoder.h" 33 #include "SkImageEncoder.h"
32 #include "SkOSFile.h" 34 #include "SkOSFile.h"
33 #include "SkPDFRasterizer.h" 35 #include "SkPDFRasterizer.h"
34 #include "SkPicture.h" 36 #include "SkPicture.h"
35 #include "SkRefCnt.h" 37 #include "SkRefCnt.h"
38 #include "SkScalar.h"
36 #include "SkStream.h" 39 #include "SkStream.h"
37 #include "SkTArray.h" 40 #include "SkTArray.h"
38 #include "SkTDict.h" 41 #include "SkTDict.h"
39 #include "SkTileGridPicture.h" 42 #include "SkTileGridPicture.h"
40 #include "SamplePipeControllers.h" 43 #include "SamplePipeControllers.h"
41 44
42 #ifdef SK_DEBUG 45 #ifdef SK_DEBUG
43 static const bool kDebugOnly = true; 46 static const bool kDebugOnly = true;
44 #else 47 #else
45 static const bool kDebugOnly = false; 48 static const bool kDebugOnly = false;
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 canvas.scale(scale, scale); 615 canvas.scale(scale, scale);
613 canvas.drawPicture(*pict); 616 canvas.drawPicture(*pict);
614 complete_bitmap(bitmap); 617 complete_bitmap(bitmap);
615 } 618 }
616 } 619 }
617 620
618 static void generate_pdf(GM* gm, SkDynamicMemoryWStream& pdf) { 621 static void generate_pdf(GM* gm, SkDynamicMemoryWStream& pdf) {
619 #ifdef SK_SUPPORT_PDF 622 #ifdef SK_SUPPORT_PDF
620 SkMatrix initialTransform = gm->getInitialTransform(); 623 SkMatrix initialTransform = gm->getInitialTransform();
621 SkISize pageSize = gm->getISize(); 624 SkISize pageSize = gm->getISize();
622 SkPDFDevice* dev = NULL; 625 SkSize pageSize2 = SkSize::Make(SkIntToScalar(pageSize.width()), SkIntTo Scalar(pageSize.height()));
623 if (initialTransform.isIdentity()) { 626 SkAutoTUnref<SkDocument> pdfDoc(SkDocument::CreatePDF(&pdf, NULL));
624 dev = new SkPDFDevice(pageSize, pageSize, initialTransform); 627 SkCanvas* canvas = NULL;
625 } else { 628 canvas = pdfDoc->beginPage(pageSize2);
626 SkRect content = SkRect::MakeWH(SkIntToScalar(pageSize.width()), 629 canvas->setMatrix(initialTransform);
627 SkIntToScalar(pageSize.height()));
628 initialTransform.mapRect(&content);
629 content.intersect(0, 0, SkIntToScalar(pageSize.width()),
630 SkIntToScalar(pageSize.height()));
631 SkISize contentSize =
632 SkISize::Make(SkScalarRoundToInt(content.width()),
633 SkScalarRoundToInt(content.height()));
634 dev = new SkPDFDevice(pageSize, contentSize, initialTransform);
635 }
636 dev->setDCTEncoder(encode_to_dct_stream);
637 SkAutoUnref aur(dev);
638 630
639 SkCanvas c(dev); 631 pdfDoc->setDCTEncoder(encode_to_dct_stream);
640 invokeGM(gm, &c, true, false);
641 632
642 SkPDFDocument doc; 633 invokeGM(gm, canvas, true, false);
643 doc.appendPage(dev); 634
644 doc.emitPDF(&pdf); 635 pdfDoc->close();
645 #endif 636 #endif
646 } 637 }
647 638
648 static void generate_xps(GM* gm, SkDynamicMemoryWStream& xps) { 639 static void generate_xps(GM* gm, SkDynamicMemoryWStream& xps) {
649 #ifdef SK_SUPPORT_XPS 640 #ifdef SK_SUPPORT_XPS
650 SkISize size = gm->getISize(); 641 SkISize size = gm->getISize();
651 642
652 SkSize trimSize = SkSize::Make(SkIntToScalar(size.width()), 643 SkSize trimSize = SkSize::Make(SkIntToScalar(size.width()),
653 SkIntToScalar(size.height())); 644 SkIntToScalar(size.height()));
654 static const SkScalar inchesPerMeter = SkScalarDiv(10000, 254); 645 static const SkScalar inchesPerMeter = SkScalarDiv(10000, 254);
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 if (FLAGS_forceBWtext) { 2245 if (FLAGS_forceBWtext) {
2255 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2246 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2256 } 2247 }
2257 } 2248 }
2258 2249
2259 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2250 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2260 int main(int argc, char * const argv[]) { 2251 int main(int argc, char * const argv[]) {
2261 return tool_main(argc, (char**) argv); 2252 return tool_main(argc, (char**) argv);
2262 } 2253 }
2263 #endif 2254 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698