| 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 #include "ui/ui_api.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 class Transform; | 18 class Transform; |
| 18 | 19 |
| 19 typedef unsigned int TextureID; | 20 typedef unsigned int TextureID; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 | 24 |
| 24 class Brush; | 25 class Brush; |
| 25 class CanvasSkia; | 26 class CanvasSkia; |
| 26 class Font; | 27 class Font; |
| 27 class Point; | 28 class Point; |
| 28 class Rect; | 29 class Rect; |
| 29 | 30 |
| 30 // TODO(beng): documentation. | 31 // TODO(beng): documentation. |
| 31 class Canvas { | 32 class UI_API 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, |
| 39 TEXT_VALIGN_MIDDLE = 16, | 40 TEXT_VALIGN_MIDDLE = 16, |
| 40 TEXT_VALIGN_BOTTOM = 32, | 41 TEXT_VALIGN_BOTTOM = 32, |
| 41 | 42 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // Create a texture ID that can be used for accelerated drawing. | 223 // Create a texture ID that can be used for accelerated drawing. |
| 223 virtual ui::TextureID GetTextureID() = 0; | 224 virtual ui::TextureID GetTextureID() = 0; |
| 224 | 225 |
| 225 // TODO(beng): remove this once we don't need to use any skia-specific methods | 226 // TODO(beng): remove this once we don't need to use any skia-specific methods |
| 226 // through this interface. | 227 // through this interface. |
| 227 // A quick and dirty way to obtain the underlying SkCanvas. | 228 // A quick and dirty way to obtain the underlying SkCanvas. |
| 228 virtual CanvasSkia* AsCanvasSkia(); | 229 virtual CanvasSkia* AsCanvasSkia(); |
| 229 virtual const CanvasSkia* AsCanvasSkia() const; | 230 virtual const CanvasSkia* AsCanvasSkia() const; |
| 230 }; | 231 }; |
| 231 | 232 |
| 232 class CanvasPaint { | 233 class UI_API CanvasPaint { |
| 233 public: | 234 public: |
| 234 virtual ~CanvasPaint() {} | 235 virtual ~CanvasPaint() {} |
| 235 | 236 |
| 236 // Creates a canvas that paints to |view| when it is destroyed. The canvas is | 237 // Creates a canvas that paints to |view| when it is destroyed. The canvas is |
| 237 // sized to the client area of |view|. | 238 // sized to the client area of |view|. |
| 238 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); | 239 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); |
| 239 | 240 |
| 240 // Returns true if the canvas has an invalid rect that needs to be repainted. | 241 // Returns true if the canvas has an invalid rect that needs to be repainted. |
| 241 virtual bool IsValid() const = 0; | 242 virtual bool IsValid() const = 0; |
| 242 | 243 |
| 243 // Returns the rectangle that is invalid. | 244 // Returns the rectangle that is invalid. |
| 244 virtual gfx::Rect GetInvalidRect() const = 0; | 245 virtual gfx::Rect GetInvalidRect() const = 0; |
| 245 | 246 |
| 246 // Returns the underlying Canvas. | 247 // Returns the underlying Canvas. |
| 247 virtual Canvas* AsCanvas() = 0; | 248 virtual Canvas* AsCanvas() = 0; |
| 248 }; | 249 }; |
| 249 | 250 |
| 250 } // namespace gfx; | 251 } // namespace gfx; |
| 251 | 252 |
| 252 #endif // UI_GFX_CANVAS_H_ | 253 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |