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

Unified Diff: src/gpu/gl/GrGLPathRange.cpp

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/gl/GrGLPathRange.cpp
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2df04e3057ef0ba9d1ce66c1910010883c563c03
--- /dev/null
+++ b/src/gpu/gl/GrGLPathRange.cpp
@@ -0,0 +1,62 @@
+
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLPathRange.h"
+#include "GrGLPath.h"
+#include "GrGpuGL.h"
+
+#define GPUGL static_cast<GrGpuGL*>(this->getGpu())
+
+#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
+#define GL_CALL_RET(R, X) GR_GL_CALL_RET(GPUGL->glInterface(), R, X)
+
+GrGLPathRange::GrGLPathRange(GrGpu* gpu, size_t size, const SkStrokeRec& stroke)
+ : INHERITED(gpu, size, stroke),
+ fNumDefinedPaths(0) {
+ GL_CALL_RET(fBasePathID, GenPaths(fSize));
+}
+
+GrGLPathRange::~GrGLPathRange() {
+ this->release();
+}
+
+void GrGLPathRange::initAt(size_t index, const SkPath& skPath) {
+ GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu());
+ if (NULL == gpu) {
+ return;
+ }
+
+#ifdef SK_DEBUG
+ // Make sure the path at this index hasn't been initted already.
+ GrGLboolean hasPathAtIndex;
+ GL_CALL_RET(hasPathAtIndex, IsPath(fBasePathID + index));
+ SkASSERT(GR_GL_FALSE == hasPathAtIndex);
+#endif
+
+ GrGLPath::InitPathObject(gpu->glInterface(), fBasePathID + index, skPath, fStroke);
+
+ ++fNumDefinedPaths;
+ this->didChangeGpuMemorySize();
+}
+
+void GrGLPathRange::onRelease() {
+ SkASSERT(NULL != this->getGpu());
+
+ if (0 != fBasePathID && !this->isWrapped()) {
+ GL_CALL(DeletePaths(fBasePathID, fSize));
+ fBasePathID = 0;
+ }
+
+ INHERITED::onRelease();
+}
+
+void GrGLPathRange::onAbandon() {
+ fBasePathID = 0;
+
+ INHERITED::onAbandon();
+}
« src/gpu/GrDrawTarget.h ('K') | « src/gpu/gl/GrGLPathRange.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698