mask_filter_info.cc 864 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2020 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. #include "ui/gfx/geometry/mask_filter_info.h"
  5. #include <sstream>
  6. #include "ui/gfx/geometry/transform.h"
  7. namespace gfx {
  8. bool MaskFilterInfo::Transform(const gfx::Transform& transform) {
  9. if (rounded_corner_bounds_.IsEmpty())
  10. return false;
  11. if (!transform.TransformRRectF(&rounded_corner_bounds_))
  12. return false;
  13. if (gradient_mask_ && !gradient_mask_->IsEmpty())
  14. gradient_mask_->Transform(transform);
  15. return true;
  16. }
  17. std::string MaskFilterInfo::ToString() const {
  18. std::string result = "MaskFilterInfo{" + rounded_corner_bounds_.ToString();
  19. if (gradient_mask_)
  20. result += ", gradient_mask=" + gradient_mask_->ToString() + "}";
  21. return result;
  22. }
  23. } // namespace gfx