| 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;
|
| }
|
|
|
|
|