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

Unified Diff: ui/gfx/codec/tiff_codec_mac.mm

Issue 6849030: Add support for multi resolution icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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
Index: ui/gfx/codec/tiff_codec_mac.mm
diff --git a/ui/gfx/codec/tiff_codec_mac.mm b/ui/gfx/codec/tiff_codec_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..20f9018a59cae859d9690fb989325bcef3458fcf
--- /dev/null
+++ b/ui/gfx/codec/tiff_codec_mac.mm
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/codec/tiff_codec.h"
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/memory/scoped_nsobject.h"
+#include "skia/ext/skia_utils_mac.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace gfx {
+
+bool TIFFCodec::Decode(const unsigned char* input, size_t input_size,
+ std::vector<SkBitmap>& bitmaps) {
+ scoped_nsobject<NSData> data([[NSData alloc]
+ initWithBytesNoCopy:const_cast<unsigned char*>(input)
+ length:input_size
+ freeWhenDone:NO]);
+ NSArray* image_reps = [NSBitmapImageRep imageRepsWithData:data];
+ if ([image_reps count] == 0)
+ return false;
+
+ for (NSBitmapImageRep* image_rep in image_reps) {
+ SkBitmap bitmap(NSImageRepToSkBitmap(image_rep, [image_rep size], false));
+ if (bitmap.isNull())
+ return false;
+ bitmaps.push_back(bitmap);
+ }
+
+ return true;
+}
+
+} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698