LayerProtoHelper.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2017 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. #include <layerproto/LayerProtoHeader.h>
  17. #include <Layer.h>
  18. #include <input/InputWindow.h>
  19. #include <math/vec4.h>
  20. #include <ui/GraphicBuffer.h>
  21. #include <ui/Rect.h>
  22. #include <ui/Region.h>
  23. #include <ui/Transform.h>
  24. namespace android {
  25. namespace surfaceflinger {
  26. class LayerProtoHelper {
  27. public:
  28. static void writePositionToProto(const float x, const float y,
  29. std::function<PositionProto*()> getPositionProto);
  30. static void writeSizeToProto(const uint32_t w, const uint32_t h,
  31. std::function<SizeProto*()> getSizeProto);
  32. static void writeToProto(const Rect& rect, std::function<RectProto*()> getRectProto);
  33. static void writeToProto(const FloatRect& rect,
  34. std::function<FloatRectProto*()> getFloatRectProto);
  35. static void writeToProto(const Region& region, std::function<RegionProto*()> getRegionProto);
  36. static void writeToProto(const half4 color, std::function<ColorProto*()> getColorProto);
  37. static void writeToProto(const ui::Transform& transform, TransformProto* transformProto);
  38. static void writeToProto(const sp<GraphicBuffer>& buffer,
  39. std::function<ActiveBufferProto*()> getActiveBufferProto);
  40. static void writeToProto(const InputWindowInfo& inputInfo,
  41. const wp<Layer>& touchableRegionBounds,
  42. std::function<InputWindowInfoProto*()> getInputWindowInfoProto);
  43. };
  44. } // namespace surfaceflinger
  45. } // namespace android