Index: ui/gfx/compositor/compositor.h |
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h |
index df575ddad11972f4fe6a7c6b4d8e3c8811c48404..42bb770cd756f0958b3a5db73b2f4e88310a5026 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() {} |
// 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>; |
}; |