Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: ui/compositor/layer.cc

Issue 1002393002: Change ui::wm::Shadow to pass ImageSkia instead of SkBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Dana's comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/wm/core/shadow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 700ed69d5641d8b9d1792482b1fdb65e0c6f9f54..e0d3dcc7059f1f3f59adcd6f7f78840743a33f58 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -620,8 +620,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_image_ = image;
+ SkBitmap bitmap = nine_patch_layer_image_.GetRepresentation(
+ device_scale_factor_).sk_bitmap();
SkBitmap bitmap_copy;
if (bitmap.isImmutable()) {
bitmap_copy = bitmap;
@@ -633,9 +636,11 @@ void Layer::UpdateNinePatchLayerBitmap(const SkBitmap& bitmap) {
nine_patch_layer_->SetBitmap(bitmap_copy);
}
-void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture) {
+void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture_in_dip) {
DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get());
- nine_patch_layer_->SetAperture(aperture);
+ nine_patch_layer_aperture_ = aperture_in_dip;
+ gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture_in_dip);
+ nine_patch_layer_->SetAperture(aperture_in_pixel);
}
void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) {
@@ -709,6 +714,10 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
device_scale_factor_ = device_scale_factor;
RecomputeDrawsContentAndUVRect();
RecomputePosition();
+ if (nine_patch_layer_) {
+ UpdateNinePatchLayerImage(nine_patch_layer_image_);
+ UpdateNinePatchLayerAperture(nine_patch_layer_aperture_);
+ }
SchedulePaint(gfx::Rect(bounds_.size()));
if (delegate_)
delegate_->OnDeviceScaleFactorChanged(device_scale_factor);
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/wm/core/shadow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698