diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 03:58:36 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 03:58:36 +0000 |
commit | 24c5f806d56295db837aa0bd8adf0b307a52176f (patch) | |
tree | 76fa1f16a62f63f4487264bc6a310727cccb86bb | |
parent | d89a55cd29b3a8b0b9537758c347ef87e9b99a49 (diff) | |
download | chromium_src-24c5f806d56295db837aa0bd8adf0b307a52176f.zip chromium_src-24c5f806d56295db837aa0bd8adf0b307a52176f.tar.gz chromium_src-24c5f806d56295db837aa0bd8adf0b307a52176f.tar.bz2 |
Revert 195969 "Revert 195908 "Stretch ImagePainter edge images i..."
> Revert 195908 "Stretch ImagePainter edge images instead of tiling."
>
> Probably causing content_browsertest failures:
> http://build.chromium.org/p/chromium.win/builders/Win%20Aura%20Tests%20%281%29/builds/3398
>
> > Stretch ImagePainter edge images instead of tiling.
> >
> > BUG=218968,161374
> > TEST=Infobar buttons look correct (no broken gradient); no button appearance regressions.
> > R=sky@chromium.org
> >
> > Review URL: https://chromiumcodereview.appspot.com/13986008
>
> TBR=msw@chromium.org
>
> Review URL: https://codereview.chromium.org/13825011
TBR=kalman@chromium.org
Review URL: https://codereview.chromium.org/14104003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196022 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/views/painter.cc | 17 | ||||
-rw-r--r-- | ui/views/painter.h | 6 |
2 files changed, 13 insertions, 10 deletions
diff --git a/ui/views/painter.cc b/ui/views/painter.cc index e461185..62026ac 100644 --- a/ui/views/painter.cc +++ b/ui/views/painter.cc @@ -73,6 +73,11 @@ class GradientPainter : public Painter { DISALLOW_COPY_AND_ASSIGN(GradientPainter); }; +// A helper fuction to stretch the given image over the specified canvas area. +void Fill(gfx::Canvas* c, const gfx::ImageSkia& i, int x, int y, int w, int h) { + c->DrawImageInt(i, 0, 0, i.width(), i.height(), x, y, w, h, false); +} + // ImagePainter stores and paints nine images as a scalable grid. class VIEWS_EXPORT ImagePainter : public Painter { public: @@ -147,15 +152,13 @@ void ImagePainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { rect.bottom() - images_[6].height(), rect.bottom() }; canvas->DrawImageInt(images_[0], x[0], y[0]); - canvas->TileImageInt(images_[1], x[1], y[0], x[2] - x[1], y[1] - y[0]); + Fill(canvas, images_[1], x[1], y[0], x[2] - x[1], y[1] - y[0]); canvas->DrawImageInt(images_[2], x[2], y[0]); - canvas->TileImageInt(images_[3], x[0], y[1], x[1] - x[0], y[2] - y[1]); - canvas->DrawImageInt( - images_[4], 0, 0, images_[4].width(), images_[4].height(), - x[1], y[1], x[2] - x[1], y[2] - y[1], false); - canvas->TileImageInt(images_[5], x[2], y[1], x[3] - x[2], y[2] - y[1]); + Fill(canvas, images_[3], x[0], y[1], x[1] - x[0], y[2] - y[1]); + Fill(canvas, images_[4], x[1], y[1], x[2] - x[1], y[2] - y[1]); + Fill(canvas, images_[5], x[2], y[1], x[3] - x[2], y[2] - y[1]); canvas->DrawImageInt(images_[6], 0, y[2]); - canvas->TileImageInt(images_[7], x[1], y[2], x[2] - x[1], y[3] - y[2]); + Fill(canvas, images_[7], x[1], y[2], x[2] - x[1], y[3] - y[2]); canvas->DrawImageInt(images_[8], x[2], y[2]); } diff --git a/ui/views/painter.h b/ui/views/painter.h index d4b0daa..ffbd05b 100644 --- a/ui/views/painter.h +++ b/ui/views/painter.h @@ -50,14 +50,14 @@ class VIEWS_EXPORT Painter { // Creates a painter that divides |image| into nine regions. The four corners // are rendered at the size specified in insets (eg. the upper-left corner is - // rendered at 0 x 0 with a size of insets.left() x insets.top()). The four - // edges are tiled and the center is stretched to fill the destination size. + // rendered at 0 x 0 with a size of insets.left() x insets.top()). The center + // image and four edge images are stretched to fill the destination size. static Painter* CreateImagePainter(const gfx::ImageSkia& image, const gfx::Insets& insets); // Creates a painter that paints nine images as a scalable grid. The four // corners are rendered in their full sizes (they are assumed to share widths - // by column and heights by row). The four edges are tiled and the center is + // by column and heights by row). The center image and four edge images are // stretched to fill the destination size. // |image_ids| must contain nine image IDs specified in this order: Top-Left, // Top, Top-Right, Left, Center, Right, Bottom-Left, Bottom, Bottom-Right. |