1 // Copyright (c) 2013 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 "content/public/child/image_decoder_utils.h"
6 
7 #include "third_party/blink/public/platform/web_data.h"
8 #include "third_party/blink/public/platform/web_size.h"
9 #include "third_party/blink/public/web/web_image.h"
10 #include "third_party/skia/include/core/SkBitmap.h"
11 
12 using blink::WebData;
13 using blink::WebImage;
14 
15 namespace content {
16 
DecodeImage(const unsigned char * data,const gfx::Size & desired_image_size,size_t size)17 SkBitmap DecodeImage(const unsigned char* data,
18                      const gfx::Size& desired_image_size,
19                      size_t size) {
20   WebData buffer(reinterpret_cast<const char*>(data), size);
21   return WebImage::FromData(buffer, desired_image_size);
22 }
23 
24 }  // namespace content
25