author Butkovits Atila <>
Wed, 24 Feb 2021 19:53:42 +0200
changeset 568630 69be3221f49a2acb92b734baf725e19bdf9a4fd9
parent 477657 45f8d9f8f3331542ed88648bf782e2517eecf819
permissions -rw-r--r--
Backed out 4 changesets (bug 1689499, bug 1686218) for causing failure at bug1689499.js;module;async. CLOSED TREE Backed out changeset e5819ad68d91 (bug 1686218) Backed out changeset b42024c79b4c (bug 1689499) Backed out changeset 83dcd14e375a (bug 1689499) Backed out changeset bf45ac283ab7 (bug 1689499)

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "2D.h"
#include <vector>

namespace mozilla {
namespace gfx {

struct FlatPathOp {
  enum OpType {

  OpType mType;
  Point mPoint;

class FlattenedPath : public PathSink {

  FlattenedPath() : mCachedLength(0), mCalculatedLength(false) {}

  virtual void MoveTo(const Point& aPoint) override;
  virtual void LineTo(const Point& aPoint) override;
  virtual void BezierTo(const Point& aCP1, const Point& aCP2,
                        const Point& aCP3) override;
  virtual void QuadraticBezierTo(const Point& aCP1, const Point& aCP2) override;
  virtual void Close() override;
  virtual void Arc(const Point& aOrigin, float aRadius, float aStartAngle,
                   float aEndAngle, bool aAntiClockwise = false) override;

  virtual Point CurrentPoint() const override {
    return mPathOps.empty() ? Point() : mPathOps[mPathOps.size() - 1].mPoint;

  Float ComputeLength();
  Point ComputePointAtLength(Float aLength, Point* aTangent);

  Float mCachedLength;
  bool mCalculatedLength;

  std::vector<FlatPathOp> mPathOps;

}  // namespace gfx
}  // namespace mozilla