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

Side by Side Diff: src/gpu/gl/GrGLPathRange.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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLPathRange.h ('k') | src/gpu/gl/GrGLPathRendering.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrGLPathRange.h" 9 #include "GrGLPathRange.h"
10 #include "GrGLPath.h" 10 #include "GrGLPath.h"
11 #include "GrGLPathRendering.h"
11 #include "GrGpuGL.h" 12 #include "GrGpuGL.h"
12 13
13 #define GPUGL static_cast<GrGpuGL*>(this->getGpu()) 14 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& strok e)
14
15 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
16 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(GPUGL->glInterface(), R, X)
17
18 GrGLPathRange::GrGLPathRange(GrGpu* gpu, size_t size, const SkStrokeRec& stroke)
19 : INHERITED(gpu, size, stroke), 15 : INHERITED(gpu, size, stroke),
16 fBasePathID(gpu->pathRendering()->genPaths(fSize)),
20 fNumDefinedPaths(0) { 17 fNumDefinedPaths(0) {
21 GL_CALL_RET(fBasePathID, GenPaths(fSize));
22 } 18 }
23 19
24 GrGLPathRange::~GrGLPathRange() { 20 GrGLPathRange::~GrGLPathRange() {
25 this->release(); 21 this->release();
26 } 22 }
27 23
28 void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { 24 void GrGLPathRange::initAt(size_t index, const SkPath& skPath) {
29 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu()); 25 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu());
30 if (NULL == gpu) { 26 if (NULL == gpu) {
31 return; 27 return;
32 } 28 }
33 29
34 #ifdef SK_DEBUG
35 // Make sure the path at this index hasn't been initted already. 30 // Make sure the path at this index hasn't been initted already.
36 GrGLboolean hasPathAtIndex; 31 SkASSERT(GR_GL_FALSE == gpu->pathRendering()->isPath(fBasePathID + index));
37 GL_CALL_RET(hasPathAtIndex, IsPath(fBasePathID + index));
38 SkASSERT(GR_GL_FALSE == hasPathAtIndex);
39 #endif
40 32
41 GrGLPath::InitPathObject(gpu->glInterface(), fBasePathID + index, skPath, fS troke); 33 GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke);
42
43 ++fNumDefinedPaths; 34 ++fNumDefinedPaths;
44 this->didChangeGpuMemorySize(); 35 this->didChangeGpuMemorySize();
45 } 36 }
46 37
47 void GrGLPathRange::onRelease() { 38 void GrGLPathRange::onRelease() {
48 SkASSERT(NULL != this->getGpu()); 39 SkASSERT(NULL != this->getGpu());
49 40
50 if (0 != fBasePathID && !this->isWrapped()) { 41 if (0 != fBasePathID && !this->isWrapped()) {
51 GL_CALL(DeletePaths(fBasePathID, fSize)); 42 static_cast<GrGpuGL*>(this->getGpu())->pathRendering()->deletePaths(fBas ePathID, fSize);
52 fBasePathID = 0; 43 fBasePathID = 0;
53 } 44 }
54 45
55 INHERITED::onRelease(); 46 INHERITED::onRelease();
56 } 47 }
57 48
58 void GrGLPathRange::onAbandon() { 49 void GrGLPathRange::onAbandon() {
59 fBasePathID = 0; 50 fBasePathID = 0;
60 51
61 INHERITED::onAbandon(); 52 INHERITED::onAbandon();
62 } 53 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRange.h ('k') | src/gpu/gl/GrGLPathRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698