diff options
Diffstat (limited to 'ash/wm/image_grid.cc')
-rw-r--r-- | ash/wm/image_grid.cc | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc index 2edb3f5..c9c982f 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)); |