Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: src/gpu/GrPathRange.h

Issue 400713003: Add a GrPathRange class (Closed) Base URL: https://skia.googlesource.com/skia.git@clupload-ispath
Patch Set: Fix more windows trivial warningswq Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrPathRange.h
diff --git a/src/gpu/GrPathRange.h b/src/gpu/GrPathRange.h
new file mode 100644
index 0000000000000000000000000000000000000000..02342c4e0ef9a98dd7c20a64f52e0e5e5287c5e6
--- /dev/null
+++ b/src/gpu/GrPathRange.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrPathRange_DEFINED
+#define GrPathRange_DEFINED
+
+#include "GrGpuObject.h"
+#include "GrResourceCache.h"
+#include "SkStrokeRec.h"
+
+class SkPath;
+
+/**
+ * Represents a contiguous range of GPU path objects with a common stroke. The
+ * path range is immutable with the exception that individual paths can be
+ * initialized lazily. Unititialized paths are silently ignored by drawing
+ * functions.
+ */
+class GrPathRange : public GrGpuObject {
+public:
+ SK_DECLARE_INST_COUNT(GrPathRange);
+
+ static const bool kIsWrapped = false;
+
+ static GrResourceKey::ResourceType resourceType() {
+ static const GrResourceKey::ResourceType type = GrResourceKey::GenerateResourceType();
+ return type;
+ }
+
+ /**
+ * Initialize to a range with a fixed size and stroke. Stroke must not be hairline.
+ */
+ GrPathRange(GrGpu* gpu, size_t size, const SkStrokeRec& stroke)
+ : INHERITED(gpu, kIsWrapped),
+ fSize(size),
+ fStroke(stroke) {
+ }
+
+ size_t getSize() const { return fSize; }
+ const SkStrokeRec& getStroke() const { return fStroke; }
+
+ /**
+ * Initialize a path in the range. It is invalid to call this method for a
+ * path that has already been initialized.
+ */
+ virtual void initAt(size_t index, const SkPath&) = 0;
+
+protected:
+ size_t fSize;
+ SkStrokeRec fStroke;
+
+private:
+ typedef GrGpuObject INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698