| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void ImageFrame::setHasAlpha(bool alpha) | 112 void ImageFrame::setHasAlpha(bool alpha) |
| 113 { | 113 { |
| 114 m_bitmap.bitmap().setIsOpaque(!alpha); | 114 m_bitmap.bitmap().setIsOpaque(!alpha); |
| 115 } | 115 } |
| 116 | 116 |
| 117 #if PLATFORM(CHROMIUM) && OS(DARWIN) | 117 #if PLATFORM(CHROMIUM) && OS(DARWIN) |
| 118 static void resolveColorSpace(const SkBitmap& bitmap, CGColorSpaceRef colorSpace
) | 118 static void resolveColorSpace(const SkBitmap& bitmap, CGColorSpaceRef colorSpace
) |
| 119 { | 119 { |
| 120 int width = bitmap.width(); | 120 int width = bitmap.width(); |
| 121 int height = bitmap.height(); | 121 int height = bitmap.height(); |
| 122 CGImageRef srcImage = SkCreateCGImageRefWithColorspace(bitmap, colorSpace); | 122 RetainPtr<CGImageRef> srcImage(AdoptCF, SkCreateCGImageRefWithColorspace(bit
map, colorSpace)); |
| 123 SkAutoLockPixels lock(bitmap); | 123 SkAutoLockPixels lock(bitmap); |
| 124 void* pixels = bitmap.getPixels(); | 124 void* pixels = bitmap.getPixels(); |
| 125 RetainPtr<CGContextRef> cgBitmap(AdoptCF, CGBitmapContextCreate(pixels, widt
h, height, 8, width * 4, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Host | kC
GImageAlphaPremultipliedFirst)); | 125 RetainPtr<CGContextRef> cgBitmap(AdoptCF, CGBitmapContextCreate(pixels, widt
h, height, 8, width * 4, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Host | kC
GImageAlphaPremultipliedFirst)); |
| 126 if (!cgBitmap) | 126 if (!cgBitmap) |
| 127 return; | 127 return; |
| 128 CGContextSetBlendMode(cgBitmap.get(), kCGBlendModeCopy); | 128 CGContextSetBlendMode(cgBitmap.get(), kCGBlendModeCopy); |
| 129 CGRect bounds = { {0, 0}, {width, height} }; | 129 CGRect bounds = { {0, 0}, {width, height} }; |
| 130 CGContextDrawImage(cgBitmap.get(), bounds, srcImage); | 130 CGContextDrawImage(cgBitmap.get(), bounds, srcImage.get()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 static CGColorSpaceRef createColorSpace(const ColorProfile& colorProfile) | 133 static CGColorSpaceRef createColorSpace(const ColorProfile& colorProfile) |
| 134 { | 134 { |
| 135 RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(kCFAllocatorDefault, reinter
pret_cast<const UInt8*>(colorProfile.data()), colorProfile.size())); | 135 RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(kCFAllocatorDefault, reinter
pret_cast<const UInt8*>(colorProfile.data()), colorProfile.size())); |
| 136 #ifndef TARGETING_LEOPARD | 136 #ifndef TARGETING_LEOPARD |
| 137 return CGColorSpaceCreateWithICCProfile(data.get()); | 137 return CGColorSpaceCreateWithICCProfile(data.get()); |
| 138 #else | 138 #else |
| 139 RetainPtr<CGDataProviderRef> profileDataProvider(AdoptCF, CGDataProviderCrea
teWithCFData(data.get())); | 139 RetainPtr<CGDataProviderRef> profileDataProvider(AdoptCF, CGDataProviderCrea
teWithCFData(data.get())); |
| 140 CGFloat ranges[] = {0.0, 255.0, 0.0, 255.0, 0.0, 255.0}; | 140 CGFloat ranges[] = {0.0, 255.0, 0.0, 255.0, 0.0, 255.0}; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 { | 172 { |
| 173 return m_bitmap.bitmap().width(); | 173 return m_bitmap.bitmap().width(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 int ImageFrame::height() const | 176 int ImageFrame::height() const |
| 177 { | 177 { |
| 178 return m_bitmap.bitmap().height(); | 178 return m_bitmap.bitmap().height(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace WebCore | 181 } // namespace WebCore |
| OLD | NEW |