summaryrefslogtreecommitdiff
path: root/chromium/content/child/image_decoder_utils.cc
blob: a9058b5c90ce5c2bb6015da860ffaee22ee27e2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (c) 2013 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 "content/public/child/image_decoder_utils.h"

#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/web/web_image.h"
#include "third_party/skia/include/core/SkBitmap.h"

using blink::WebData;
using blink::WebImage;

namespace content {

SkBitmap DecodeImage(const unsigned char* data,
                     const gfx::Size& desired_image_size,
                     size_t size) {
  WebData buffer(reinterpret_cast<const char*>(data), size);
  return WebImage::FromData(buffer, desired_image_size);
}

}  // namespace content