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 whether the layer should scale its content. If true, the canvas will | 201 // Sets if the layer should scale the canvas before passing to |
202 // be scaled in software rendering mode before it is passed to | 202 // |LayerDelegate::OnLayerPaint|. Set to false if the delegate |
203 // |LayerDelegate::OnPaint| and the texture will be scaled in accelerated | 203 // handles scaling. |
204 // mode. Set to false if the delegate handles scaling and the texture is | 204 void set_scale_canvas(bool scale_canvas) { scale_canvas_ = scale_canvas; } |
205 // the correct pixel size. | |
206 void set_scale_content(bool scale_content) { scale_content_ = scale_content; } | |
207 | 205 |
208 // Sometimes the Layer is being updated by something other than SetCanvas | 206 // Sometimes the Layer is being updated by something other than SetCanvas |
209 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). | 207 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
210 bool layer_updated_externally() const { return layer_updated_externally_; } | 208 bool layer_updated_externally() const { return layer_updated_externally_; } |
211 | 209 |
212 // WebContentLayerClient | 210 // WebContentLayerClient |
213 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); | 211 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); |
214 | 212 |
215 WebKit::WebLayer web_layer() { return web_layer_; } | 213 WebKit::WebLayer web_layer() { return web_layer_; } |
216 | 214 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 std::string name_; | 292 std::string name_; |
295 | 293 |
296 LayerDelegate* delegate_; | 294 LayerDelegate* delegate_; |
297 | 295 |
298 scoped_ptr<LayerAnimator> animator_; | 296 scoped_ptr<LayerAnimator> animator_; |
299 | 297 |
300 WebKit::WebLayer web_layer_; | 298 WebKit::WebLayer web_layer_; |
301 bool web_layer_is_accelerated_; | 299 bool web_layer_is_accelerated_; |
302 bool show_debug_borders_; | 300 bool show_debug_borders_; |
303 | 301 |
304 // If true, the layer scales the canvas and the texture with the device scale | 302 // If true, the layer scales the canvas using device scale factor |
305 // factor as appropriate. When true, the texture size is in DIP. | 303 // before passing to LayerDelegate::OnLayerPaint. |
306 bool scale_content_; | 304 bool scale_canvas_; |
307 | 305 |
308 // A cached copy of |Compositor::device_scale_factor()|. | 306 // A cached copy of |Compositor::device_scale_factor()|. |
309 float device_scale_factor_; | 307 float device_scale_factor_; |
310 | 308 |
311 DISALLOW_COPY_AND_ASSIGN(Layer); | 309 DISALLOW_COPY_AND_ASSIGN(Layer); |
312 }; | 310 }; |
313 | 311 |
314 } // namespace ui | 312 } // namespace ui |
315 | 313 |
316 #endif // UI_COMPOSITOR_LAYER_H_ | 314 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |