Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
| 6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "third_party/skia/include/core/SkRegion.h" | 16 #include "third_party/skia/include/core/SkRegion.h" |
| 17 #include "third_party/skia/include/core/SkXfermode.h" | |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
| 19 #include "ui/compositor/compositor_observer.h" | 20 #include "ui/compositor/compositor_observer.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 namespace trace_event { | 24 namespace trace_event { |
| 24 class TracedValue; | 25 class TracedValue; |
| 25 } | 26 } |
| 26 } | 27 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference); | 82 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference); |
| 82 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling); | 83 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling); |
| 83 | 84 |
| 84 // This sets the surface viewport for scaling. | 85 // This sets the surface viewport for scaling. |
| 85 void SetViewport(const gfx::Size& viewport); | 86 void SetViewport(const gfx::Size& viewport); |
| 86 | 87 |
| 87 // This sets the only visible on secure output flag, preventing it from | 88 // This sets the only visible on secure output flag, preventing it from |
| 88 // appearing in screenshots or from being viewed on non-secure displays. | 89 // appearing in screenshots or from being viewed on non-secure displays. |
| 89 void SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output); | 90 void SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output); |
| 90 | 91 |
| 92 // This sets the blend mode that will be used when drawing the surface. | |
| 93 void SetBlendMode(SkXfermode::Mode blend_mode); | |
|
Daniele Castagna
2016/05/09 23:34:19
nit: You can drop "This". Comments are usually imp
reveman
2016/05/10 14:05:19
"This" all over place in this file so I'm going to
| |
| 94 | |
| 95 // This sets the alpha value that will be applied to the whole surface. | |
| 96 void SetAlpha(float alpha); | |
| 97 | |
| 91 // Surface state (damage regions, attached buffers, etc.) is double-buffered. | 98 // Surface state (damage regions, attached buffers, etc.) is double-buffered. |
| 92 // A Commit() call atomically applies all pending state, replacing the | 99 // A Commit() call atomically applies all pending state, replacing the |
| 93 // current state. Commit() is not guaranteed to be synchronous. See | 100 // current state. Commit() is not guaranteed to be synchronous. See |
| 94 // CommitSurfaceHierarchy() below. | 101 // CommitSurfaceHierarchy() below. |
| 95 void Commit(); | 102 void Commit(); |
| 96 | 103 |
| 97 // This will synchronously commit all pending state of the surface and its | 104 // This will synchronously commit all pending state of the surface and its |
| 98 // descendants by recursively calling CommitSurfaceHierarchy() for each | 105 // descendants by recursively calling CommitSurfaceHierarchy() for each |
| 99 // sub-surface with pending state. | 106 // sub-surface with pending state. |
| 100 void CommitSurfaceHierarchy(); | 107 void CommitSurfaceHierarchy(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; | 198 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; |
| 192 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; | 199 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; |
| 193 SubSurfaceEntryList pending_sub_surfaces_; | 200 SubSurfaceEntryList pending_sub_surfaces_; |
| 194 | 201 |
| 195 // The viewport to take effect when Commit() is called. | 202 // The viewport to take effect when Commit() is called. |
| 196 gfx::Size pending_viewport_; | 203 gfx::Size pending_viewport_; |
| 197 | 204 |
| 198 // The secure output visibility state to take effect when Commit() is called. | 205 // The secure output visibility state to take effect when Commit() is called. |
| 199 bool pending_only_visible_on_secure_output_; | 206 bool pending_only_visible_on_secure_output_; |
| 200 | 207 |
| 208 // The blend mode state to take effect when Commit() is called. | |
| 209 SkXfermode::Mode pending_blend_mode_; | |
|
Daniele Castagna
2016/05/09 23:34:19
Would it make sense to group all the pending state
reveman
2016/05/10 14:05:19
It might. I'll consider it for a follow up change.
| |
| 210 | |
| 211 // The alpha state to take effect when Commit() is called. | |
| 212 float pending_alpha_; | |
| 213 | |
| 201 // The buffer that is currently set as content of surface. | 214 // The buffer that is currently set as content of surface. |
| 202 base::WeakPtr<Buffer> current_buffer_; | 215 base::WeakPtr<Buffer> current_buffer_; |
| 203 | 216 |
| 204 // The active input region used for hit testing. | 217 // The active input region used for hit testing. |
| 205 SkRegion input_region_; | 218 SkRegion input_region_; |
| 206 | 219 |
| 207 // This is true if a call to Commit() as been made but | 220 // This is true if a call to Commit() as been made but |
| 208 // CommitSurfaceHierarchy() has not yet been called. | 221 // CommitSurfaceHierarchy() has not yet been called. |
| 209 bool needs_commit_surface_hierarchy_; | 222 bool needs_commit_surface_hierarchy_; |
| 210 | 223 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 226 | 239 |
| 227 // Surface observer list. Surface does not own the observers. | 240 // Surface observer list. Surface does not own the observers. |
| 228 base::ObserverList<SurfaceObserver, true> observers_; | 241 base::ObserverList<SurfaceObserver, true> observers_; |
| 229 | 242 |
| 230 DISALLOW_COPY_AND_ASSIGN(Surface); | 243 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 231 }; | 244 }; |
| 232 | 245 |
| 233 } // namespace exo | 246 } // namespace exo |
| 234 | 247 |
| 235 #endif // COMPONENTS_EXO_SURFACE_H_ | 248 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |