blob: a4f7d0cdd9d0916ca468eccad172f7db3de2aae0 [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,
bsalomon@google.com289533a2011-10-27 12:34:25 +000019 bool antiAlias,
bsalomon@google.comee435122011-07-01 14:57:55 +000020 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;
bsalomon@google.com289533a2011-10-27 12:34:25 +000028 fAntiAlias = antiAlias;
bsalomon@google.comee435122011-07-01 14:57:55 +000029 if (NULL != translate) {
30 fTranslate = *translate;
31 } else {
32 fTranslate.fX = fTranslate.fY = 0;
33 }
34 this->pathWasSet();
35}
36
37void GrPathRenderer::clearPath() {
38 this->pathWillClear();
39 fTarget->resetVertexSource();
bsalomon@google.com25fd36c2011-07-06 17:41:08 +000040 fTarget->resetIndexSource();
bsalomon@google.comee435122011-07-01 14:57:55 +000041 fTarget = NULL;
42 fPath = NULL;
43}