OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/painter.h" | 5 #include "ui/views/painter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 paint.setShader(s.get()); | 156 paint.setShader(s.get()); |
157 | 157 |
158 canvas->sk_canvas()->drawRectCoords(SkIntToScalar(0), SkIntToScalar(0), | 158 canvas->sk_canvas()->drawRectCoords(SkIntToScalar(0), SkIntToScalar(0), |
159 SkIntToScalar(size.width()), | 159 SkIntToScalar(size.width()), |
160 SkIntToScalar(size.height()), paint); | 160 SkIntToScalar(size.height()), paint); |
161 } | 161 } |
162 | 162 |
163 // ImagePainter --------------------------------------------------------------- | 163 // ImagePainter --------------------------------------------------------------- |
164 | 164 |
165 // ImagePainter stores and paints nine images as a scalable grid. | 165 // ImagePainter stores and paints nine images as a scalable grid. |
166 class VIEWS_EXPORT ImagePainter : public Painter { | 166 class ImagePainter : public Painter { |
167 public: | 167 public: |
168 // Constructs an ImagePainter with the specified image resource ids. | 168 // Constructs an ImagePainter with the specified image resource ids. |
169 // See CreateImageGridPainter()'s comment regarding image ID count and order. | 169 // See CreateImageGridPainter()'s comment regarding image ID count and order. |
170 explicit ImagePainter(const int image_ids[]); | 170 explicit ImagePainter(const int image_ids[]); |
171 | 171 |
172 // Constructs an ImagePainter with the specified image and insets. | 172 // Constructs an ImagePainter with the specified image and insets. |
173 ImagePainter(const gfx::ImageSkia& image, const gfx::Insets& insets); | 173 ImagePainter(const gfx::ImageSkia& image, const gfx::Insets& insets); |
174 | 174 |
175 virtual ~ImagePainter(); | 175 virtual ~ImagePainter(); |
176 | 176 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 314 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
315 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), | 315 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), |
316 0); | 316 0); |
317 canvas->TileImageInt( | 317 canvas->TileImageInt( |
318 *images_[CENTER], images_[LEFT]->width(), 0, | 318 *images_[CENTER], images_[LEFT]->width(), 0, |
319 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), | 319 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), |
320 images_[LEFT]->height()); | 320 images_[LEFT]->height()); |
321 } | 321 } |
322 | 322 |
323 } // namespace views | 323 } // namespace views |
OLD | NEW |