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

Side by Side Diff: cc/layer_impl.h

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CCLayerImpl_h 5 #ifndef CCLayerImpl_h
6 #define CCLayerImpl_h 6 #define CCLayerImpl_h
7 7
8 #include "FloatRect.h" 8 #include "FloatRect.h"
9 #include "IntRect.h" 9 #include "IntRect.h"
10 #include "Region.h" 10 #include "Region.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 float drawOpacity() const { return m_drawOpacity; } 161 float drawOpacity() const { return m_drawOpacity; }
162 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } 162 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
163 163
164 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } 164 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
165 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI sAnimating = drawOpacityIsAnimating; } 165 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI sAnimating = drawOpacityIsAnimating; }
166 166
167 LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget-> renderSurface()); return m_renderTarget; } 167 LayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget-> renderSurface()); return m_renderTarget; }
168 void setRenderTarget(LayerImpl* target) { m_renderTarget = target; } 168 void setRenderTarget(LayerImpl* target) { m_renderTarget = target; }
169 169
170 // The client should be responsible for setting bounds, contentBounds and
171 // contentsScale to appropriate values. LayerImpl doesn't calculate any of
172 // them from the other values.
173
170 void setBounds(const IntSize&); 174 void setBounds(const IntSize&);
171 const IntSize& bounds() const { return m_bounds; } 175 const IntSize& bounds() const { return m_bounds; }
172 176
173 const IntSize& contentBounds() const { return m_contentBounds; } 177 // ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
178 // Don't calculate scale from it. Use contentsScale instead for accuracy.
174 void setContentBounds(const IntSize&); 179 void setContentBounds(const IntSize&);
180 IntSize contentBounds() const { return m_contentBounds; }
181
182 float contentsScaleX() const { return m_contentsScaleX; }
183 float contentsScaleY() const { return m_contentsScaleY; }
184 void setContentsScale(float contentsScaleX, float contentsScaleY);
175 185
176 const IntPoint& scrollPosition() const { return m_scrollPosition; } 186 const IntPoint& scrollPosition() const { return m_scrollPosition; }
177 void setScrollPosition(const IntPoint&); 187 void setScrollPosition(const IntPoint&);
178 188
179 const IntSize& maxScrollPosition() const {return m_maxScrollPosition; } 189 const IntSize& maxScrollPosition() const {return m_maxScrollPosition; }
180 void setMaxScrollPosition(const IntSize&); 190 void setMaxScrollPosition(const IntSize&);
181 191
182 const FloatSize& scrollDelta() const { return m_scrollDelta; } 192 const FloatSize& scrollDelta() const { return m_scrollDelta; }
183 void setScrollDelta(const FloatSize&); 193 void setScrollDelta(const FloatSize&);
184 194
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 virtual void didLoseContext(); 263 virtual void didLoseContext();
254 264
255 ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); } 265 ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); }
256 266
257 ScrollbarLayerImpl* horizontalScrollbarLayer() const; 267 ScrollbarLayerImpl* horizontalScrollbarLayer() const;
258 void setHorizontalScrollbarLayer(ScrollbarLayerImpl*); 268 void setHorizontalScrollbarLayer(ScrollbarLayerImpl*);
259 269
260 ScrollbarLayerImpl* verticalScrollbarLayer() const; 270 ScrollbarLayerImpl* verticalScrollbarLayer() const;
261 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); 271 void setVerticalScrollbarLayer(ScrollbarLayerImpl*);
262 272
273 IntRect layerRectToContentRect(const FloatRect& layerRect) const;
274
263 protected: 275 protected:
264 explicit LayerImpl(int); 276 explicit LayerImpl(int);
265 277
266 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat a&) const; 278 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat a&) const;
267 279
268 IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
269
270 virtual void dumpLayerProperties(std::string*, int indent) const; 280 virtual void dumpLayerProperties(std::string*, int indent) const;
271 static std::string indentString(int indent); 281 static std::string indentString(int indent);
272 282
273 private: 283 private:
274 void setParent(LayerImpl* parent) { m_parent = parent; } 284 void setParent(LayerImpl* parent) { m_parent = parent; }
275 friend class TreeSynchronizer; 285 friend class TreeSynchronizer;
276 void clearChildList(); // Warning: This does not preserve tree structure inv ariants and so is only exposed to the tree synchronizer. 286 void clearChildList(); // Warning: This does not preserve tree structure inv ariants and so is only exposed to the tree synchronizer.
277 287
278 void noteLayerPropertyChangedForSubtree(); 288 void noteLayerPropertyChangedForSubtree();
279 289
(...skipping 13 matching lines...) Expand all
293 int m_replicaLayerId; // ditto 303 int m_replicaLayerId; // ditto
294 scoped_ptr<LayerImpl> m_replicaLayer; 304 scoped_ptr<LayerImpl> m_replicaLayer;
295 int m_layerId; 305 int m_layerId;
296 LayerTreeHostImpl* m_layerTreeHostImpl; 306 LayerTreeHostImpl* m_layerTreeHostImpl;
297 307
298 // Properties synchronized from the associated Layer. 308 // Properties synchronized from the associated Layer.
299 FloatPoint m_anchorPoint; 309 FloatPoint m_anchorPoint;
300 float m_anchorPointZ; 310 float m_anchorPointZ;
301 IntSize m_bounds; 311 IntSize m_bounds;
302 IntSize m_contentBounds; 312 IntSize m_contentBounds;
313 float m_contentsScaleX;
314 float m_contentsScaleY;
303 IntPoint m_scrollPosition; 315 IntPoint m_scrollPosition;
304 bool m_scrollable; 316 bool m_scrollable;
305 bool m_shouldScrollOnMainThread; 317 bool m_shouldScrollOnMainThread;
306 bool m_haveWheelEventHandlers; 318 bool m_haveWheelEventHandlers;
307 Region m_nonFastScrollableRegion; 319 Region m_nonFastScrollableRegion;
308 SkColor m_backgroundColor; 320 SkColor m_backgroundColor;
309 321
310 // Whether the "back" of this layer should draw. 322 // Whether the "back" of this layer should draw.
311 bool m_doubleSided; 323 bool m_doubleSided;
312 324
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 406
395 // Manages scrollbars for this layer 407 // Manages scrollbars for this layer
396 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; 408 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController;
397 }; 409 };
398 410
399 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*); 411 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*> ::iterator end, LayerSorter*);
400 412
401 } 413 }
402 414
403 #endif // CCLayerImpl_h 415 #endif // CCLayerImpl_h
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698