1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2008 The Android Open Source Project 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#include "include/core/SkContourMeasure.h" 9cb93a386Sopenharmony_ci#include "include/core/SkPathMeasure.h" 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ciSkPathMeasure::SkPathMeasure() {} 12cb93a386Sopenharmony_ci 13cb93a386Sopenharmony_ciSkPathMeasure::SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale) 14cb93a386Sopenharmony_ci : fIter(path, forceClosed, resScale) 15cb93a386Sopenharmony_ci{ 16cb93a386Sopenharmony_ci fContour = fIter.next(); 17cb93a386Sopenharmony_ci} 18cb93a386Sopenharmony_ci 19cb93a386Sopenharmony_ciSkPathMeasure::~SkPathMeasure() {} 20cb93a386Sopenharmony_ci 21cb93a386Sopenharmony_civoid SkPathMeasure::setPath(const SkPath* path, bool forceClosed) { 22cb93a386Sopenharmony_ci fIter.reset(path ? *path : SkPath(), forceClosed); 23cb93a386Sopenharmony_ci fContour = fIter.next(); 24cb93a386Sopenharmony_ci} 25cb93a386Sopenharmony_ci 26cb93a386Sopenharmony_ciSkScalar SkPathMeasure::getLength() { 27cb93a386Sopenharmony_ci return fContour ? fContour->length() : 0; 28cb93a386Sopenharmony_ci} 29cb93a386Sopenharmony_ci 30cb93a386Sopenharmony_cibool SkPathMeasure::getPosTan(SkScalar distance, SkPoint* position, SkVector* tangent) { 31cb93a386Sopenharmony_ci return fContour && fContour->getPosTan(distance, position, tangent); 32cb93a386Sopenharmony_ci} 33cb93a386Sopenharmony_ci 34cb93a386Sopenharmony_cibool SkPathMeasure::getMatrix(SkScalar distance, SkMatrix* matrix, MatrixFlags flags) { 35cb93a386Sopenharmony_ci return fContour && fContour->getMatrix(distance, matrix, (SkContourMeasure::MatrixFlags)flags); 36cb93a386Sopenharmony_ci} 37cb93a386Sopenharmony_ci 38cb93a386Sopenharmony_cibool SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo) { 39cb93a386Sopenharmony_ci return fContour && fContour->getSegment(startD, stopD, dst, startWithMoveTo); 40cb93a386Sopenharmony_ci} 41cb93a386Sopenharmony_ci 42cb93a386Sopenharmony_cibool SkPathMeasure::isClosed() { 43cb93a386Sopenharmony_ci return fContour && fContour->isClosed(); 44cb93a386Sopenharmony_ci} 45cb93a386Sopenharmony_ci 46cb93a386Sopenharmony_cibool SkPathMeasure::nextContour() { 47cb93a386Sopenharmony_ci fContour = fIter.next(); 48cb93a386Sopenharmony_ci return !!fContour; 49cb93a386Sopenharmony_ci} 50cb93a386Sopenharmony_ci 51cb93a386Sopenharmony_ci#ifdef SK_DEBUG 52cb93a386Sopenharmony_civoid SkPathMeasure::dump() {} 53cb93a386Sopenharmony_ci#endif 54