Chromium Code Reviews| Index: ui/compositor/layer.cc |
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
| index 700ed69d5641d8b9d1792482b1fdb65e0c6f9f54..aa39c9a8748b1d232526362a1624345d4a8a4c46 100644 |
| --- a/ui/compositor/layer.cc |
| +++ b/ui/compositor/layer.cc |
| @@ -31,6 +31,7 @@ |
| #include "ui/gfx/animation/animation.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/display.h" |
| +#include "ui/gfx/geometry/dip_util.h" |
| #include "ui/gfx/geometry/point3_f.h" |
| #include "ui/gfx/geometry/point_conversions.h" |
| #include "ui/gfx/geometry/size_conversions.h" |
| @@ -77,7 +78,8 @@ Layer::Layer() |
| delegate_(NULL), |
| owner_(NULL), |
| cc_layer_(NULL), |
| - device_scale_factor_(1.0f) { |
| + device_scale_factor_(1.0f), |
| + nine_patch_layer_bitmap_scale_factor_(1.0f) { |
|
oshima
2015/03/14 05:42:55
Why you need this? You should just use device_scal
hshi1
2015/03/16 16:50:48
Done.
|
| CreateCcLayer(); |
| } |
| @@ -101,7 +103,8 @@ Layer::Layer(LayerType type) |
| delegate_(NULL), |
| owner_(NULL), |
| cc_layer_(NULL), |
| - device_scale_factor_(1.0f) { |
| + device_scale_factor_(1.0f), |
| + nine_patch_layer_bitmap_scale_factor_(1.0f) { |
| CreateCcLayer(); |
| } |
| @@ -620,8 +623,11 @@ void Layer::SetShowSolidColorContent() { |
| RecomputeDrawsContentAndUVRect(); |
| } |
| -void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap) { |
| +void Layer::UpdateNinePatchLayerImage(const gfx::ImageSkia& image) { |
| DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
| + nine_patch_layer_bitmap_scale_factor_ = device_scale_factor_; |
| + SkBitmap bitmap = image.GetRepresentation( |
| + nine_patch_layer_bitmap_scale_factor_).sk_bitmap(); |
| SkBitmap bitmap_copy; |
| if (bitmap.isImmutable()) { |
| bitmap_copy = bitmap; |
| @@ -635,7 +641,9 @@ void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap) { |
| void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture) { |
| DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
| - nine_patch_layer_->SetAperture(aperture); |
| + gfx::Rect aperture_in_pixel = |
| + gfx::ConvertRectToPixel(nine_patch_layer_bitmap_scale_factor_, aperture); |
| + nine_patch_layer_->SetAperture(aperture_in_pixel); |
| } |
| void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { |