| Index: ui/compositor/layer.cc
|
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
|
| index c1767422163a523d837632b6183a6100b5dab2cc..db40f77f4c1197e0c83e1d3fa89698a79d29110d 100644
|
| --- a/ui/compositor/layer.cc
|
| +++ b/ui/compositor/layer.cc
|
| @@ -14,6 +14,7 @@
|
| #include "cc/base/scoped_ptr_algorithm.h"
|
| #include "cc/layers/content_layer.h"
|
| #include "cc/layers/delegated_renderer_layer.h"
|
| +#include "cc/layers/nine_patch_layer.h"
|
| #include "cc/layers/picture_layer.h"
|
| #include "cc/layers/solid_color_layer.h"
|
| #include "cc/layers/texture_layer.h"
|
| @@ -583,10 +584,32 @@ void Layer::SetShowPaintedContent() {
|
| RecomputeDrawsContentAndUVRect();
|
| }
|
|
|
| +void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap,
|
| + const gfx::Rect& aperture) {
|
| + DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get());
|
| + SkBitmap bitmap_copy;
|
| + if (bitmap.isImmutable()) {
|
| + bitmap_copy = bitmap;
|
| + } else {
|
| + // UIResourceBitmap requires an immutable copy of the input |bitmap|.
|
| + bitmap.copyTo(&bitmap_copy);
|
| + bitmap_copy.setImmutable();
|
| + }
|
| + nine_patch_layer_->SetBitmap(bitmap_copy);
|
| + nine_patch_layer_->SetAperture(aperture);
|
| +}
|
| +
|
| +void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) {
|
| + DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get());
|
| + nine_patch_layer_->SetBorder(border);
|
| +}
|
| +
|
| void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); }
|
|
|
| bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) {
|
| - if (type_ == LAYER_SOLID_COLOR || (!delegate_ && !mailbox_.IsValid()))
|
| + if (type_ == LAYER_SOLID_COLOR ||
|
| + type_ == LAYER_NINE_PATCH ||
|
| + (!delegate_ && !mailbox_.IsValid()))
|
| return false;
|
|
|
| damaged_region_.op(invalid_rect.x(),
|
| @@ -927,6 +950,9 @@ void Layer::CreateWebLayer() {
|
| if (type_ == LAYER_SOLID_COLOR) {
|
| solid_color_layer_ = cc::SolidColorLayer::Create();
|
| cc_layer_ = solid_color_layer_.get();
|
| + } else if (type_ == LAYER_NINE_PATCH) {
|
| + nine_patch_layer_ = cc::NinePatchLayer::Create();
|
| + cc_layer_ = nine_patch_layer_.get();
|
| } else {
|
| if (Layer::UsingPictureLayer())
|
| content_layer_ = cc::PictureLayer::Create(this);
|
|
|