Index: ui/gfx/compositor/compositor.h |
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h |
index df575ddad11972f4fe6a7c6b4d8e3c8811c48404..8f583a13a1d43d0e32f4638d447bbee05d8cfa69 100644 |
--- a/ui/gfx/compositor/compositor.h |
+++ b/ui/gfx/compositor/compositor.h |
@@ -10,18 +10,18 @@ |
#include "ui/gfx/compositor/compositor_export.h" |
#include "ui/gfx/transform.h" |
#include "ui/gfx/native_widget_types.h" |
+#include "ui/gfx/size.h" |
class SkCanvas; |
namespace gfx { |
class Point; |
class Rect; |
-class Size; |
} |
namespace ui { |
struct TextureDrawParams { |
- TextureDrawParams() : transform(), blend(false) {} |
+ TextureDrawParams() : transform(), blend(false), compositor_size(1,1) {} |
sky
2011/08/25 21:15:55
Why the 1x1 here?
jonathan.backer
2011/08/26 11:45:55
I thought that it would be less likely to trigger
|
// The transform to be applied to the texture. |
ui::Transform transform; |
@@ -30,6 +30,9 @@ struct TextureDrawParams { |
// Otherwise, the drawn pixels clobber the old pixels. |
bool blend; |
+ // The size of the surface that the texture is drawn to. |
+ gfx::Size compositor_size; |
+ |
// Copy and assignment are allowed. |
}; |
@@ -91,12 +94,23 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { |
// Notifies the compositor that the size of the widget that it is |
// drawing to has changed. |
- virtual void OnWidgetSizeChanged(const gfx::Size& size) = 0; |
+ void WidgetSizeChanged(const gfx::Size& size) { |
+ size_ = size; |
+ OnWidgetSizeChanged(); |
+ } |
+ |
+ // Returns the size of the widget that is being drawn to. |
+ const gfx::Size& size() { return size_; } |
protected: |
+ explicit Compositor(const gfx::Size& size) : size_(size) {} |
virtual ~Compositor() {} |
+ virtual void OnWidgetSizeChanged() = 0; |
+ |
private: |
+ gfx::Size size_; |
+ |
friend class base::RefCounted<Compositor>; |
}; |