| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 virtual SkColor GetColorForAnimation() const OVERRIDE; | 329 virtual SkColor GetColorForAnimation() const OVERRIDE; |
| 324 | 330 |
| 325 void CreateWebLayer(); | 331 void CreateWebLayer(); |
| 326 void RecomputeTransform(); | 332 void RecomputeTransform(); |
| 327 void RecomputeDrawsContentAndUVRect(); | 333 void RecomputeDrawsContentAndUVRect(); |
| 328 void RecomputeDebugBorderColor(); | 334 void RecomputeDebugBorderColor(); |
| 329 | 335 |
| 330 // Set all filters which got applied to the layer. | 336 // Set all filters which got applied to the layer. |
| 331 void SetLayerFilters(); | 337 void SetLayerFilters(); |
| 332 | 338 |
| 339 // Set all filters which got applied to the layer background. |
| 340 void SetLayerBackgroundFilters(); |
| 341 |
| 333 const LayerType type_; | 342 const LayerType type_; |
| 334 | 343 |
| 335 Compositor* compositor_; | 344 Compositor* compositor_; |
| 336 | 345 |
| 337 scoped_refptr<ui::Texture> texture_; | 346 scoped_refptr<ui::Texture> texture_; |
| 338 | 347 |
| 339 Layer* parent_; | 348 Layer* parent_; |
| 340 | 349 |
| 341 // This layer's children, in bottom-to-top stacking order. | 350 // This layer's children, in bottom-to-top stacking order. |
| 342 std::vector<Layer*> children_; | 351 std::vector<Layer*> children_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 369 float layer_grayscale_; | 378 float layer_grayscale_; |
| 370 bool layer_inverted_; | 379 bool layer_inverted_; |
| 371 | 380 |
| 372 // The associated mask layer with this layer. | 381 // The associated mask layer with this layer. |
| 373 Layer* layer_mask_; | 382 Layer* layer_mask_; |
| 374 // The back link from the mask layer to it's associated masked layer. | 383 // The back link from the mask layer to it's associated masked layer. |
| 375 // We keep this reference for the case that if the mask layer gets deleted | 384 // We keep this reference for the case that if the mask layer gets deleted |
| 376 // while attached to the main layer before the main layer is deleted. | 385 // while attached to the main layer before the main layer is deleted. |
| 377 Layer* layer_mask_back_link_; | 386 Layer* layer_mask_back_link_; |
| 378 | 387 |
| 388 // When the layer is zoomed, this is the offset to the upper left corner of |
| 389 // the area in the layer that is zoomed. |
| 390 float zoom_x_offset_; |
| 391 float zoom_y_offset_; |
| 392 |
| 393 // The zoom factor to scale the layer by. Zooming is disabled when this is |
| 394 // set to 1. |
| 395 float zoom_; |
| 396 |
| 397 // Width of the border in pixels, where the scaling is blended. |
| 398 int zoom_inset_; |
| 399 |
| 379 std::string name_; | 400 std::string name_; |
| 380 | 401 |
| 381 LayerDelegate* delegate_; | 402 LayerDelegate* delegate_; |
| 382 | 403 |
| 383 scoped_refptr<LayerAnimator> animator_; | 404 scoped_refptr<LayerAnimator> animator_; |
| 384 | 405 |
| 385 // Ownership of the layer is held through one of the strongly typed layer | 406 // Ownership of the layer is held through one of the strongly typed layer |
| 386 // pointers, depending on which sort of layer this is. | 407 // pointers, depending on which sort of layer this is. |
| 387 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 408 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 388 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 409 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 389 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 410 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 390 WebKit::WebLayer* web_layer_; | 411 WebKit::WebLayer* web_layer_; |
| 391 bool web_layer_is_accelerated_; | 412 bool web_layer_is_accelerated_; |
| 392 bool show_debug_borders_; | 413 bool show_debug_borders_; |
| 393 | 414 |
| 394 // If true, the layer scales the canvas and the texture with the device scale | 415 // If true, the layer scales the canvas and the texture with the device scale |
| 395 // factor as appropriate. When true, the texture size is in DIP. | 416 // factor as appropriate. When true, the texture size is in DIP. |
| 396 bool scale_content_; | 417 bool scale_content_; |
| 397 | 418 |
| 398 // A cached copy of |Compositor::device_scale_factor()|. | 419 // A cached copy of |Compositor::device_scale_factor()|. |
| 399 float device_scale_factor_; | 420 float device_scale_factor_; |
| 400 | 421 |
| 401 DISALLOW_COPY_AND_ASSIGN(Layer); | 422 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 402 }; | 423 }; |
| 403 | 424 |
| 404 } // namespace ui | 425 } // namespace ui |
| 405 | 426 |
| 406 #endif // UI_COMPOSITOR_LAYER_H_ | 427 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |