OLD | NEW |
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 return pdfDoc->close(); | 697 return pdfDoc->close(); |
698 } else { | 698 } else { |
699 SkISize pageSize = gm->getISize(); | 699 SkISize pageSize = gm->getISize(); |
700 SkPDFDevice* dev = NULL; | 700 SkPDFDevice* dev = NULL; |
701 if (initialTransform.isIdentity()) { | 701 if (initialTransform.isIdentity()) { |
702 dev = new SkPDFDevice(pageSize, pageSize, initialTransform); | 702 dev = new SkPDFDevice(pageSize, pageSize, initialTransform); |
703 } else { | 703 } else { |
704 SkRect content = SkRect::MakeWH(SkIntToScalar(pageSize.width()), | 704 SkRect content = SkRect::MakeWH(SkIntToScalar(pageSize.width()), |
705 SkIntToScalar(pageSize.height())
); | 705 SkIntToScalar(pageSize.height())
); |
706 initialTransform.mapRect(&content); | 706 initialTransform.mapRect(&content); |
707 if (!content.intersect(0, 0, SkIntToScalar(pageSize.width()), | 707 content.intersect(0, 0, SkIntToScalar(pageSize.width()), |
708 SkIntToScalar(pageSize.height()))) { | 708 SkIntToScalar(pageSize.height())); |
709 content.setEmpty(); | |
710 } | |
711 SkISize contentSize = | 709 SkISize contentSize = |
712 SkISize::Make(SkScalarRoundToInt(content.width()), | 710 SkISize::Make(SkScalarRoundToInt(content.width()), |
713 SkScalarRoundToInt(content.height())); | 711 SkScalarRoundToInt(content.height())); |
714 dev = new SkPDFDevice(pageSize, contentSize, initialTransform); | 712 dev = new SkPDFDevice(pageSize, contentSize, initialTransform); |
715 } | 713 } |
716 dev->setDCTEncoder(encode_to_dct_data); | 714 dev->setDCTEncoder(encode_to_dct_data); |
717 dev->setRasterDpi(SkIntToScalar(FLAGS_pdfRasterDpi)); | 715 dev->setRasterDpi(SkIntToScalar(FLAGS_pdfRasterDpi)); |
718 SkAutoUnref aur(dev); | 716 SkAutoUnref aur(dev); |
719 SkCanvas c(dev); | 717 SkCanvas c(dev); |
720 invokeGM(gm, &c, true, false); | 718 invokeGM(gm, &c, true, false); |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 if (FLAGS_forceBWtext) { | 2580 if (FLAGS_forceBWtext) { |
2583 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2581 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2584 } | 2582 } |
2585 } | 2583 } |
2586 | 2584 |
2587 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2585 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2588 int main(int argc, char * const argv[]) { | 2586 int main(int argc, char * const argv[]) { |
2589 return tool_main(argc, (char**) argv); | 2587 return tool_main(argc, (char**) argv); |
2590 } | 2588 } |
2591 #endif | 2589 #endif |
OLD | NEW |