Changeset 70846 in webkit
- Timestamp:
- Oct 28, 2010 11:55:48 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70844 r70846 1 2010-10-28 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel, Peter Kasting, and Darin Fisher. 4 (Eric reviewed the CoreGraphics interactions, Peter reviewed the image 5 decoder interaction, and Darin Fisher SGTMed the policy decision.) 6 7 [chromium] Chromium Mac should use WebKit's image decoders 8 https://bugs.webkit.org/show_bug.cgi?id=47974 9 10 This patch teaches WebKit's image decoders how to talk to CoreGraphics. 11 This patch doesn't handle color profiles, but that will come in a 12 subsequent patch. 13 14 * WebCore.gyp/WebCore.gyp: 15 * WebCore.gypi: 16 * loader/CachedImage.cpp: 17 (WebCore::CachedImage::createImage): 18 * platform/graphics/ImageSource.h: 19 * platform/image-decoders/ImageDecoder.cpp: 20 (WebCore::RGBA32Buffer::clear): 21 (WebCore::RGBA32Buffer::zeroFill): 22 (WebCore::RGBA32Buffer::copyBitmapData): 23 (WebCore::RGBA32Buffer::setSize): 24 * platform/image-decoders/ImageDecoder.h: 25 (WebCore::RGBA32Buffer::getAddr): 26 * platform/image-decoders/cg: Added. 27 * platform/image-decoders/cg/ImageDecoderCG.cpp: Added. 28 (WebCore::RGBA32Buffer::copyBitmapData): 29 (WebCore::RGBA32Buffer::setSize): 30 (WebCore::RGBA32Buffer::asNewNativeImage): 31 1 32 2010-10-28 Sergio Villar Senin <svillar@igalia.com> 2 33 -
trunk/WebCore/WebCore.gyp/WebCore.gyp
r70394 r70846 1165 1165 ['exclude', 'platform/graphics/chromium/ImageChromium\\.cpp$'], 1166 1166 1167 # The Mac uses ImageSourceCG.cpp from platform/graphics/cg, included 1168 # by regex above, instead. 1169 ['exclude', 'platform/graphics/ImageSource\\.cpp$'], 1170 1171 # Skia image-decoders are also not used on mac. CoreGraphics 1172 # is used directly instead. 1173 ['exclude', 'platform/image-decoders/ImageDecoder\\.h$'], 1174 ['exclude', 'platform/image-decoders/bmp/BMPImageDecoder\\.(cpp|h)$'], 1175 ['exclude', 'platform/image-decoders/bmp/BMPImageReader\\.(cpp|h)$'], 1176 ['exclude', 'platform/image-decoders/gif/GIFImageDecoder\\.(cpp|h)$'], 1177 ['exclude', 'platform/image-decoders/gif/GIFImageReader\\.(cpp|h)$'], 1178 ['exclude', 'platform/image-decoders/ico/ICOImageDecoder\\.(cpp|h)$'], 1179 ['exclude', 'platform/image-decoders/jpeg/JPEGImageDecoder\\.(cpp|h)$'], 1180 ['exclude', 'platform/image-decoders/webp/WEBPImageDecoder\\.(cpp|h)$'], 1181 ['exclude', 'platform/image-decoders/png/PNGImageDecoder\\.(cpp|h)$'], 1167 # The Mac does not use ImageSourceCG.cpp from platform/graphics/cg 1168 # even though it is included by regex above. 1169 ['exclude', 'platform/graphics/cg/ImageSourceCG\\.cpp$'], 1170 ['exclude', 'platform/graphics/cg/PDFDocumentImage\\.cpp$'], 1171 1172 # ImageDecoderSkia is not used on mac. ImageDecoderCG is used instead. 1182 1173 ['exclude', 'platform/image-decoders/skia/ImageDecoderSkia\\.cpp$'], 1183 [' exclude', 'platform/image-decoders/xbm/XBMImageDecoder\\.(cpp|h)$'],1174 ['include', 'platform/image-decoders/cg/ImageDecoderCG\\.cpp$'], 1184 1175 1185 1176 # Again, Skia is not used on Mac. -
trunk/WebCore/WebCore.gypi
r70745 r70846 2852 2852 'platform/image-decoders/bmp/BMPImageReader.h', 2853 2853 'platform/image-decoders/cairo/ImageDecoderCairo.cpp', 2854 'platform/image-decoders/cg/ImageDecoderCG.cpp', 2854 2855 'platform/image-decoders/gif/GIFImageDecoder.cpp', 2855 2856 'platform/image-decoders/gif/GIFImageDecoder.h', -
trunk/WebCore/loader/CachedImage.cpp
r70394 r70846 238 238 if (m_image) 239 239 return; 240 #if PLATFORM(CG) 240 #if PLATFORM(CG) && !USE(WEBKIT_IMAGE_DECODERS) 241 241 if (m_response.mimeType() == "application/pdf") { 242 242 m_image = PDFDocumentImage::create(); -
trunk/WebCore/platform/graphics/ImageSource.h
r70394 r70846 64 64 65 65 #if PLATFORM(CG) 66 #if USE(WEBKIT_IMAGE_DECODERS) 67 class ImageDecoder; 68 typedef ImageDecoder* NativeImageSourcePtr; 69 #else 66 70 typedef CGImageSourceRef NativeImageSourcePtr; 71 #endif 67 72 typedef CGImageRef NativeImagePtr; 68 73 #elif PLATFORM(OPENVG) -
trunk/WebCore/platform/image-decoders/ImageDecoder.cpp
r70394 r70846 118 118 return *this; 119 119 120 copy BitmapData(other);120 copyReferenceToBitmapData(other); 121 121 setRect(other.rect()); 122 122 setStatus(other.status()); … … 129 129 void RGBA32Buffer::clear() 130 130 { 131 m_bytes.clear(); 131 m_backingStore.clear(); 132 m_bytes = 0; 132 133 m_status = FrameEmpty; 133 134 // NOTE: Do not reset other members here; clearFrameBufferCache() calls this … … 139 140 void RGBA32Buffer::zeroFill() 140 141 { 141 m _bytes.fill(0);142 memset(m_bytes, 0, m_size.width() * m_size.height() * sizeof(PixelData)); 142 143 m_hasAlpha = true; 144 } 145 146 #if !PLATFORM(CF) 147 148 void RGBA32Buffer::copyReferenceToBitmapData(const RGBA32Buffer& other) 149 { 150 ASSERT(this != &other); 151 copyBitmapData(other); 143 152 } 144 153 … … 148 157 return true; 149 158 150 m_bytes = other.m_bytes; 159 m_backingStore = other.m_backingStore; 160 m_bytes = m_backingStore.data(); 151 161 m_size = other.m_size; 152 162 setHasAlpha(other.m_hasAlpha); … … 158 168 // NOTE: This has no way to check for allocation failure if the requested 159 169 // size was too big... 160 m_bytes.resize(newWidth * newHeight); 170 m_backingStore.resize(newWidth * newHeight); 171 m_bytes = m_backingStore.data(); 161 172 m_size = IntSize(newWidth, newHeight); 162 173 … … 166 177 return true; 167 178 } 179 180 #endif 168 181 169 182 bool RGBA32Buffer::hasAlpha() const -
trunk/WebCore/platform/image-decoders/ImageDecoder.h
r70394 r70846 86 86 // Creates a new copy of the image data in |other|, so the two images 87 87 // can be modified independently. Returns whether the copy succeeded. 88 bool copyBitmapData(const RGBA32Buffer& other); 88 bool copyBitmapData(const RGBA32Buffer&); 89 90 // Creates a new reference to the image data in |other|. The two images 91 // share a common backing store. 92 void copyReferenceToBitmapData(const RGBA32Buffer&); 89 93 90 94 // Copies the pixel data at [(startX, startY), (endX, startY)) to the … … 138 142 139 143 private: 144 #if PLATFORM(CF) 145 typedef RetainPtr<CFMutableDataRef> NativeBackingStore; 146 #else 147 typedef Vector<PixelData> NativeBackingStore; 148 #endif 149 140 150 int width() const; 141 151 int height() const; … … 150 160 return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x; 151 161 #else 152 return m_bytes .data()+ (y * width()) + x;162 return m_bytes + (y * width()) + x; 153 163 #endif 154 164 } … … 177 187 IntSize m_size; 178 188 #else 179 Vector<PixelData> m_bytes; 180 IntSize m_size; // The size of the buffer. This should be the 181 // same as ImageDecoder::m_size. 182 bool m_hasAlpha; // Whether or not any of the pixels in the buffer 183 // have transparency. 184 #endif 185 IntRect m_rect; // The rect of the original specified frame within 186 // the overall buffer. This will always just be 187 // the entire buffer except for GIF frames whose 188 // original rect was smaller than the overall 189 // image size. 189 NativeBackingStore m_backingStore; 190 PixelData* m_bytes; // The memory is backed by m_backingStore. 191 IntSize m_size; // The size of the buffer. This should be the 192 // same as ImageDecoder::m_size. 193 bool m_hasAlpha; // Whether or not any of the pixels in the buffer 194 // have transparency. 195 #endif 196 IntRect m_rect; // The rect of the original specified frame within 197 // the overall buffer. This will always just be 198 // the entire buffer except for GIF frames whose 199 // original rect was smaller than the overall 200 // image size. 190 201 FrameStatus m_status; // Whether or not this frame is completely 191 202 // finished decoding. 192 unsigned m_duration; // The animation delay. 193 FrameDisposalMethod m_disposalMethod; 194 // What to do with this frame's data when 195 // initializing the next frame. 196 bool m_premultiplyAlpha; 197 // Whether to premultiply alpha into R, G, B 198 // channels; by default it's true. 203 unsigned m_duration; // The animation delay. 204 FrameDisposalMethod m_disposalMethod; // What to do with this frame's data when 205 // initializing the next frame. 206 bool m_premultiplyAlpha; // Whether to premultiply alpha into R, G, B 207 // channels; by default it's true. 199 208 }; 200 209 -
trunk/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp
r70394 r70846 35 35 return cairo_image_surface_create_for_data( 36 36 reinterpret_cast<unsigned char*>(const_cast<PixelData*>( 37 m_bytes .data())), CAIRO_FORMAT_ARGB32, width(), height(),37 m_bytes)), CAIRO_FORMAT_ARGB32, width(), height(), 38 38 width() * sizeof(PixelData)); 39 39 } -
trunk/WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp
r70394 r70846 37 37 OwnPtr<BBitmap> bitmap(new BBitmap(BRect(0, 0, width() - 1, height() - 1), 0, B_RGBA32, bytesPerRow)); 38 38 39 const uint8* source = reinterpret_cast<const uint8*>(m_bytes .data());39 const uint8* source = reinterpret_cast<const uint8*>(m_bytes); 40 40 uint8* destination = reinterpret_cast<uint8*>(bitmap->Bits()); 41 41 int h = height(); -
trunk/WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp
r70394 r70846 60 60 ASSERT_VG_NO_ERROR(); 61 61 62 PixelData* pixelData = const_cast<PixelData*>(m_bytes .data());62 PixelData* pixelData = const_cast<PixelData*>(m_bytes); 63 63 pixelData += (tileRect.y() * width()) + tileRect.x(); 64 64 -
trunk/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
r70394 r70846 49 49 // This code works properly on both ppc and intel, meaning the issue is 50 50 // likely not an issue of byte order getting mixed up on different archs. 51 const unsigned char* bytes = (const unsigned char*)m_bytes .data();51 const unsigned char* bytes = (const unsigned char*)m_bytes; 52 52 int rowCounter = 0; 53 53 long pixelCounter = 0; 54 54 WxPixelData::Iterator p(data); 55 55 WxPixelData::Iterator rowStart = p; 56 for (size_t i = 0; i < m_ bytes.size() * sizeof(PixelData); i += sizeof(PixelData)) {56 for (size_t i = 0; i < m_size.width() * m_size.height() * sizeof(PixelData); i += sizeof(PixelData)) { 57 57 p.Red() = bytes[i + 2]; 58 58 p.Green() = bytes[i + 1]; -
trunk/WebKit/chromium/ChangeLog
r70823 r70846 1 2010-10-28 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel, Peter Kasting, and Darin Fisher. 4 (Eric reviewed the CoreGraphics interactions, Peter reviewed the image 5 decoder interaction, and Darin Fisher SGTMed the policy decision.) 6 7 [chromium] Chromium Mac should use WebKit's image decoders 8 https://bugs.webkit.org/show_bug.cgi?id=47974 9 10 Enable WebKit's image decoders. 11 12 * features.gypi: 13 1 14 2010-10-28 Mihai Parparita <mihaip@chromium.org> 2 15 -
trunk/WebKit/chromium/features.gypi
r70712 r70846 90 90 'WTF_USE_ACCELERATED_COMPOSITING=1', 91 91 'WTF_USE_WEBP=1', 92 'WTF_USE_WEBKIT_IMAGE_DECODERS=1', 92 93 ], 93 94
Note: See TracChangeset
for help on using the changeset viewer.