| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). | 213 // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
| 214 bool layer_updated_externally() const { return layer_updated_externally_; } | 214 bool layer_updated_externally() const { return layer_updated_externally_; } |
| 215 | 215 |
| 216 // WebContentLayerClient | 216 // WebContentLayerClient |
| 217 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); | 217 virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); |
| 218 | 218 |
| 219 WebKit::WebLayer web_layer() { return web_layer_; } | 219 WebKit::WebLayer web_layer() { return web_layer_; } |
| 220 | 220 |
| 221 float device_scale_factor() const { return device_scale_factor_; } | 221 float device_scale_factor() const { return device_scale_factor_; } |
| 222 | 222 |
| 223 // Forces a render surface to be used on this layer. This has no positive |
| 224 // impact, and is only used for benchmarking/testing purpose. |
| 225 void SetForceRenderSurface(bool force); |
| 226 bool force_render_surface() const { return force_render_surface_; } |
| 227 |
| 223 private: | 228 private: |
| 224 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than | 229 // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than |
| 225 // 1.0, we'll render to a separate texture, and then apply the alpha. | 230 // 1.0, we'll render to a separate texture, and then apply the alpha. |
| 226 // Currently, we multiply our opacity by all our ancestor's opacities and | 231 // Currently, we multiply our opacity by all our ancestor's opacities and |
| 227 // use the combined result, but this is only temporary. | 232 // use the combined result, but this is only temporary. |
| 228 float GetCombinedOpacity() const; | 233 float GetCombinedOpacity() const; |
| 229 | 234 |
| 230 // Stacks |child| above or below |other|. Helper method for StackAbove() and | 235 // Stacks |child| above or below |other|. Helper method for StackAbove() and |
| 231 // StackBelow(). | 236 // StackBelow(). |
| 232 void StackRelativeTo(Layer* child, Layer* other, bool above); | 237 void StackRelativeTo(Layer* child, Layer* other, bool above); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // This layer's children, in bottom-to-top stacking order. | 281 // This layer's children, in bottom-to-top stacking order. |
| 277 std::vector<Layer*> children_; | 282 std::vector<Layer*> children_; |
| 278 | 283 |
| 279 ui::Transform transform_; | 284 ui::Transform transform_; |
| 280 | 285 |
| 281 gfx::Rect bounds_; | 286 gfx::Rect bounds_; |
| 282 | 287 |
| 283 // Visibility of this layer. See SetVisible/IsDrawn for more details. | 288 // Visibility of this layer. See SetVisible/IsDrawn for more details. |
| 284 bool visible_; | 289 bool visible_; |
| 285 | 290 |
| 291 bool force_render_surface_; |
| 292 |
| 286 bool fills_bounds_opaquely_; | 293 bool fills_bounds_opaquely_; |
| 287 | 294 |
| 288 // If true the layer is always up to date. | 295 // If true the layer is always up to date. |
| 289 bool layer_updated_externally_; | 296 bool layer_updated_externally_; |
| 290 | 297 |
| 291 // Union of damaged rects, in pixel coordinates, to be used when | 298 // Union of damaged rects, in pixel coordinates, to be used when |
| 292 // compositor is ready to paint the content. | 299 // compositor is ready to paint the content. |
| 293 SkRegion damaged_region_; | 300 SkRegion damaged_region_; |
| 294 | 301 |
| 295 float opacity_; | 302 float opacity_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 312 | 319 |
| 313 // A cached copy of |Compositor::device_scale_factor()|. | 320 // A cached copy of |Compositor::device_scale_factor()|. |
| 314 float device_scale_factor_; | 321 float device_scale_factor_; |
| 315 | 322 |
| 316 DISALLOW_COPY_AND_ASSIGN(Layer); | 323 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 317 }; | 324 }; |
| 318 | 325 |
| 319 } // namespace ui | 326 } // namespace ui |
| 320 | 327 |
| 321 #endif // UI_COMPOSITOR_LAYER_H_ | 328 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |