
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
/* global Float32Array */
// TODO Batch by color
import * as graphic from '../../util/graphic.js';
// const BOOST_SIZE_THRESHOLD = 4;
var LineFillsPathShape = /** @class */function () {
  function LineFillsPathShape() {}
  return LineFillsPathShape;
}();
var LineFillsPath = /** @class */function (_super) {
  __extends(LineFillsPath, _super);
  // private _ctx: CanvasRenderingContext2D;
  function LineFillsPath(opts) {
    return _super.call(this, opts) || this;
  }
  LineFillsPath.prototype.getDefaultShape = function () {
    return new LineFillsPathShape();
  };
  LineFillsPath.prototype.buildPath = function (path, shape) {
    var points = shape.points,
      isWebviewRender = shape.isWebviewRender,
      fill = shape.fill;
    for (var i = 0; i < points.length;) {
      var x1 = points[i++];
      var y1 = Math.floor(points[i++]);
      var x2 = points[i++];
      var y2 = Math.floor(points[i++]);
      var x3 = points[i++];
      var y3 = Math.floor(points[i++]);
      var x4 = points[i++];
      var y4 = Math.floor(points[i++]);
      path.moveTo(x1, y1);
      path.lineTo(x2, y2);
      path.lineTo(x3, y3);
      path.lineTo(x4, y4);
      path.lineTo(x1, y1);
      if (isWebviewRender && i % 5 === 0 && fill && i !== points.length - 1) {
        path.fillStyle(fill);
        path.beginPathFill();
      }
    }
  };
  return LineFillsPath;
}(graphic.Path);
export default LineFillsPath;