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