summaryrefslogtreecommitdiffstats
path: root/ui/gfx/image/canvas_image_source.cc
blob: b336b3118104f0a36c1d246f42d7bde7b0b379d2 (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
25
26
// Copyright (c) 2012 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/image/canvas_image_source.h"

#include "base/logging.h"
#include "ui/gfx/canvas.h"

namespace gfx {

////////////////////////////////////////////////////////////////////////////////
// CanvasImageSource

CanvasImageSource::CanvasImageSource(const gfx::Size& size, bool is_opaque)
    : size_(size),
      is_opaque_(is_opaque) {
}

gfx::ImageSkiaRep CanvasImageSource::GetImageForScale(float scale) {
  gfx::Canvas canvas(size_, scale, is_opaque_);
  Draw(&canvas);
  return canvas.ExtractImageRep();
}

}  // namespace gfx