OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 static SkData* encode_to_dct_data(size_t*, const SkBitmap& bitmap) { | 86 static SkData* encode_to_dct_data(size_t*, const SkBitmap& bitmap) { |
87 if (gJpegQuality == -1) { | 87 if (gJpegQuality == -1) { |
88 return NULL; | 88 return NULL; |
89 } | 89 } |
90 | 90 |
91 SkBitmap bm = bitmap; | 91 SkBitmap bm = bitmap; |
92 #if defined(SK_BUILD_FOR_MAC) | 92 #if defined(SK_BUILD_FOR_MAC) |
93 // Workaround bug #1043 where bitmaps with referenced pixels cause | 93 // Workaround bug #1043 where bitmaps with referenced pixels cause |
94 // CGImageDestinationFinalize to crash | 94 // CGImageDestinationFinalize to crash |
95 SkBitmap copy; | 95 SkBitmap copy; |
96 bitmap.deepCopyTo(©, bitmap.config()); | 96 bitmap.deepCopyTo(©); |
97 bm = copy; | 97 bm = copy; |
98 #endif | 98 #endif |
99 | 99 |
100 return SkImageEncoder::EncodeData(bm, | 100 return SkImageEncoder::EncodeData(bm, |
101 SkImageEncoder::kJPEG_Type, | 101 SkImageEncoder::kJPEG_Type, |
102 gJpegQuality); | 102 gJpegQuality); |
103 } | 103 } |
104 | 104 |
105 /** Builds the output filename. path = dir/name, and it replaces expected | 105 /** Builds the output filename. path = dir/name, and it replaces expected |
106 * .skp extension with .pdf extention. | 106 * .skp extension with .pdf extention. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 #endif | 296 #endif |
297 return 0; | 297 return 0; |
298 } | 298 } |
299 | 299 |
300 #if !defined SK_BUILD_FOR_IOS | 300 #if !defined SK_BUILD_FOR_IOS |
301 int main(int argc, char * const argv[]) { | 301 int main(int argc, char * const argv[]) { |
302 return tool_main(argc, (char**) argv); | 302 return tool_main(argc, (char**) argv); |
303 } | 303 } |
304 #endif | 304 #endif |
OLD | NEW |