2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrPathRange_DEFINED
9 #define GrPathRange_DEFINED
11 #include "GrGpuResource.h"
12 #include "GrResourceCache.h"
13 #include "SkStrokeRec.h"
18 * Represents a contiguous range of GPU path objects with a common stroke. The
19 * path range is immutable with the exception that individual paths can be
20 * initialized lazily. Unititialized paths are silently ignored by drawing
23 class GrPathRange : public GrGpuResource {
25 SK_DECLARE_INST_COUNT(GrPathRange);
27 static const bool kIsWrapped = false;
29 static GrResourceKey::ResourceType resourceType() {
30 static const GrResourceKey::ResourceType type = GrResourceKey::GenerateResourceType();
35 * Initialize to a range with a fixed size and stroke. Stroke must not be hairline.
37 GrPathRange(GrGpu* gpu, size_t size, const SkStrokeRec& stroke)
38 : INHERITED(gpu, kIsWrapped),
43 size_t getSize() const { return fSize; }
44 const SkStrokeRec& getStroke() const { return fStroke; }
47 * Initialize a path in the range. It is invalid to call this method for a
48 * path that has already been initialized.
50 virtual void initAt(size_t index, const SkPath&) = 0;
57 typedef GrGpuResource INHERITED;