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

Unified Diff: ui/gfx/compositor/layer.h

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove dip from gyp Created 8 years, 8 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
Index: ui/gfx/compositor/layer.h
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index 77237d224afdf00854a405354593f593eea5d5a2..44e3ac8094c605eb36ca87eb26277621dbbff49e 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -36,6 +36,8 @@ class Texture;
// has enabled layers ends up creating a Layer to manage the texture.
// A Layer can also be created without a texture, in which case it renders
// nothing and is simply used as a node in a hierarchy of layers.
+// Coordinate system used in layers is DIP (Density Independent Pixel)
+// coordinates unless explicitly mentioned as pixel coordinates.
//
// NOTE: unlike Views, each Layer does *not* own its children views. If you
// delete a Layer and it has children, the parent of each child layer is set to
@@ -113,6 +115,10 @@ class COMPOSITOR_EXPORT Layer :
void SetBounds(const gfx::Rect& bounds);
const gfx::Rect& bounds() const { return bounds_; }
+ // Sets/Gets the bounds in pixel coordinates, relative to the parent.
+ void SetBoundsInPixel(const gfx::Rect& bounds_in_dip);
+ gfx::Rect GetBoundsInPixel() const;
piman 2012/05/04 18:46:06 Are these called publicly (or at all?)
+
// Return the target bounds if animator is running, or the current bounds
// otherwise.
gfx::Rect GetTargetBounds() const;
@@ -193,6 +199,14 @@ class COMPOSITOR_EXPORT Layer :
// new paint requests.
void SuppressPaint();
+ // Update the layer's size in pixel using the current device scale factor.
+ void UpdateLayerSize();
+
+ // Sets if the layer should scale the canvas before passing to
+ // |LayerDelegate::OnLayerPaint|. Set to false if the delegate
+ // handles scaling.
+ void set_scale_canvas(bool scale_canvas);
+
// Sometimes the Layer is being updated by something other than SetCanvas
// (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT).
bool layer_updated_externally() const { return layer_updated_externally_; }
@@ -276,8 +290,8 @@ class COMPOSITOR_EXPORT Layer :
// If true the layer is always up to date.
bool layer_updated_externally_;
- // Union of damaged rects to be used when compositor is ready to
- // paint the content.
+ // Union of damaged rects, in pixel coordinates, to be used when
+ // compositor is ready to paint the content.
SkRegion damaged_region_;
float opacity_;
@@ -293,6 +307,10 @@ class COMPOSITOR_EXPORT Layer :
bool web_layer_is_accelerated_;
bool show_debug_borders_;
+ // If true, the layer scales the canvas using device scale factor
+ // before passing to LayerDelegate::OnLayerPaitn.
piman 2012/05/04 18:46:06 nit: OnLayerPaitn -> OnLayerPaint
+ bool scale_canvas_;
+
DISALLOW_COPY_AND_ASSIGN(Layer);
};

Powered by Google App Engine
This is Rietveld 408576698