OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // |compostior_| to repaint the content. | 191 // |compostior_| to repaint the content. |
192 void SendDamagedRects(); | 192 void SendDamagedRects(); |
193 | 193 |
194 // Suppresses painting the content by disgarding damaged region and ignoring | 194 // Suppresses painting the content by disgarding damaged region and ignoring |
195 // new paint requests. | 195 // new paint requests. |
196 void SuppressPaint(); | 196 void SuppressPaint(); |
197 | 197 |
198 // Notifies the layer that the device scale factor has changed. | 198 // Notifies the layer that the device scale factor has changed. |
199 void OnDeviceScaleFactorChanged(float device_scale_factor); | 199 void OnDeviceScaleFactorChanged(float device_scale_factor); |
200 | 200 |
201 // Sets if the layer should scale the canvas before passing to | 201 // Sets whether the layer should scale its content. If true, the canvas will |
202 // |LayerDelegate::OnLayerPaint|. Set to false if the delegate | 202 // be scaled in software rendering mode before it is passed to |
203 // handles scaling. | 203 // |LayerDelegate::OnPaint| and the texture will be scaled in accelerated |
204 void set_scale_canvas(bool scale_canvas) { scale_canvas_ = scale_canvas; } | 204 // mode. Set to false if the delegate handles scaling and the texture is |
| 205 // the correct pixel size. |
| 206 void set_scale_content(bool scale_content) { scale_content_ = scale_content; } |
205 | 207 |
206 // Sometimes the Layer is being updated by something other than SetCanvas | 208 // Sometimes the Layer is being updated by something other than SetCanvas |
207 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). | 209 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
208 bool layer_updated_externally() const { return layer_updated_externally_; } | 210 bool layer_updated_externally() const { return layer_updated_externally_; } |
209 | 211 |
210 // WebContentLayerClient | 212 // WebContentLayerClient |
211 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); | 213 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); |
212 | 214 |
213 WebKit::WebLayer web_layer() { return web_layer_; } | 215 WebKit::WebLayer web_layer() { return web_layer_; } |
214 | 216 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 std::string name_; | 294 std::string name_; |
293 | 295 |
294 LayerDelegate* delegate_; | 296 LayerDelegate* delegate_; |
295 | 297 |
296 scoped_ptr<LayerAnimator> animator_; | 298 scoped_ptr<LayerAnimator> animator_; |
297 | 299 |
298 WebKit::WebLayer web_layer_; | 300 WebKit::WebLayer web_layer_; |
299 bool web_layer_is_accelerated_; | 301 bool web_layer_is_accelerated_; |
300 bool show_debug_borders_; | 302 bool show_debug_borders_; |
301 | 303 |
302 // If true, the layer scales the canvas using device scale factor | 304 // If true, the layer scales the canvas and the texture with the device scale |
303 // before passing to LayerDelegate::OnLayerPaint. | 305 // factor as appropriate. When true, the texture size is in DIP. |
304 bool scale_canvas_; | 306 bool scale_content_; |
305 | 307 |
306 // A cached copy of |Compositor::device_scale_factor()|. | 308 // A cached copy of |Compositor::device_scale_factor()|. |
307 float device_scale_factor_; | 309 float device_scale_factor_; |
308 | 310 |
309 DISALLOW_COPY_AND_ASSIGN(Layer); | 311 DISALLOW_COPY_AND_ASSIGN(Layer); |
310 }; | 312 }; |
311 | 313 |
312 } // namespace ui | 314 } // namespace ui |
313 | 315 |
314 #endif // UI_COMPOSITOR_LAYER_H_ | 316 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |