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

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: . Created 8 years, 7 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..bfa7dce932289e743b7f40bd54428999bce958b5 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
@@ -193,6 +195,14 @@ class COMPOSITOR_EXPORT Layer :
// new paint requests.
void SuppressPaint();
+ // Update the layer's size in pixel using |compositor|'s device_scale_factor.
+ void UpdateLayerSize(const Compositor* compositor);
+
+ // 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_; }
@@ -249,9 +259,12 @@ class COMPOSITOR_EXPORT Layer :
virtual bool GetVisibilityForAnimation() const OVERRIDE;
void CreateWebLayer();
- void RecomputeTransform();
- void RecomputeDrawsContentAndUVRect();
+ void RecomputeTransform(const Compositor* compositor);
+ void RecomputeDrawsContentAndUVRect(const Compositor* compositor);
void RecomputeDebugBorderColor();
+ void ScheduleDraw(Compositor* compositor);
+ bool SchedulePaint(Compositor* compositor,
+ const gfx::Rect& invalid_rect);
const LayerType type_;
@@ -276,8 +289,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 +306,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::OnLayerPaint.
+ bool scale_canvas_;
+
DISALLOW_COPY_AND_ASSIGN(Layer);
};

Powered by Google App Engine
This is Rietveld 408576698