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

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: Handle device scale factor change. 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..552c90e8cc882323904e1a18e7018160e6b9bb3d 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;
@@ -635,7 +638,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);
+ nine_patch_layer_aperture_ = aperture;
danakj 2015/03/17 17:59:40 can you add "in_dip" to this variable name?
hshi1 2015/03/17 18:24:48 Done.
+ gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture);
+ nine_patch_layer_->SetAperture(aperture_in_pixel);
}
void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) {
@@ -716,6 +721,10 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
children_[i]->OnDeviceScaleFactorChanged(device_scale_factor);
if (layer_mask_)
layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor);
+ if (nine_patch_layer_) {
+ UpdateNinePatchLayerImage(nine_patch_layer_image_);
danakj 2015/03/17 17:59:40 Can you move these up by RecomputeDrwasContentAndU
hshi1 2015/03/17 18:24:48 Done.
+ UpdateNinePatchLayerAperture(nine_patch_layer_aperture_);
+ }
}
void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
« 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