blob: 929941a47eb4f3eaecad3d275f14e79af7731377 [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.com181e9bd2011-09-07 18:42:30 +000012 : fPath(NULL)
bsalomon@google.comee435122011-07-01 14:57:55 +000013 , fTarget(NULL) {
tomhudson@google.comd22b6e42011-06-24 15:53:40 +000014}
bsalomon@google.comee435122011-07-01 14:57:55 +000015
bsalomon@google.comee435122011-07-01 14:57:55 +000016void GrPathRenderer::setPath(GrDrawTarget* target,
17 const SkPath* path,
18 GrPathFill fill,
19 const GrPoint* translate) {
20 GrAssert(NULL == fPath);
21 GrAssert(NULL == fTarget);
22 GrAssert(NULL != target);
23
24 fTarget = target;
25 fPath = path;
26 fFill = fill;
27 if (NULL != translate) {
28 fTranslate = *translate;
29 } else {
30 fTranslate.fX = fTranslate.fY = 0;
31 }
32 this->pathWasSet();
33}
34
35void GrPathRenderer::clearPath() {
36 this->pathWillClear();
37 fTarget->resetVertexSource();
bsalomon@google.com25fd36c2011-07-06 17:41:08 +000038 fTarget->resetIndexSource();
bsalomon@google.comee435122011-07-01 14:57:55 +000039 fTarget = NULL;
40 fPath = NULL;
41}