Add more components tests to GN build.
[chromium-blink-merge.git] / ui / gfx / nine_image_painter.h
blob594ea7235e8123779df7cde1dea8ff181c7fff09
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GFX_NINE_IMAGE_PAINTER_H_
6 #define UI_GFX_NINE_IMAGE_PAINTER_H_
8 #include <vector>
10 #include "base/logging.h"
11 #include "ui/gfx/gfx_export.h"
12 #include "ui/gfx/image/image_skia.h"
14 namespace gfx {
16 class Canvas;
17 class Insets;
18 class Rect;
20 class GFX_EXPORT NineImagePainter {
21 public:
22 explicit NineImagePainter(const std::vector<ImageSkia>& images);
23 NineImagePainter(const ImageSkia& image, const Insets& insets);
24 ~NineImagePainter();
26 bool IsEmpty() const;
27 Size GetMinimumSize() const;
28 void Paint(Canvas* canvas, const Rect& bounds);
29 void Paint(Canvas* canvas, const Rect& bounds, uint8 alpha);
31 private:
32 friend class NineImagePainterTest;
33 FRIEND_TEST_ALL_PREFIXES(NineImagePainterTest, GetSubsetRegions);
35 // Gets the regions for the subimages into |regions|.
36 static void GetSubsetRegions(const ImageSkia& image,
37 const Insets& insets,
38 std::vector<Rect>* regions);
40 // Images are numbered as depicted below.
41 // ____________________
42 // |__i0__|__i1__|__i2__|
43 // |__i3__|__i4__|__i5__|
44 // |__i6__|__i7__|__i8__|
45 ImageSkia images_[9];
47 DISALLOW_COPY_AND_ASSIGN(NineImagePainter);
50 } // namespace gfx
52 #endif // UI_GFX_NINE_IMAGE_PAINTER_H_