transform_recorder.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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
  3. // found in the LICENSE file.
  4. #ifndef UI_COMPOSITOR_TRANSFORM_RECORDER_H_
  5. #define UI_COMPOSITOR_TRANSFORM_RECORDER_H_
  6. #include "ui/compositor/compositor_export.h"
  7. namespace cc {
  8. class DisplayItemList;
  9. }
  10. namespace gfx {
  11. class Transform;
  12. }
  13. namespace ui {
  14. class PaintContext;
  15. // A class to provide scoped transforms of painting to a DisplayItemList. The
  16. // transform provided will be applied to any DisplayItems added to the
  17. // DisplayItemList while this object is alive. In other words, any nested
  18. // recorders will be transformed.
  19. class COMPOSITOR_EXPORT TransformRecorder {
  20. public:
  21. explicit TransformRecorder(const PaintContext& context);
  22. TransformRecorder(const TransformRecorder&) = delete;
  23. TransformRecorder& operator=(const TransformRecorder&) = delete;
  24. ~TransformRecorder();
  25. void Transform(const gfx::Transform& transform);
  26. private:
  27. const PaintContext& context_;
  28. bool transformed_;
  29. };
  30. } // namespace ui
  31. #endif // UI_COMPOSITOR_TRANSFORM_RECORDER_H_