Command.cpp 950 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Painting/Command.h>
  7. #include <LibWeb/Painting/ShadowPainting.h>
  8. namespace Web::Painting {
  9. void DrawGlyphRun::translate_by(Gfx::IntPoint const& offset)
  10. {
  11. for (auto& glyph : glyph_run) {
  12. glyph.visit([&](auto& glyph) {
  13. glyph.translate_by(offset.to_type<float>());
  14. });
  15. }
  16. rect.translate_by(offset);
  17. }
  18. Gfx::IntRect PaintOuterBoxShadow::bounding_rect() const
  19. {
  20. return get_outer_box_shadow_bounding_rect(outer_box_shadow_params);
  21. }
  22. void PaintOuterBoxShadow::translate_by(Gfx::IntPoint const& offset)
  23. {
  24. outer_box_shadow_params.device_content_rect.translate_by(offset.to_type<DevicePixels>());
  25. }
  26. void PaintInnerBoxShadow::translate_by(Gfx::IntPoint const& offset)
  27. {
  28. outer_box_shadow_params.device_content_rect.translate_by(offset.to_type<DevicePixels>());
  29. }
  30. }