diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 11:38:10 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 11:38:10 +0000 |
commit | c4c01f7ef5c32e52abd09e6b826f82746282411f (patch) | |
tree | 3c34f4f13644d7831800b15a8206c2f50b711a7a /webkit/glue/image_decoder.cc | |
parent | ab0eb293ec91e528e6f6e64474687ef07127a718 (diff) | |
download | chromium_src-c4c01f7ef5c32e52abd09e6b826f82746282411f.zip chromium_src-c4c01f7ef5c32e52abd09e6b826f82746282411f.tar.gz chromium_src-c4c01f7ef5c32e52abd09e6b826f82746282411f.tar.bz2 |
Cleanup in webkit/glue/
- make more methods const
- remove unneeded #includes
BUG=7210
Review URL: http://codereview.chromium.org/19535
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/image_decoder.cc')
-rw-r--r-- | webkit/glue/image_decoder.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/webkit/glue/image_decoder.cc b/webkit/glue/image_decoder.cc index 9b4f294..b67e0bb 100644 --- a/webkit/glue/image_decoder.cc +++ b/webkit/glue/image_decoder.cc @@ -33,15 +33,15 @@ ImageDecoder::ImageDecoder(const gfx::Size& desired_icon_size) ImageDecoder::~ImageDecoder() { } -SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) { - +SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) const { + // What's going on here? ImageDecoder is only used by ImageResourceFetcher, // which is only used (but extensively) by WebViewImpl. On the Mac we're using // CoreGraphics, but right now WebViewImpl uses SkBitmaps everywhere. For now, // this is a convenient bottleneck to convert from CGImageRefs to SkBitmaps, // but in the future we will need to replumb to get CGImageRefs (or whatever // the native type is) everywhere, directly. - + #if defined(OS_WIN) || defined(OS_LINUX) WebCore::ImageSourceSkia source; #elif defined(OS_MACOSX) @@ -63,18 +63,18 @@ SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) { WebCore::NativeImagePtr frame0 = source.createFrameAtIndex(0); if (!frame0) return SkBitmap(); - + #if defined(OS_WIN) || defined(OS_LINUX) return *reinterpret_cast<SkBitmap*>(frame0); #elif defined(OS_MACOSX) // BitmapImage releases automatically, but we're bypassing it so we'll need // to do the releasing. RetainPtr<CGImageRef> image(AdoptCF, frame0); - + SkBitmap result; result.setConfig(SkBitmap::kARGB_8888_Config, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())); - + RetainPtr<CGColorSpace> cg_color(AdoptCF, CGColorSpaceCreateDeviceRGB()); // The last parameter is a total guess. Feel free to adjust it if images draw // incorrectly. TODO(avi): Verify byte ordering; it should be possible to @@ -93,7 +93,7 @@ SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) { CGImageGetWidth(image.get()), CGImageGetHeight(image.get())); CGContextDrawImage(context.get(), rect, image.get()); - + return result; #endif } |