| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkCGUtils.h" | 8 #include "SkCGUtils.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool upscaleTo32; | 87 bool upscaleTo32; |
| 88 if (!getBitmapInfo(bm, bitsPerComponent, info, &upscaleTo32)) { | 88 if (!getBitmapInfo(bm, bitsPerComponent, info, &upscaleTo32)) { |
| 89 return NULL; | 89 return NULL; |
| 90 } | 90 } |
| 91 | 91 |
| 92 SkBitmap* copy; | 92 SkBitmap* copy; |
| 93 if (upscaleTo32) { | 93 if (upscaleTo32) { |
| 94 copy = new SkBitmap; | 94 copy = new SkBitmap; |
| 95 // here we make a ceep copy of the pixels, since CG won't take our | 95 // here we make a ceep copy of the pixels, since CG won't take our |
| 96 // 565 directly | 96 // 565 directly |
| 97 bm.copyTo(copy, SkBitmap::kARGB_8888_Config); | 97 bm.copyTo(copy, kPMColor_SkColorType); |
| 98 } else { | 98 } else { |
| 99 copy = new SkBitmap(bm); | 99 copy = new SkBitmap(bm); |
| 100 } | 100 } |
| 101 return copy; | 101 return copy; |
| 102 } | 102 } |
| 103 | 103 |
| 104 CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, | 104 CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, |
| 105 CGColorSpaceRef colorSpace) { | 105 CGColorSpaceRef colorSpace) { |
| 106 size_t bitsPerComponent SK_INIT_TO_AVOID_WARNING; | 106 size_t bitsPerComponent SK_INIT_TO_AVOID_WARNING; |
| 107 CGBitmapInfo info SK_INIT_TO_AVOID_WARNING; | 107 CGBitmapInfo info SK_INIT_TO_AVOID_WARNING; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 CGColorSpaceRelease(cs); | 224 CGColorSpaceRelease(cs); |
| 225 | 225 |
| 226 if (ctx) { | 226 if (ctx) { |
| 227 CGContextDrawPDFPage(ctx, page); | 227 CGContextDrawPDFPage(ctx, page); |
| 228 CGContextRelease(ctx); | 228 CGContextRelease(ctx); |
| 229 } | 229 } |
| 230 | 230 |
| 231 output->swap(bitmap); | 231 output->swap(bitmap); |
| 232 return true; | 232 return true; |
| 233 } | 233 } |
| OLD | NEW |