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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 static SkData* encode_to_dct_data(size_t*, const SkBitmap& bitmap) { | 1491 static SkData* encode_to_dct_data(size_t*, const SkBitmap& bitmap) { |
1492 // Filter output of warnings that JPEG is not available for the image. | 1492 // Filter output of warnings that JPEG is not available for the image. |
1493 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return NULL; | 1493 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return NULL; |
1494 if (FLAGS_pdfJpegQuality == -1) return NULL; | 1494 if (FLAGS_pdfJpegQuality == -1) return NULL; |
1495 | 1495 |
1496 SkBitmap bm = bitmap; | 1496 SkBitmap bm = bitmap; |
1497 #if defined(SK_BUILD_FOR_MAC) | 1497 #if defined(SK_BUILD_FOR_MAC) |
1498 // Workaround bug #1043 where bitmaps with referenced pixels cause | 1498 // Workaround bug #1043 where bitmaps with referenced pixels cause |
1499 // CGImageDestinationFinalize to crash | 1499 // CGImageDestinationFinalize to crash |
1500 SkBitmap copy; | 1500 SkBitmap copy; |
1501 bitmap.deepCopyTo(©, bitmap.config()); | 1501 bitmap.deepCopyTo(©); |
1502 bm = copy; | 1502 bm = copy; |
1503 #endif | 1503 #endif |
1504 | 1504 |
1505 SkPixelRef* pr = bm.pixelRef(); | 1505 SkPixelRef* pr = bm.pixelRef(); |
1506 if (pr != NULL) { | 1506 if (pr != NULL) { |
1507 SkData* data = pr->refEncodedData(); | 1507 SkData* data = pr->refEncodedData(); |
1508 if (data != NULL) { | 1508 if (data != NULL) { |
1509 return data; | 1509 return data; |
1510 } | 1510 } |
1511 } | 1511 } |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 if (FLAGS_forceBWtext) { | 2420 if (FLAGS_forceBWtext) { |
2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2422 } | 2422 } |
2423 } | 2423 } |
2424 | 2424 |
2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2426 int main(int argc, char * const argv[]) { | 2426 int main(int argc, char * const argv[]) { |
2427 return tool_main(argc, (char**) argv); | 2427 return tool_main(argc, (char**) argv); |
2428 } | 2428 } |
2429 #endif | 2429 #endif |
OLD | NEW |