diff options
Diffstat (limited to 'ui/aura_shell/image_grid.h')
-rw-r--r-- | ui/aura_shell/image_grid.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ui/aura_shell/image_grid.h b/ui/aura_shell/image_grid.h index a5ff264..892ab7f0 100644 --- a/ui/aura_shell/image_grid.h +++ b/ui/aura_shell/image_grid.h @@ -78,6 +78,19 @@ class AURA_SHELL_EXPORT ImageGrid { return grid_->bottom_right_layer_.get(); } + gfx::Rect top_left_clip_rect() const { + return grid_->top_left_painter_->clip_rect_; + } + gfx::Rect top_right_clip_rect() const { + return grid_->top_right_painter_->clip_rect_; + } + gfx::Rect bottom_left_clip_rect() const { + return grid_->bottom_left_painter_->clip_rect_; + } + gfx::Rect bottom_right_clip_rect() const { + return grid_->bottom_right_painter_->clip_rect_; + } + // Returns |layer|'s bounds after applying the layer's current transform. gfx::Rect GetTransformedLayerBounds(const ui::Layer& layer); @@ -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, |