Layer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2019 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <cstdint>
  18. #include <string>
  19. #include <utils/StrongPointer.h>
  20. namespace android {
  21. typedef int64_t nsecs_t;
  22. namespace compositionengine {
  23. class Display;
  24. class LayerFE;
  25. namespace impl {
  26. struct LayerCompositionState;
  27. } // namespace impl
  28. /**
  29. * A layer contains the output-independent composition state for a front-end
  30. * Layer
  31. */
  32. class Layer {
  33. public:
  34. virtual ~Layer();
  35. // Gets the front-end interface for this layer. Can return nullptr if the
  36. // front-end layer no longer exists.
  37. virtual sp<LayerFE> getLayerFE() const = 0;
  38. using CompositionState = impl::LayerCompositionState;
  39. // Gets the raw composition state data for the layer
  40. // TODO(lpique): Make this protected once it is only internally called.
  41. virtual const CompositionState& getState() const = 0;
  42. // Allows mutable access to the raw composition state data for the layer.
  43. // This is meant to be used by the various functions that are part of the
  44. // composition process.
  45. // TODO(lpique): Make this protected once it is only internally called.
  46. virtual CompositionState& editState() = 0;
  47. // Debugging
  48. virtual void dump(std::string& result) const = 0;
  49. };
  50. } // namespace compositionengine
  51. } // namespace android