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

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: 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..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) {
« 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