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

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

Issue 437473002: Wrap NV_path_rendering API with GrGLPathRendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix builds more Created 6 years, 4 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
« no previous file with comments | « src/gpu/gl/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPath.cpp
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 1c745808e986a74022b936efcf9aefe0b6b8b5a5..6f158cdea9bc9ee4470c89d2fe10ba89e52b2a22 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -7,13 +7,9 @@
*/
#include "GrGLPath.h"
+#include "GrGLPathRendering.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)
-
namespace {
inline GrGLubyte verb_to_gl_path_cmd(SkPath::Verb verb) {
static const GrGLubyte gTable[] = {
@@ -85,10 +81,11 @@ inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) {
static const bool kIsWrapped = false; // The constructor creates the GL path object.
-void GrGLPath::InitPathObject(const GrGLInterface* gl,
+void GrGLPath::InitPathObject(GrGpuGL* gpu,
GrGLuint pathID,
const SkPath& skPath,
const SkStrokeRec& stroke) {
+ GrGLPathRendering* pr = gpu->pathRendering();
SkSTArray<16, GrGLubyte, true> pathCommands;
SkSTArray<16, SkPoint, true> pathPoints;
@@ -109,30 +106,25 @@ void GrGLPath::InitPathObject(const GrGLInterface* gl,
}
SkASSERT(pathPoints.count() == numPts);
- GR_GL_CALL(gl, PathCommands(pathID,
- verbCnt, &pathCommands[0],
- 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0]));
-
+ pr->pathCommands(pathID, verbCnt, &pathCommands[0], 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0]);
if (stroke.needToApply()) {
SkASSERT(!stroke.isHairlineStyle());
- GR_GL_CALL(gl, PathParameterf(pathID, GR_GL_PATH_STROKE_WIDTH, SkScalarToFloat(stroke.getWidth())));
- GR_GL_CALL(gl, PathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(stroke.getMiter())));
+ pr->pathParameterf(pathID, GR_GL_PATH_STROKE_WIDTH, SkScalarToFloat(stroke.getWidth()));
+ pr->pathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(stroke.getMiter()));
GrGLenum join = join_to_gl_join(stroke.getJoin());
- GR_GL_CALL(gl, PathParameteri(pathID, GR_GL_PATH_JOIN_STYLE, join));
+ pr->pathParameteri(pathID, GR_GL_PATH_JOIN_STYLE, join);
GrGLenum cap = cap_to_gl_cap(stroke.getCap());
- GR_GL_CALL(gl, PathParameteri(pathID, GR_GL_PATH_INITIAL_END_CAP, cap));
- GR_GL_CALL(gl, PathParameteri(pathID, GR_GL_PATH_TERMINAL_END_CAP, cap));
+ pr->pathParameteri(pathID, GR_GL_PATH_INITIAL_END_CAP, cap);
+ pr->pathParameteri(pathID, GR_GL_PATH_TERMINAL_END_CAP, cap);
}
}
GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke)
- : INHERITED(gpu, kIsWrapped, path, stroke) {
+ : INHERITED(gpu, kIsWrapped, path, stroke),
+ fPathID(gpu->pathRendering()->genPaths(1)) {
SkASSERT(!path.isEmpty());
- fPathID = gpu->createGLPathObject();
-
- InitPathObject(static_cast<GrGpuGL*>(this->getGpu())->glInterface(),
- fPathID, fSkPath, stroke);
+ InitPathObject(gpu, fPathID, fSkPath, stroke);
if (stroke.needToApply()) {
// FIXME: try to account for stroking, without rasterizing the stroke.
@@ -146,7 +138,7 @@ GrGLPath::~GrGLPath() {
void GrGLPath::onRelease() {
if (0 != fPathID && !this->isWrapped()) {
- static_cast<GrGpuGL*>(this->getGpu())->deleteGLPathObject(fPathID);
+ static_cast<GrGpuGL*>(this->getGpu())->pathRendering()->deletePaths(fPathID, 1);
fPathID = 0;
}
« no previous file with comments | « src/gpu/gl/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698