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

Unified Diff: ui/wm/core/image_grid.h

Issue 302513002: Ensure min size (20 dip) for images used in ImageGrid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | ui/wm/core/image_grid.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/image_grid.h
diff --git a/ui/wm/core/image_grid.h b/ui/wm/core/image_grid.h
index bee1e46745263a1392a153df0fae0f2eba1679ba..987ee26c726fb819d117613ac62f405d419cba64 100644
--- a/ui/wm/core/image_grid.h
+++ b/ui/wm/core/image_grid.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_delegate.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
#include "ui/wm/wm_export.h"
@@ -128,7 +129,7 @@ class WM_EXPORT ImageGrid {
// Delegate responsible for painting a specific image on a layer.
class ImagePainter : public ui::LayerDelegate {
public:
- ImagePainter(const gfx::Image* image) : image_(image) {}
+ ImagePainter(const gfx::ImageSkia& image) : image_(image) {}
virtual ~ImagePainter() {}
// Clips |layer| to |clip_rect|. Triggers a repaint if the clipping
@@ -143,35 +144,29 @@ class WM_EXPORT ImageGrid {
private:
friend class TestAPI;
- const gfx::Image* image_; // not owned
+ const gfx::ImageSkia image_;
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);
+ enum ImageType {
+ HORIZONTAL,
+ VERTICAL,
+ NONE,
+ };
// Sets |layer_ptr| and |painter_ptr| to display |image| and adds the
// passed-in layer to |layer_|. If image is NULL resets |layer_ptr| and
// |painter_ptr| and removes any existing layer from |layer_|.
+ // If |type| is either HORIZONTAL or VERTICAL, it may resize the image to
+ // guarantee that it has minimum size in order for scaling work properly
+ // with fractional device scale factors. crbug.com/376519.
void SetImage(const gfx::Image* image,
scoped_ptr<ui::Layer>* layer_ptr,
- scoped_ptr<ImagePainter>* painter_ptr);
-
- // Sets the scaling for the transform applied to a layer. The left, top,
- // right and bottom layers are stretched to the height or width of the
- // center image.
- void ScaleWidth(gfx::Size center,
- ui::Layer* layer,
- gfx::Transform& transform);
- void ScaleHeight(gfx::Size center,
- ui::Layer* layer,
- gfx::Transform& transform);
+ scoped_ptr<ImagePainter>* painter_ptr,
+ ImageType type);
// Layer that contains all of the image layers.
scoped_ptr<ui::Layer> layer_;
« no previous file with comments | « no previous file | ui/wm/core/image_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698