Chromium Code Reviews| Index: ui/aura_shell/image_grid.h |
| diff --git a/ui/aura_shell/image_grid.h b/ui/aura_shell/image_grid.h |
| index a5ff264a33c8a1494aeed7959cc0cf6ae5d6b93c..47cd30d646af13e7ad0420363d1a306fc4269f44 100644 |
| --- a/ui/aura_shell/image_grid.h |
| +++ b/ui/aura_shell/image_grid.h |
| @@ -81,6 +81,19 @@ class AURA_SHELL_EXPORT ImageGrid { |
| // Returns |layer|'s bounds after applying the layer's current transform. |
| gfx::Rect GetTransformedLayerBounds(const ui::Layer& layer); |
| + gfx::Rect GetTopLeftClipRect() const { |
|
Ben Goodger (Google)
2011/12/06 19:27:03
I believe you can use unix_hacker for this type of
Daniel Erat
2011/12/06 21:34:18
Done.
|
| + return grid_->top_left_painter_->clip_rect_; |
| + } |
| + gfx::Rect GetTopRightClipRect() const { |
| + return grid_->top_right_painter_->clip_rect_; |
| + } |
| + gfx::Rect GetBottomLeftClipRect() const { |
| + return grid_->bottom_left_painter_->clip_rect_; |
| + } |
| + gfx::Rect GetBottomRightClipRect() const { |
| + return grid_->bottom_right_painter_->clip_rect_; |
| + } |
| + |
| private: |
| ImageGrid* grid_; // not owned |
| @@ -117,18 +130,29 @@ class AURA_SHELL_EXPORT ImageGrid { |
| ImagePainter(const gfx::Image* image) : image_(image) {} |
| virtual ~ImagePainter() {} |
| + // Clips |layer| to |clip_rect|. Triggers a repaint if the clipping |
| + // rectangle has changed. An empty rectangle disables clipping. |
| + void SetClipRect(const gfx::Rect& clip_rect, ui::Layer* layer); |
| + |
| // ui::LayerDelegate implementation: |
| virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| private: |
| + friend class TestAPI; |
| + |
| const gfx::Image* image_; // not owned |
| + gfx::Rect clip_rect_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ImagePainter); |
| }; |
| // Returns the dimensions of |image| if non-NULL or gfx::Size(0, 0) otherwise. |
| static gfx::Size GetImageSize(const gfx::Image* image); |
| + // Returns true if |layer|'s bounds don't fit within |size|. |
| + static bool LayerExceedsSize(const ui::Layer* layer, const gfx::Size& size); |
| + |
| // Initializes |layer_ptr| and |painter_ptr| to display |image|. |
| // Also adds the passed-in layer to |layer_|. |
| void InitImage(const gfx::Image* image, |