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