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

Side by Side Diff: webkit/glue/image_decoder.cc

Issue 10828127: Use hi-resolution favicon variants if available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: daringfireball hackfix Created 8 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/image_decoder.h" 5 #include "webkit/glue/image_decoder.h"
6 6
7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" 7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 12 matching lines...) Expand all
23 23
24 ImageDecoder::~ImageDecoder() { 24 ImageDecoder::~ImageDecoder() {
25 } 25 }
26 26
27 SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) const { 27 SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) const {
28 const WebImage& image = WebImage::fromData( 28 const WebImage& image = WebImage::fromData(
29 WebData(reinterpret_cast<const char*>(data), size), desired_icon_size_); 29 WebData(reinterpret_cast<const char*>(data), size), desired_icon_size_);
30 return image.getSkBitmap(); 30 return image.getSkBitmap();
31 } 31 }
32 32
33 // static
34 std::vector<SkBitmap> ImageDecoder::DecodeAll(
35 const unsigned char* data, size_t size,
36 const std::vector<gfx::Size>& desired_sizes) {
37 WebKit::WebVector<WebKit::WebSize> sizes(desired_sizes.size());
38 for (size_t i = 0; i < desired_sizes.size(); ++i)
39 sizes[i] = desired_sizes[i];
40
41 const WebKit::WebVector<WebImage>& images = WebImage::framesFromData(
pkotwicz 2012/08/02 23:47:08 Nit: images -> bitmaps
42 WebData(reinterpret_cast<const char*>(data), size), sizes);
43
44 std::vector<SkBitmap> result;
45 result.resize(images.size());
46 for (size_t i = 0; i < images.size(); ++i)
47 result[i] = images[i].getSkBitmap();
48 return result;
49 }
50
33 } // namespace webkit_glue 51 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698