OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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. | |
4 | |
5 #ifndef UI_GFX_COMPOSITOR_TEST_TEST_TEXTURE_H_ | |
6 #define UI_GFX_COMPOSITOR_TEST_TEST_TEXTURE_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "ui/gfx/compositor/compositor.h" | |
12 #include "ui/gfx/rect.h" | |
13 | |
14 namespace ui { | |
15 | |
16 // Texture implementation that TextCompositor creates. Doesn't actually draw | |
17 // anything. | |
18 class TestTexture : public ui::Texture { | |
19 public: | |
20 TestTexture(); | |
21 virtual ~TestTexture(); | |
22 | |
23 // Number of textures that have been created. | |
24 static void reset_live_count() { live_count_ = 0; } | |
25 static int live_count() { return live_count_; } | |
26 | |
27 // Bounds of the last bitmap passed to SetCanvas. | |
28 const gfx::Rect& bounds_of_last_paint() const { | |
29 return bounds_of_last_paint_; | |
30 } | |
31 | |
32 // ui::Texture | |
33 virtual void SetCanvas(const SkCanvas& canvas, | |
34 const gfx::Point& origin, | |
35 const gfx::Size& overall_size) OVERRIDE; | |
36 virtual void Draw(const ui::TextureDrawParams& params, | |
37 const gfx::Rect& clip_bounds) OVERRIDE; | |
38 | |
39 private: | |
40 // Number of live instances. | |
41 static int live_count_; | |
42 | |
43 gfx::Rect bounds_of_last_paint_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(TestTexture); | |
46 }; | |
47 | |
48 } // namespace ui | |
49 | |
50 #endif // UI_GFX_COMPOSITOR_TEST_TEST_TEXTURE_H_ | |
OLD | NEW |