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

Unified Diff: ash/wm/image_grid.cc

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable tests that doesn't run on bots Created 8 years, 7 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 | « ash/wm/image_grid.h ('k') | ash/wm/image_grid_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/image_grid.cc
diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc
index 2edb3f52fb5b92ed57078ce9d6c9e6c67a0b0f5b..c9c982fae9bcaa8fe1513ab36fffa5d1eeeebf39 100644
--- a/ash/wm/image_grid.cc
+++ b/ash/wm/image_grid.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "ui/aura/dip_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/rect.h"
@@ -27,9 +26,8 @@ gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds(
return bounds;
}
-ImageGrid::ImageGrid(aura::Window* window)
- : window_(window),
- layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)),
+ImageGrid::ImageGrid()
+ : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)),
top_image_height_(0),
bottom_image_height_(0),
left_image_width_(0),
@@ -130,7 +128,7 @@ void ImageGrid::SetSize(const gfx::Size& size) {
if (center_height > 0) {
ui::Transform transform;
transform.SetScaleY(
- static_cast<float>(center_height) / left_layer_->bounds().height());
+ (static_cast<float>(center_height) / left_layer_->bounds().height()));
transform.ConcatTranslate(0, top);
left_layer_->SetTransform(transform);
}
@@ -206,21 +204,16 @@ void ImageGrid::SetSize(const gfx::Size& size) {
}
}
-void ImageGrid::SetContentBounds(const gfx::Rect& content_bounds_in_dip) {
-#if defined(ENABLE_DIP)
- // TODO(oshma): Scale the size of the shadow.
- const gfx::Rect content_bounds =
- aura::ConvertRectToPixel(window_, content_bounds_in_dip);
-#else
- const gfx::Rect& content_bounds = content_bounds_in_dip;
-#endif
+void ImageGrid::SetContentBounds(const gfx::Rect& content_bounds) {
SetSize(gfx::Size(
content_bounds.width() + left_image_width_ + right_image_width_,
- content_bounds.height() + top_image_height_ + bottom_image_height_));
- layer_->SetBounds(gfx::Rect(content_bounds.x() - left_image_width_,
- content_bounds.y() - top_image_height_,
- layer_->bounds().width(),
- layer_->bounds().height()));
+ content_bounds.height() + top_image_height_ +
+ bottom_image_height_));
+ layer_->SetBounds(
+ gfx::Rect(content_bounds.x() - left_image_width_,
+ content_bounds.y() - top_image_height_,
+ layer_->bounds().width(),
+ layer_->bounds().height()));
}
void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect,
@@ -267,13 +260,7 @@ void ImageGrid::SetImage(const gfx::Image* image,
// Set up the new layer and painter.
layer_ptr->reset(new ui::Layer(ui::LAYER_TEXTURED));
-#if defined(ENABLE_DIP)
- const gfx::Size size =
- aura::ConvertSizeToPixel(window_, GetImageSize(image));
-#else
const gfx::Size size = GetImageSize(image);
-#endif
-
layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height()));
painter_ptr->reset(new ImagePainter(image));
« no previous file with comments | « ash/wm/image_grid.h ('k') | ash/wm/image_grid_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698