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. | |
| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 virtual float GetGrayscaleForAnimation() const OVERRIDE; | 321 virtual float GetGrayscaleForAnimation() const OVERRIDE; |
| 319 | 322 |
| 320 void CreateWebLayer(); | 323 void CreateWebLayer(); |
| 321 void RecomputeTransform(); | 324 void RecomputeTransform(); |
| 322 void RecomputeDrawsContentAndUVRect(); | 325 void RecomputeDrawsContentAndUVRect(); |
| 323 void RecomputeDebugBorderColor(); | 326 void RecomputeDebugBorderColor(); |
| 324 | 327 |
| 325 // Set all filters which got applied to the layer. | 328 // Set all filters which got applied to the layer. |
| 326 void SetLayerFilters(); | 329 void SetLayerFilters(); |
| 327 | 330 |
| 331 // Set all filters which got applied to the layer background. | |
| 332 void SetLayerBackgroundFilters(); | |
| 333 | |
| 328 const LayerType type_; | 334 const LayerType type_; |
| 329 | 335 |
| 330 Compositor* compositor_; | 336 Compositor* compositor_; |
| 331 | 337 |
| 332 scoped_refptr<ui::Texture> texture_; | 338 scoped_refptr<ui::Texture> texture_; |
| 333 | 339 |
| 334 Layer* parent_; | 340 Layer* parent_; |
| 335 | 341 |
| 336 // This layer's children, in bottom-to-top stacking order. | 342 // This layer's children, in bottom-to-top stacking order. |
| 337 std::vector<Layer*> children_; | 343 std::vector<Layer*> children_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 364 float layer_grayscale_; | 370 float layer_grayscale_; |
| 365 bool layer_inverted_; | 371 bool layer_inverted_; |
| 366 | 372 |
| 367 // The associated mask layer with this layer. | 373 // The associated mask layer with this layer. |
| 368 Layer* layer_mask_; | 374 Layer* layer_mask_; |
| 369 // The back link from the mask layer to it's associated masked layer. | 375 // The back link from the mask layer to it's associated masked layer. |
| 370 // We keep this reference for the case that if the mask layer gets deleted | 376 // We keep this reference for the case that if the mask layer gets deleted |
| 371 // while attached to the main layer before the main layer is deleted. | 377 // while attached to the main layer before the main layer is deleted. |
| 372 Layer* layer_mask_back_link_; | 378 Layer* layer_mask_back_link_; |
| 373 | 379 |
| 380 float zoom_x_offset_; | |
| 381 float zoom_y_offset_; | |
| 382 float zoom_; | |
| 383 int zoom_inset_; | |
|
oshima
2012/09/13 16:35:31
document
Zachary Kuznia
2012/10/09 09:02:36
Done.
| |
| 384 | |
| 374 std::string name_; | 385 std::string name_; |
| 375 | 386 |
| 376 LayerDelegate* delegate_; | 387 LayerDelegate* delegate_; |
| 377 | 388 |
| 378 scoped_ptr<LayerAnimator> animator_; | 389 scoped_ptr<LayerAnimator> animator_; |
| 379 | 390 |
| 380 // Ownership of the layer is held through one of the strongly typed layer | 391 // Ownership of the layer is held through one of the strongly typed layer |
| 381 // pointers, depending on which sort of layer this is. | 392 // pointers, depending on which sort of layer this is. |
| 382 scoped_ptr<WebKit::WebContentLayer> content_layer_; | 393 scoped_ptr<WebKit::WebContentLayer> content_layer_; |
| 383 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; | 394 scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; |
| 384 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; | 395 scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; |
| 385 WebKit::WebLayer* web_layer_; | 396 WebKit::WebLayer* web_layer_; |
| 386 bool web_layer_is_accelerated_; | 397 bool web_layer_is_accelerated_; |
| 387 bool show_debug_borders_; | 398 bool show_debug_borders_; |
| 388 | 399 |
| 389 // If true, the layer scales the canvas and the texture with the device scale | 400 // If true, the layer scales the canvas and the texture with the device scale |
| 390 // factor as appropriate. When true, the texture size is in DIP. | 401 // factor as appropriate. When true, the texture size is in DIP. |
| 391 bool scale_content_; | 402 bool scale_content_; |
| 392 | 403 |
| 393 // A cached copy of |Compositor::device_scale_factor()|. | 404 // A cached copy of |Compositor::device_scale_factor()|. |
| 394 float device_scale_factor_; | 405 float device_scale_factor_; |
| 395 | 406 |
| 396 DISALLOW_COPY_AND_ASSIGN(Layer); | 407 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 397 }; | 408 }; |
| 398 | 409 |
| 399 } // namespace ui | 410 } // namespace ui |
| 400 | 411 |
| 401 #endif // UI_COMPOSITOR_LAYER_H_ | 412 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |