SkCubicClipper.h 923 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright 2009 The Android Open Source Project
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef SkCubicClipper_DEFINED
  8. #define SkCubicClipper_DEFINED
  9. #include "include/core/SkPoint.h"
  10. #include "include/core/SkRect.h"
  11. /** This class is initialized with a clip rectangle, and then can be fed cubics,
  12. which must already be monotonic in Y.
  13. In the future, it might return a series of segments, allowing it to clip
  14. also in X, to ensure that all segments fit in a finite coordinate system.
  15. */
  16. class SkCubicClipper {
  17. public:
  18. SkCubicClipper();
  19. void setClip(const SkIRect& clip);
  20. bool SK_WARN_UNUSED_RESULT clipCubic(const SkPoint src[4], SkPoint dst[4]);
  21. static bool SK_WARN_UNUSED_RESULT ChopMonoAtY(const SkPoint pts[4], SkScalar y, SkScalar* t);
  22. private:
  23. SkRect fClip;
  24. };
  25. #endif // SkCubicClipper_DEFINED