| 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 a factor of |zoom|. The upper left corner of the |
| 172 // zoomed area is offset from the top left corner of the layer by |x_offset| |
| 173 // and |y_offset|. The effect is blended along the edge across |inset| |
| 174 // pixels. |
| 175 void SetBackgroundZoom(float x_offset, float y_offset, float zoom, int inset); |
| 176 |
| 171 // Invert the layer. | 177 // Invert the layer. |
| 172 bool layer_inverted() const { return layer_inverted_; } | 178 bool layer_inverted() const { return layer_inverted_; } |
| 173 void SetLayerInverted(bool inverted); | 179 void SetLayerInverted(bool inverted); |
| 174 | 180 |
| 175 // Return the target opacity if animator is running, or the current opacity | 181 // Return the target opacity if animator is running, or the current opacity |
| 176 // otherwise. | 182 // otherwise. |
| 177 float GetTargetOpacity() const; | 183 float GetTargetOpacity() const; |
| 178 | 184 |
| 179 // Set a layer mask for a layer. | 185 // Set a layer mask for a layer. |
| 180 // Note the provided layer mask can neither have a layer mask itself nor can | 186 // Note the provided layer mask can neither have a layer mask itself nor can |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 virtual SkColor GetColorForAnimation() const OVERRIDE; | 333 virtual SkColor GetColorForAnimation() const OVERRIDE; |
| 328 | 334 |
| 329 void CreateWebLayer(); | 335 void CreateWebLayer(); |
| 330 void RecomputeTransform(); | 336 void RecomputeTransform(); |
| 331 void RecomputeDrawsContentAndUVRect(); | 337 void RecomputeDrawsContentAndUVRect(); |
| 332 void RecomputeDebugBorderColor(); | 338 void RecomputeDebugBorderColor(); |
| 333 | 339 |
| 334 // Set all filters which got applied to the layer. | 340 // Set all filters which got applied to the layer. |
| 335 void SetLayerFilters(); | 341 void SetLayerFilters(); |
| 336 | 342 |
| 343 // Set all filters which got applied to the layer background. |
| 344 void SetLayerBackgroundFilters(); |
| 345 |
| 337 const LayerType type_; | 346 const LayerType type_; |
| 338 | 347 |
| 339 Compositor* compositor_; | 348 Compositor* compositor_; |
| 340 | 349 |
| 341 scoped_refptr<ui::Texture> texture_; | 350 scoped_refptr<ui::Texture> texture_; |
| 342 | 351 |
| 343 Layer* parent_; | 352 Layer* parent_; |
| 344 | 353 |
| 345 // This layer's children, in bottom-to-top stacking order. | 354 // This layer's children, in bottom-to-top stacking order. |
| 346 std::vector<Layer*> children_; | 355 std::vector<Layer*> children_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 373 float layer_grayscale_; | 382 float layer_grayscale_; |
| 374 bool layer_inverted_; | 383 bool layer_inverted_; |
| 375 | 384 |
| 376 // The associated mask layer with this layer. | 385 // The associated mask layer with this layer. |
| 377 Layer* layer_mask_; | 386 Layer* layer_mask_; |
| 378 // The back link from the mask layer to it's associated masked layer. | 387 // The back link from the mask layer to it's associated masked layer. |
| 379 // We keep this reference for the case that if the mask layer gets deleted | 388 // We keep this reference for the case that if the mask layer gets deleted |
| 380 // while attached to the main layer before the main layer is deleted. | 389 // while attached to the main layer before the main layer is deleted. |
| 381 Layer* layer_mask_back_link_; | 390 Layer* layer_mask_back_link_; |
| 382 | 391 |
| 392 // When the layer is zoomed, this is the offset to the upper left corner of |
| 393 // the area in the layer that is zoomed. |
| 394 float zoom_x_offset_; |
| 395 float zoom_y_offset_; |
| 396 |
| 397 // The zoom factor to scale the layer by. Zooming is disabled when this is |
| 398 // set to 1. |
| 399 float zoom_; |
| 400 |
| 401 // Width of the border in pixels, where the scaling is blended. |
| 402 int zoom_inset_; |
| 403 |
| 383 std::string name_; | 404 std::string name_; |
| 384 | 405 |
| 385 LayerDelegate* delegate_; | 406 LayerDelegate* delegate_; |
| 386 | 407 |
| 387 scoped_refptr<LayerAnimator> animator_; | 408 scoped_refptr<LayerAnimator> animator_; |
| 388 | 409 |
| 389 // Ownership of the layer is held through one of the strongly typed layer | 410 // Ownership of the layer is held through one of the strongly typed layer |
| 390 // pointers, depending on which sort of layer this is. | 411 // pointers, depending on which sort of layer this is. |
| 391 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 412 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 392 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 413 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 393 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 414 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 394 WebKit::WebLayer* web_layer_; | 415 WebKit::WebLayer* web_layer_; |
| 395 bool web_layer_is_accelerated_; | 416 bool web_layer_is_accelerated_; |
| 396 bool show_debug_borders_; | 417 bool show_debug_borders_; |
| 397 | 418 |
| 398 // If true, the layer scales the canvas and the texture with the device scale | 419 // If true, the layer scales the canvas and the texture with the device scale |
| 399 // factor as appropriate. When true, the texture size is in DIP. | 420 // factor as appropriate. When true, the texture size is in DIP. |
| 400 bool scale_content_; | 421 bool scale_content_; |
| 401 | 422 |
| 402 // A cached copy of |Compositor::device_scale_factor()|. | 423 // A cached copy of |Compositor::device_scale_factor()|. |
| 403 float device_scale_factor_; | 424 float device_scale_factor_; |
| 404 | 425 |
| 405 DISALLOW_COPY_AND_ASSIGN(Layer); | 426 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 406 }; | 427 }; |
| 407 | 428 |
| 408 } // namespace ui | 429 } // namespace ui |
| 409 | 430 |
| 410 #endif // UI_COMPOSITOR_LAYER_H_ | 431 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |