blob: 06a00e44b76763f9dc273359971c73a1d7754e0e [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
bsalomon@google.com30085192011-08-19 15:42:31 +00008
bsalomon@google.comffca4002011-02-22 20:34:01 +00009#include "GrPathRenderer.h"
10
tomhudson@google.comd22b6e42011-06-24 15:53:40 +000011GrPathRenderer::GrPathRenderer()
bsalomon@google.comee435122011-07-01 14:57:55 +000012 : fCurveTolerance (GR_Scalar1)
13 , fPath(NULL)
14 , fTarget(NULL) {
tomhudson@google.comd22b6e42011-06-24 15:53:40 +000015}
bsalomon@google.comee435122011-07-01 14:57:55 +000016
bsalomon@google.comee435122011-07-01 14:57:55 +000017void GrPathRenderer::setPath(GrDrawTarget* target,
18 const SkPath* path,
19 GrPathFill fill,
20 const GrPoint* translate) {
21 GrAssert(NULL == fPath);
22 GrAssert(NULL == fTarget);
23 GrAssert(NULL != target);
24
25 fTarget = target;
26 fPath = path;
27 fFill = fill;
28 if (NULL != translate) {
29 fTranslate = *translate;
30 } else {
31 fTranslate.fX = fTranslate.fY = 0;
32 }
33 this->pathWasSet();
34}
35
36void GrPathRenderer::clearPath() {
37 this->pathWillClear();
38 fTarget->resetVertexSource();
bsalomon@google.com25fd36c2011-07-06 17:41:08 +000039 fTarget->resetIndexSource();
bsalomon@google.comee435122011-07-01 14:57:55 +000040 fTarget = NULL;
41 fPath = NULL;
42}