diff options
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/compositor/layer.cc | 7 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index b722c12..5779e52 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -39,6 +39,13 @@ void Layer::Remove(Layer* child) { child->parent_ = NULL; } +void Layer::SetTexture(ui::Texture* texture) { + if (texture == NULL) + texture_ = compositor_->CreateTexture(); + else + texture_ = texture; +} + void Layer::SetBitmap(const SkBitmap& bitmap, const gfx::Point& origin) { texture_->SetBitmap(bitmap, origin, bounds_.size()); } diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h index 72faad1..5b2418c 100644 --- a/ui/gfx/compositor/layer.h +++ b/ui/gfx/compositor/layer.h @@ -55,6 +55,9 @@ class Layer { const Compositor* compositor() const { return compositor_; } Compositor* compositor() { return compositor_; } + // Passing NULL will cause the layer to get a texture from its compositor. + void SetTexture(ui::Texture* texture); + // Resets the bitmap of the texture. void SetBitmap(const SkBitmap& bitmap, const gfx::Point& origin); |