Chromium Code Reviews| 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/base/ui_export.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 | 17 |
| 18 class SkCanvas; | |
| 19 | |
| 18 namespace ui { | 20 namespace ui { |
| 19 class Transform; | 21 class Transform; |
| 20 | 22 |
| 21 typedef unsigned int TextureID; | 23 typedef unsigned int TextureID; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace gfx { | 26 namespace gfx { |
| 25 | 27 |
| 26 class Brush; | 28 class Brush; |
| 27 class CanvasSkia; | 29 class CanvasSkia; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 virtual void Transform(const ui::Transform& transform) = 0; | 227 virtual void Transform(const ui::Transform& transform) = 0; |
| 226 #endif | 228 #endif |
| 227 | 229 |
| 228 // Create a texture ID that can be used for accelerated drawing. | 230 // Create a texture ID that can be used for accelerated drawing. |
| 229 virtual ui::TextureID GetTextureID() = 0; | 231 virtual ui::TextureID GetTextureID() = 0; |
| 230 | 232 |
| 231 // TODO(beng): remove this once we don't need to use any skia-specific methods | 233 // TODO(beng): remove this once we don't need to use any skia-specific methods |
| 232 // through this interface. | 234 // through this interface. |
| 233 // A quick and dirty way to obtain the underlying SkCanvas. | 235 // A quick and dirty way to obtain the underlying SkCanvas. |
| 234 virtual CanvasSkia* AsCanvasSkia(); | 236 virtual CanvasSkia* AsCanvasSkia(); |
| 235 virtual const CanvasSkia* AsCanvasSkia() const; | 237 virtual const CanvasSkia* AsCanvasSkia() const; |
|
Ben Goodger (Google)
2011/10/05 17:11:45
Did anyone use this for anything other than to get
piman
2011/10/05 17:31:29
I wanted to get rid of it, but there's a dozen or
| |
| 238 virtual SkCanvas* GetSkCanvas(); | |
| 239 virtual const SkCanvas* GetSkCanvas() const; | |
| 236 }; | 240 }; |
| 237 | 241 |
| 238 class UI_EXPORT CanvasPaint { | 242 class UI_EXPORT CanvasPaint { |
| 239 public: | 243 public: |
| 240 virtual ~CanvasPaint() {} | 244 virtual ~CanvasPaint() {} |
| 241 | 245 |
| 242 // Creates a canvas that paints to |view| when it is destroyed. The canvas is | 246 // Creates a canvas that paints to |view| when it is destroyed. The canvas is |
| 243 // sized to the client area of |view|. | 247 // sized to the client area of |view|. |
| 244 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); | 248 static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); |
| 245 | 249 |
| 246 // Returns true if the canvas has an invalid rect that needs to be repainted. | 250 // Returns true if the canvas has an invalid rect that needs to be repainted. |
| 247 virtual bool IsValid() const = 0; | 251 virtual bool IsValid() const = 0; |
| 248 | 252 |
| 249 // Returns the rectangle that is invalid. | 253 // Returns the rectangle that is invalid. |
| 250 virtual gfx::Rect GetInvalidRect() const = 0; | 254 virtual gfx::Rect GetInvalidRect() const = 0; |
| 251 | 255 |
| 252 // Returns the underlying Canvas. | 256 // Returns the underlying Canvas. |
| 253 virtual Canvas* AsCanvas() = 0; | 257 virtual Canvas* AsCanvas() = 0; |
| 254 }; | 258 }; |
| 255 | 259 |
| 256 } // namespace gfx; | 260 } // namespace gfx; |
| 257 | 261 |
| 258 #endif // UI_GFX_CANVAS_H_ | 262 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |