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

Unified Diff: trunk/src/ui/gfx/image/image_skia_rep.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/ui/gfx/image/image_skia_rep.h ('k') | trunk/src/ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/gfx/image/image_skia_rep.cc
===================================================================
--- trunk/src/ui/gfx/image/image_skia_rep.cc (revision 224498)
+++ trunk/src/ui/gfx/image/image_skia_rep.cc (working copy)
@@ -6,30 +6,41 @@
namespace gfx {
-ImageSkiaRep::ImageSkiaRep() : scale_(1.0f) {
+ImageSkiaRep::ImageSkiaRep()
+ : scale_factor_(ui::SCALE_FACTOR_NONE) {
}
ImageSkiaRep::~ImageSkiaRep() {
}
-ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
+ImageSkiaRep::ImageSkiaRep(const gfx::Size& size,
+ ui::ScaleFactor scale_factor)
+ : scale_factor_(scale_factor) {
+ float scale = ui::GetScaleFactorScale(scale_factor);
bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
static_cast<int>(size.width() * scale),
static_cast<int>(size.height() * scale));
bitmap_.allocPixels();
}
-ImageSkiaRep::ImageSkiaRep(const SkBitmap& src, float scale)
+ImageSkiaRep::ImageSkiaRep(const SkBitmap& src,
+ ui::ScaleFactor scale_factor)
: bitmap_(src),
- scale_(scale) {
+ scale_factor_(scale_factor) {
}
int ImageSkiaRep::GetWidth() const {
- return static_cast<int>(bitmap_.width() / scale_);
+ return static_cast<int>(bitmap_.width() /
+ ui::GetScaleFactorScale(scale_factor_));
}
int ImageSkiaRep::GetHeight() const {
- return static_cast<int>(bitmap_.height() / scale_);
+ return static_cast<int>(bitmap_.height() /
+ ui::GetScaleFactorScale(scale_factor_));
}
+float ImageSkiaRep::GetScale() const {
+ return ui::GetScaleFactorScale(scale_factor_);
+}
+
} // namespace gfx
« no previous file with comments | « trunk/src/ui/gfx/image/image_skia_rep.h ('k') | trunk/src/ui/gfx/image/image_skia_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698