OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef UI_GFX_CANVAS_H_ | 5 #ifndef UI_GFX_CANVAS_H_ |
6 #define UI_GFX_CANVAS_H_ | 6 #define UI_GFX_CANVAS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 // TODO(beng): remove this include when we no longer depend on SkTypes. | 12 // TODO(beng): remove this include when we no longer depend on SkTypes. |
13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class Transform; | 17 class Transform; |
18 | 18 |
19 typedef unsigned int TextureID; | 19 typedef unsigned int TextureID; |
20 } | 20 } |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 | 23 |
24 class Brush; | 24 class Brush; |
25 class CanvasSkia; | 25 class CanvasSkia; |
26 class Font; | 26 class Font; |
27 class Point; | 27 class Point; |
28 class Rect; | 28 class Rect; |
| 29 class RenderText; |
29 | 30 |
30 // TODO(beng): documentation. | 31 // TODO(beng): documentation. |
31 class Canvas { | 32 class Canvas { |
32 public: | 33 public: |
33 // Specifies the alignment for text rendered with the DrawStringInt method. | 34 // Specifies the alignment for text rendered with the DrawStringInt method. |
34 enum { | 35 enum { |
35 TEXT_ALIGN_LEFT = 1, | 36 TEXT_ALIGN_LEFT = 1, |
36 TEXT_ALIGN_CENTER = 2, | 37 TEXT_ALIGN_CENTER = 2, |
37 TEXT_ALIGN_RIGHT = 4, | 38 TEXT_ALIGN_RIGHT = 4, |
38 TEXT_VALIGN_TOP = 8, | 39 TEXT_VALIGN_TOP = 8, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 // Draws text with the specified color, font and location. The last argument | 191 // Draws text with the specified color, font and location. The last argument |
191 // specifies flags for how the text should be rendered. It can be one of | 192 // specifies flags for how the text should be rendered. It can be one of |
192 // TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT. | 193 // TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT. |
193 virtual void DrawStringInt(const string16& text, | 194 virtual void DrawStringInt(const string16& text, |
194 const gfx::Font& font, | 195 const gfx::Font& font, |
195 const SkColor& color, | 196 const SkColor& color, |
196 int x, int y, int w, int h, | 197 int x, int y, int w, int h, |
197 int flags) = 0; | 198 int flags) = 0; |
198 | 199 |
| 200 // Draws the specified |render_text| with style, cursor, selection, etc. |
| 201 virtual void DrawStringInt(const RenderText& render_text) = 0; |
| 202 |
199 // Draws a dotted gray rectangle used for focus purposes. | 203 // Draws a dotted gray rectangle used for focus purposes. |
200 virtual void DrawFocusRect(int x, int y, int width, int height) = 0; | 204 virtual void DrawFocusRect(int x, int y, int width, int height) = 0; |
201 | 205 |
202 // Tiles the image in the specified region. | 206 // Tiles the image in the specified region. |
203 virtual void TileImageInt(const SkBitmap& bitmap, | 207 virtual void TileImageInt(const SkBitmap& bitmap, |
204 int x, int y, int w, int h) = 0; | 208 int x, int y, int w, int h) = 0; |
205 virtual void TileImageInt(const SkBitmap& bitmap, | 209 virtual void TileImageInt(const SkBitmap& bitmap, |
206 int src_x, int src_y, | 210 int src_x, int src_y, |
207 int dest_x, int dest_y, int w, int h) = 0; | 211 int dest_x, int dest_y, int w, int h) = 0; |
208 | 212 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // Returns the rectangle that is invalid. | 245 // Returns the rectangle that is invalid. |
242 virtual gfx::Rect GetInvalidRect() const = 0; | 246 virtual gfx::Rect GetInvalidRect() const = 0; |
243 | 247 |
244 // Returns the underlying Canvas. | 248 // Returns the underlying Canvas. |
245 virtual Canvas* AsCanvas() = 0; | 249 virtual Canvas* AsCanvas() = 0; |
246 }; | 250 }; |
247 | 251 |
248 } // namespace gfx; | 252 } // namespace gfx; |
249 | 253 |
250 #endif // UI_GFX_CANVAS_H_ | 254 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |