aboutsummaryrefslogtreecommitdiff
path: root/src/gpu/GrPath.cpp
blob: e76bdf2466208384ba453e0f21c4a827a4a6e3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrPath.h"

void GrPath::ComputeKey(const SkPath& path, const GrStrokeInfo& stroke, GrUniqueKey* key) {
    static const GrUniqueKey::Domain kPathDomain = GrUniqueKey::GenerateDomain();
    int strokeDataCnt = stroke.computeUniqueKeyFragmentData32Cnt();
    GrUniqueKey::Builder builder(key, kPathDomain, 2 + strokeDataCnt);
    builder[0] = path.getGenerationID();
    builder[1] = path.getFillType();
    if (strokeDataCnt > 0) {
        stroke.asUniqueKeyFragment(&builder[2]);
    }
}