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

Side by Side Diff: src/gpu/gl/GrGLPathRange.cpp

Issue 563283004: Use per-typeface sets of glyphs for nvpr text (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_glyphmemorypath
Patch Set: Fix builds Created 6 years, 3 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 "GrGLPathRendering.h"
12 #include "GrGpuGL.h" 12 #include "GrGpuGL.h"
13 13
14 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& strok e) 14 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, PathGenerator* pathGenerator, const S kStrokeRec& stroke)
15 : INHERITED(gpu, size, stroke), 15 : INHERITED(gpu, pathGenerator, stroke),
16 fBasePathID(gpu->glPathRendering()->genPaths(fSize)), 16 fBasePathID(gpu->glPathRendering()->genPaths(this->getNumPaths())),
17 fNumDefinedPaths(0) { 17 fGpuMemorySize(0) {
18 this->registerWithCache();
19 }
20
21 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu,
22 GrGLuint basePathID,
23 int numPaths,
24 size_t gpuMemorySize,
25 const SkStrokeRec& stroke)
26 : INHERITED(gpu, numPaths, stroke),
27 fBasePathID(basePathID),
28 fGpuMemorySize(gpuMemorySize) {
29 this->registerWithCache();
18 } 30 }
19 31
20 GrGLPathRange::~GrGLPathRange() { 32 GrGLPathRange::~GrGLPathRange() {
21 this->release(); 33 this->release();
22 } 34 }
23 35
24 void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { 36 void GrGLPathRange::onInitPath(int index, const SkPath& skPath) const {
25 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu()); 37 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu());
26 if (NULL == gpu) { 38 if (NULL == gpu) {
27 return; 39 return;
28 } 40 }
29 41
30 // Make sure the path at this index hasn't been initted already. 42 // Make sure the path at this index hasn't been initted already.
31 SkDEBUGCODE( 43 SkDEBUGCODE(
32 GrGLboolean isPath; 44 GrGLboolean isPath;
33 GR_GL_CALL_RET(gpu->glInterface(), isPath, IsPath(fBasePathID + index))) ; 45 GR_GL_CALL_RET(gpu->glInterface(), isPath, IsPath(fBasePathID + index))) ;
34 SkASSERT(GR_GL_FALSE == isPath); 46 SkASSERT(GR_GL_FALSE == isPath);
35 47
36 GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke); 48 GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, this->getStroke() );
37 ++fNumDefinedPaths; 49
38 this->didChangeGpuMemorySize(); 50 // TODO: Use a better approximation for the individual path sizes.
51 fGpuMemorySize += 100;
39 } 52 }
40 53
41 void GrGLPathRange::onRelease() { 54 void GrGLPathRange::onRelease() {
42 SkASSERT(this->getGpu()); 55 SkASSERT(this->getGpu());
43 56
44 if (0 != fBasePathID && !this->isWrapped()) { 57 if (0 != fBasePathID && !this->isWrapped()) {
45 static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fB asePathID, fSize); 58 static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fB asePathID,
59 th is->getNumPaths());
46 fBasePathID = 0; 60 fBasePathID = 0;
47 } 61 }
48 62
49 INHERITED::onRelease(); 63 INHERITED::onRelease();
50 } 64 }
51 65
52 void GrGLPathRange::onAbandon() { 66 void GrGLPathRange::onAbandon() {
53 fBasePathID = 0; 67 fBasePathID = 0;
54 68
55 INHERITED::onAbandon(); 69 INHERITED::onAbandon();
56 } 70 }
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