Index: ui/compositor/layer.cc |
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
index c1767422163a523d837632b6183a6100b5dab2cc..450c615fefad4e263d59a58c8f8c3ad10364a19a 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,6 +584,28 @@ void Layer::SetShowPaintedContent() { |
RecomputeDrawsContentAndUVRect(); |
} |
+void Layer::SetShowNinePatch() { |
+ if (nine_patch_layer_.get()) |
+ return; |
+ |
+ scoped_refptr<cc::NinePatchLayer> new_layer = cc::NinePatchLayer::Create(); |
+ SetFillsBoundsOpaquely(false); |
sky
2014/07/14 15:30:06
Why the SetFillsBoundsOpaquely here? Isn't that se
hshi1
2014/07/14 21:23:37
Done. I'm moving this call the layer owner (Shadow
|
+ |
+ SwitchToLayer(new_layer); |
+ nine_patch_layer_ = new_layer; |
+} |
+ |
+void Layer::UpdateNinePatchBitmap(const SkBitmap& bitmap, |
+ const gfx::Rect& aperture, |
+ const gfx::Rect& border) { |
+ if (!nine_patch_layer_.get()) |
sky
2014/07/14 15:30:06
This be a DCHECK, right?
hshi1
2014/07/14 21:23:37
Done.
|
+ return; |
+ |
+ nine_patch_layer_->SetBitmap(bitmap); |
+ nine_patch_layer_->SetAperture(aperture); |
+ nine_patch_layer_->SetBorder(border); |
+} |
+ |
void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } |
bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) { |