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