aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRenderer.cpp
blob: 929941a47eb4f3eaecad3d275f14e79af7731377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrPathRenderer.h"

GrPathRenderer::GrPathRenderer()
    : fPath(NULL)
    , fTarget(NULL) {
}

void GrPathRenderer::setPath(GrDrawTarget* target,
                             const SkPath* path,
                             GrPathFill fill,
                             const GrPoint* translate) {
    GrAssert(NULL == fPath);
    GrAssert(NULL == fTarget);
    GrAssert(NULL != target);

    fTarget = target;
    fPath = path;
    fFill = fill;
    if (NULL != translate) {
        fTranslate = *translate;
    } else {
        fTranslate.fX = fTranslate.fY = 0;
    }
    this->pathWasSet();
}

void GrPathRenderer::clearPath() {
    this->pathWillClear();
    fTarget->resetVertexSource();
    fTarget->resetIndexSource();
    fTarget = NULL;
    fPath = NULL;
}