Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: webkit/glue/image_decoder.cc

Issue 19535: Cleanup in webkit/glue/ (Closed)
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/image_decoder.h ('k') | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/image_decoder.cc
diff --git a/webkit/glue/image_decoder.cc b/webkit/glue/image_decoder.cc
index 9b4f294e9334127882abbf76ee19181383b5ac7a..b67e0bbcce2cbd28be83e8fb6c194c7b7bb9126a 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
}
« no previous file with comments | « webkit/glue/image_decoder.h ('k') | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698