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

Side by Side Diff: ui/gfx/image/image_skia_rep.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new usage of scale in FastShowPickler Created 7 years, 2 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
« no previous file with comments | « ui/gfx/image/image_skia_rep.h ('k') | ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gfx/image/image_skia_rep.h" 5 #include "ui/gfx/image/image_skia_rep.h"
6 6
7 namespace gfx { 7 namespace gfx {
8 8
9 ImageSkiaRep::ImageSkiaRep() 9 ImageSkiaRep::ImageSkiaRep() : scale_(1.0f) {
10 : scale_factor_(ui::SCALE_FACTOR_NONE) {
11 } 10 }
12 11
13 ImageSkiaRep::~ImageSkiaRep() { 12 ImageSkiaRep::~ImageSkiaRep() {
14 } 13 }
15 14
16 ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, 15 ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
17 ui::ScaleFactor scale_factor)
18 : scale_factor_(scale_factor) {
19 float scale = ui::GetScaleFactorScale(scale_factor);
20 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 16 bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
21 static_cast<int>(size.width() * scale), 17 static_cast<int>(size.width() * scale),
22 static_cast<int>(size.height() * scale)); 18 static_cast<int>(size.height() * scale));
23 bitmap_.allocPixels(); 19 bitmap_.allocPixels();
24 } 20 }
25 21
26 ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, 22 ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale)
27 ui::ScaleFactor scale_factor)
28 : bitmap_(src), 23 : bitmap_(src),
29 scale_factor_(scale_factor) { 24 scale_(scale) {
30 } 25 }
31 26
32 int ImageSkiaRep::GetWidth() const { 27 int ImageSkiaRep::GetWidth() const {
33 return static_cast<int>(bitmap_.width() / 28 return static_cast<int>(bitmap_.width() / scale_);
34 ui::GetScaleFactorScale(scale_factor_));
35 } 29 }
36 30
37 int ImageSkiaRep::GetHeight() const { 31 int ImageSkiaRep::GetHeight() const {
38 return static_cast<int>(bitmap_.height() / 32 return static_cast<int>(bitmap_.height() / scale_);
39 ui::GetScaleFactorScale(scale_factor_));
40 }
41
42 float ImageSkiaRep::GetScale() const {
43 return ui::GetScaleFactorScale(scale_factor_);
44 } 33 }
45 34
46 } // namespace gfx 35 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia_rep.h ('k') | ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698