Chromium Code Reviews| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 // Change the grayscale of all pixels from this layer by this amount. | 161 // Change the grayscale of all pixels from this layer by this amount. |
| 162 // This effect will get "combined" with the inverted, saturate | 162 // This effect will get "combined" with the inverted, saturate |
| 163 // and brightness setting. | 163 // and brightness setting. |
| 164 float layer_grayscale() const { return layer_grayscale_; } | 164 float layer_grayscale() const { return layer_grayscale_; } |
| 165 void SetLayerGrayscale(float grayscale); | 165 void SetLayerGrayscale(float grayscale); |
| 166 | 166 |
| 167 // Return the target grayscale if animator is running, or the current | 167 // Return the target grayscale if animator is running, or the current |
| 168 // grayscale otherwise. | 168 // grayscale otherwise. |
| 169 float GetTargetGrayscale() const; | 169 float GetTargetGrayscale() const; |
| 170 | 170 |
| 171 // Zoom the background by this amount. | |
|
sky
2012/10/11 17:00:49
Its not obvious what 'inset' is, document it.
Zachary Kuznia
2012/10/12 08:41:35
Done.
| |
| 172 void SetBackgroundZoom(float x_offset, float y_offset, float zoom, int inset); | |
| 173 | |
| 171 // Invert the layer. | 174 // Invert the layer. |
| 172 bool layer_inverted() const { return layer_inverted_; } | 175 bool layer_inverted() const { return layer_inverted_; } |
| 173 void SetLayerInverted(bool inverted); | 176 void SetLayerInverted(bool inverted); |
| 174 | 177 |
| 175 // Return the target opacity if animator is running, or the current opacity | 178 // Return the target opacity if animator is running, or the current opacity |
| 176 // otherwise. | 179 // otherwise. |
| 177 float GetTargetOpacity() const; | 180 float GetTargetOpacity() const; |
| 178 | 181 |
| 179 // Set a layer mask for a layer. | 182 // Set a layer mask for a layer. |
| 180 // Note the provided layer mask can neither have a layer mask itself nor can | 183 // Note the provided layer mask can neither have a layer mask itself nor can |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 virtual float GetGrayscaleForAnimation() const OVERRIDE; | 322 virtual float GetGrayscaleForAnimation() const OVERRIDE; |
| 320 | 323 |
| 321 void CreateWebLayer(); | 324 void CreateWebLayer(); |
| 322 void RecomputeTransform(); | 325 void RecomputeTransform(); |
| 323 void RecomputeDrawsContentAndUVRect(); | 326 void RecomputeDrawsContentAndUVRect(); |
| 324 void RecomputeDebugBorderColor(); | 327 void RecomputeDebugBorderColor(); |
| 325 | 328 |
| 326 // Set all filters which got applied to the layer. | 329 // Set all filters which got applied to the layer. |
| 327 void SetLayerFilters(); | 330 void SetLayerFilters(); |
| 328 | 331 |
| 332 // Set all filters which got applied to the layer background. | |
| 333 void SetLayerBackgroundFilters(); | |
| 334 | |
| 329 const LayerType type_; | 335 const LayerType type_; |
| 330 | 336 |
| 331 Compositor* compositor_; | 337 Compositor* compositor_; |
| 332 | 338 |
| 333 scoped_refptr<ui::Texture> texture_; | 339 scoped_refptr<ui::Texture> texture_; |
| 334 | 340 |
| 335 Layer* parent_; | 341 Layer* parent_; |
| 336 | 342 |
| 337 // This layer's children, in bottom-to-top stacking order. | 343 // This layer's children, in bottom-to-top stacking order. |
| 338 std::vector<Layer*> children_; | 344 std::vector<Layer*> children_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 365 float layer_grayscale_; | 371 float layer_grayscale_; |
| 366 bool layer_inverted_; | 372 bool layer_inverted_; |
| 367 | 373 |
| 368 // The associated mask layer with this layer. | 374 // The associated mask layer with this layer. |
| 369 Layer* layer_mask_; | 375 Layer* layer_mask_; |
| 370 // The back link from the mask layer to it's associated masked layer. | 376 // The back link from the mask layer to it's associated masked layer. |
| 371 // We keep this reference for the case that if the mask layer gets deleted | 377 // We keep this reference for the case that if the mask layer gets deleted |
| 372 // while attached to the main layer before the main layer is deleted. | 378 // while attached to the main layer before the main layer is deleted. |
| 373 Layer* layer_mask_back_link_; | 379 Layer* layer_mask_back_link_; |
| 374 | 380 |
| 381 // When the layer is zoomed, this is the offset to the upper left corner of | |
| 382 // the area in the layer that is zoomed. | |
| 383 float zoom_x_offset_; | |
| 384 float zoom_y_offset_; | |
| 385 | |
| 386 // The zoom factor to scale the layer by. Zooming is disabled when this is | |
| 387 // set to 1. | |
| 388 float zoom_; | |
| 389 | |
| 390 // Width of the border in pixels, where the scaling is blended. | |
| 391 int zoom_inset_; | |
| 392 | |
| 375 std::string name_; | 393 std::string name_; |
| 376 | 394 |
| 377 LayerDelegate* delegate_; | 395 LayerDelegate* delegate_; |
| 378 | 396 |
| 379 scoped_refptr<LayerAnimator> animator_; | 397 scoped_refptr<LayerAnimator> animator_; |
| 380 | 398 |
| 381 // Ownership of the layer is held through one of the strongly typed layer | 399 // Ownership of the layer is held through one of the strongly typed layer |
| 382 // pointers, depending on which sort of layer this is. | 400 // pointers, depending on which sort of layer this is. |
| 383 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 401 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 384 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 402 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 385 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 403 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 386 WebKit::WebLayer* web_layer_; | 404 WebKit::WebLayer* web_layer_; |
| 387 bool web_layer_is_accelerated_; | 405 bool web_layer_is_accelerated_; |
| 388 bool show_debug_borders_; | 406 bool show_debug_borders_; |
| 389 | 407 |
| 390 // If true, the layer scales the canvas and the texture with the device scale | 408 // If true, the layer scales the canvas and the texture with the device scale |
| 391 // factor as appropriate. When true, the texture size is in DIP. | 409 // factor as appropriate. When true, the texture size is in DIP. |
| 392 bool scale_content_; | 410 bool scale_content_; |
| 393 | 411 |
| 394 // A cached copy of |Compositor::device_scale_factor()|. | 412 // A cached copy of |Compositor::device_scale_factor()|. |
| 395 float device_scale_factor_; | 413 float device_scale_factor_; |
| 396 | 414 |
| 397 DISALLOW_COPY_AND_ASSIGN(Layer); | 415 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 398 }; | 416 }; |
| 399 | 417 |
| 400 } // namespace ui | 418 } // namespace ui |
| 401 | 419 |
| 402 #endif // UI_COMPOSITOR_LAYER_H_ | 420 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |