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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/codec/tiff_codec.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/memory/scoped_nsobject.h"
10 #include "skia/ext/skia_utils_mac.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
12
13 namespace gfx {
14
15 bool TIFFCodec::Decode(const unsigned char* input, size_t input_size,
16 std::vector<SkBitmap>& bitmaps) {
17 scoped_nsobject<NSData> data([[NSData alloc]
18 initWithBytesNoCopy:const_cast<unsigned char*>(input)
19 length:input_size
20 freeWhenDone:NO]);
21 NSArray* image_reps = [NSBitmapImageRep imageRepsWithData:data];
22 if ([image_reps count] == 0)
23 return false;
24
25 for (NSBitmapImageRep* image_rep in image_reps) {
26 SkBitmap bitmap(NSImageRepToSkBitmap(image_rep, [image_rep size], false));
27 if (bitmap.isNull())
28 return false;
29 bitmaps.push_back(bitmap);
30 }
31
32 return true;
33 }
34
35 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698