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
3 // found in the LICENSE file.
5 #include "ui/gfx/image/image_skia_rep.h"
9 ImageSkiaRep::ImageSkiaRep() : scale_(1.0f) {
12 ImageSkiaRep::~ImageSkiaRep() {
15 ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
16 bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
17 static_cast<int>(size.width() * scale),
18 static_cast<int>(size.height() * scale));
19 bitmap_.allocPixels();
22 ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale)
27 int ImageSkiaRep::GetWidth() const {
28 return static_cast<int>(bitmap_.width() / scale_);
31 int ImageSkiaRep::GetHeight() const {
32 return static_cast<int>(bitmap_.height() / scale_);