Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: ui/compositor/layer.h

Issue 10800020: Add brightness/grayscale animations and use them for OOBE boot transition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove test change Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // texture (resulting alpha = opacity * alpha). 129 // texture (resulting alpha = opacity * alpha).
130 float opacity() const { return opacity_; } 130 float opacity() const { return opacity_; }
131 void SetOpacity(float opacity); 131 void SetOpacity(float opacity);
132 132
133 // Blur pixels by this amount in anything below the layer and visible through 133 // Blur pixels by this amount in anything below the layer and visible through
134 // the layer. 134 // the layer.
135 int background_blur() const { return background_blur_radius_; } 135 int background_blur() const { return background_blur_radius_; }
136 void SetBackgroundBlur(int blur_radius); 136 void SetBackgroundBlur(int blur_radius);
137 137
138 // Saturate all pixels of this layer by this amount. 138 // Saturate all pixels of this layer by this amount.
139 // This effect will get "combined" with the inverted and brightness setting. 139 // This effect will get "combined" with the inverted,
140 // brightness and grayscale setting.
140 float layer_saturation() const { return layer_saturation_; } 141 float layer_saturation() const { return layer_saturation_; }
141 void SetLayerSaturation(float saturation); 142 void SetLayerSaturation(float saturation);
142 143
143 // Change the brightness of all pixels from this layer by this amount. 144 // Change the brightness of all pixels from this layer by this amount.
144 // This effect will get "combined" with the inverted and saturate setting. 145 // This effect will get "combined" with the inverted, saturate
146 // and grayscale setting.
145 float layer_brightness() const { return layer_brightness_; } 147 float layer_brightness() const { return layer_brightness_; }
146 void SetLayerBrightness(float brightness); 148 void SetLayerBrightness(float brightness);
147 149
150 // Return the target brightness if animator is running, or the current
151 // brightness otherwise.
152 float GetTargetBrightness() const;
153
154 // Change the grayscale of all pixels from this layer by this amount.
155 // This effect will get "combined" with the inverted, saturate
156 // and brightness setting.
157 float layer_grayscale() const { return layer_grayscale_; }
158 void SetLayerGrayscale(float grayscale);
159
160 // Return the target grayscale if animator is running, or the current
161 // grayscale otherwise.
162 float GetTargetGrayscale() const;
163
148 // Invert the layer. 164 // Invert the layer.
149 bool layer_inverted() const { return layer_inverted_; } 165 bool layer_inverted() const { return layer_inverted_; }
150 void SetLayerInverted(bool inverted); 166 void SetLayerInverted(bool inverted);
151 167
152 // Return the target opacity if animator is running, or the current opacity 168 // Return the target opacity if animator is running, or the current opacity
153 // otherwise. 169 // otherwise.
154 float GetTargetOpacity() const; 170 float GetTargetOpacity() const;
155 171
156 // Set a layer mask for a layer. 172 // Set a layer mask for a layer.
157 // Note the provided layer mask can neither have a layer mask itself nor can 173 // Note the provided layer mask can neither have a layer mask itself nor can
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // WebKit and WebKit does not produce valid alpha values. All other layers 295 // WebKit and WebKit does not produce valid alpha values. All other layers
280 // should have valid alpha. 296 // should have valid alpha.
281 bool has_valid_alpha_channel() const { return !layer_updated_externally_; } 297 bool has_valid_alpha_channel() const { return !layer_updated_externally_; }
282 298
283 // Following are invoked from the animation or if no animation exists to 299 // Following are invoked from the animation or if no animation exists to
284 // update the values immediately. 300 // update the values immediately.
285 void SetBoundsImmediately(const gfx::Rect& bounds); 301 void SetBoundsImmediately(const gfx::Rect& bounds);
286 void SetTransformImmediately(const ui::Transform& transform); 302 void SetTransformImmediately(const ui::Transform& transform);
287 void SetOpacityImmediately(float opacity); 303 void SetOpacityImmediately(float opacity);
288 void SetVisibilityImmediately(bool visibility); 304 void SetVisibilityImmediately(bool visibility);
305 void SetBrightnessImmediately(float brightness);
306 void SetGrayscaleImmediately(float grayscale);
289 307
290 // Implementation of LayerAnimatorDelegate 308 // Implementation of LayerAnimatorDelegate
291 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; 309 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE;
292 virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; 310 virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE;
293 virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; 311 virtual void SetOpacityFromAnimation(float opacity) OVERRIDE;
294 virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; 312 virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE;
313 virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE;
314 virtual void SetGrayscaleFromAnimation(float grayscale) OVERRIDE;
295 virtual void ScheduleDrawForAnimation() OVERRIDE; 315 virtual void ScheduleDrawForAnimation() OVERRIDE;
296 virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; 316 virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE;
297 virtual const Transform& GetTransformForAnimation() const OVERRIDE; 317 virtual const Transform& GetTransformForAnimation() const OVERRIDE;
298 virtual float GetOpacityForAnimation() const OVERRIDE; 318 virtual float GetOpacityForAnimation() const OVERRIDE;
299 virtual bool GetVisibilityForAnimation() const OVERRIDE; 319 virtual bool GetVisibilityForAnimation() const OVERRIDE;
320 virtual float GetBrightnessForAnimation() const OVERRIDE;
321 virtual float GetGrayscaleForAnimation() const OVERRIDE;
300 322
301 void CreateWebLayer(); 323 void CreateWebLayer();
302 void RecomputeTransform(); 324 void RecomputeTransform();
303 void RecomputeDrawsContentAndUVRect(); 325 void RecomputeDrawsContentAndUVRect();
304 void RecomputeDebugBorderColor(); 326 void RecomputeDebugBorderColor();
305 327
306 // Set all filters which got applied to the layer. 328 // Set all filters which got applied to the layer.
307 void SetLayerFilters(); 329 void SetLayerFilters();
308 330
309 const LayerType type_; 331 const LayerType type_;
(...skipping 25 matching lines...) Expand all
335 // compositor is ready to paint the content. 357 // compositor is ready to paint the content.
336 SkRegion damaged_region_; 358 SkRegion damaged_region_;
337 359
338 float opacity_; 360 float opacity_;
339 int background_blur_radius_; 361 int background_blur_radius_;
340 362
341 // Several variables which will change the visible representation of 363 // Several variables which will change the visible representation of
342 // the layer. 364 // the layer.
343 float layer_saturation_; 365 float layer_saturation_;
344 float layer_brightness_; 366 float layer_brightness_;
367 float layer_grayscale_;
345 bool layer_inverted_; 368 bool layer_inverted_;
346 369
347 // The associated mask layer with this layer. 370 // The associated mask layer with this layer.
348 Layer* layer_mask_; 371 Layer* layer_mask_;
349 // The back link from the mask layer to it's associated masked layer. 372 // The back link from the mask layer to it's associated masked layer.
350 // We keep this reference for the case that if the mask layer gets deleted 373 // We keep this reference for the case that if the mask layer gets deleted
351 // while attached to the main layer before the main layer is deleted. 374 // while attached to the main layer before the main layer is deleted.
352 Layer* layer_mask_back_link_; 375 Layer* layer_mask_back_link_;
353 376
354 std::string name_; 377 std::string name_;
(...skipping 12 matching lines...) Expand all
367 390
368 // A cached copy of |Compositor::device_scale_factor()|. 391 // A cached copy of |Compositor::device_scale_factor()|.
369 float device_scale_factor_; 392 float device_scale_factor_;
370 393
371 DISALLOW_COPY_AND_ASSIGN(Layer); 394 DISALLOW_COPY_AND_ASSIGN(Layer);
372 }; 395 };
373 396
374 } // namespace ui 397 } // namespace ui
375 398
376 #endif // UI_COMPOSITOR_LAYER_H_ 399 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698