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

Side by Side Diff: cc/layer_impl.h

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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 CC_LAYER_IMPL_H_ 5 #ifndef CC_LAYER_IMPL_H_
6 #define CC_LAYER_IMPL_H_ 6 #define CC_LAYER_IMPL_H_
7 7
8 #include <public/WebFilterOperations.h> 8 #include <public/WebFilterOperations.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const LayerImpl* renderTarget() const { DCHECK(!m_drawProperties.render_targ et || m_drawProperties.render_target->renderSurface()); return m_drawProperties. render_target; } 187 const LayerImpl* renderTarget() const { DCHECK(!m_drawProperties.render_targ et || m_drawProperties.render_target->renderSurface()); return m_drawProperties. render_target; }
188 RenderSurfaceImpl* renderSurface() const { return m_drawProperties.render_su rface.get(); } 188 RenderSurfaceImpl* renderSurface() const { return m_drawProperties.render_su rface.get(); }
189 189
190 // The client should be responsible for setting bounds, contentBounds and 190 // The client should be responsible for setting bounds, contentBounds and
191 // contentsScale to appropriate values. LayerImpl doesn't calculate any of 191 // contentsScale to appropriate values. LayerImpl doesn't calculate any of
192 // them from the other values. 192 // them from the other values.
193 193
194 void setBounds(const gfx::Size&); 194 void setBounds(const gfx::Size&);
195 const gfx::Size& bounds() const { return m_bounds; } 195 const gfx::Size& bounds() const { return m_bounds; }
196 196
197 // ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
198 // Don't calculate scale from it. Use contentsScale instead for accuracy.
199 void setContentBounds(const gfx::Size&); 197 void setContentBounds(const gfx::Size&);
200 gfx::Size contentBounds() const { return m_contentBounds; } 198 gfx::Size contentBounds() const { return m_drawProperties.content_bounds; }
201 199
202 float contentsScaleX() const { return m_contentsScaleX; } 200 float contentsScaleX() const { return m_drawProperties.contents_scale_x; }
203 float contentsScaleY() const { return m_contentsScaleY; } 201 float contentsScaleY() const { return m_drawProperties.contents_scale_y; }
204 void setContentsScale(float contentsScaleX, float contentsScaleY); 202 void setContentsScale(float contentsScaleX, float contentsScaleY);
203 virtual void setIdealContentsScale(float ideal_contents_scale) { }
205 204
206 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } 205 gfx::Vector2d scrollOffset() const { return m_scrollOffset; }
207 void setScrollOffset(gfx::Vector2d); 206 void setScrollOffset(gfx::Vector2d);
208 207
209 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } 208 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; }
210 void setMaxScrollOffset(gfx::Vector2d); 209 void setMaxScrollOffset(gfx::Vector2d);
211 210
212 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } 211 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; }
213 void setScrollDelta(const gfx::Vector2dF&); 212 void setScrollDelta(const gfx::Vector2dF&);
214 213
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // Group of properties that need to be computed based on the layer tree 402 // Group of properties that need to be computed based on the layer tree
404 // hierarchy before layers can be drawn. 403 // hierarchy before layers can be drawn.
405 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; 404 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties;
406 405
407 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 406 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
408 }; 407 };
409 408
410 } 409 }
411 410
412 #endif // CC_LAYER_IMPL_H_ 411 #endif // CC_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698