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

Side by Side Diff: src/gpu/GrAtlas.h

Issue 21594005: GPU Font Cache improvements: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove some added spaces Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/GrAtlas.cpp » ('j') | src/gpu/GrTextStrike.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 9
10 10
11 #ifndef GrAtlas_DEFINED 11 #ifndef GrAtlas_DEFINED
12 #define GrAtlas_DEFINED 12 #define GrAtlas_DEFINED
13 13
14 #include "GrPoint.h" 14 #include "GrPoint.h"
15 #include "GrTexture.h" 15 #include "GrTexture.h"
16 16
17 class GrGpu; 17 class GrGpu;
18 class GrRectanizer; 18 class GrRectanizer;
19 class GrAtlasMgr; 19 class GrAtlasMgr;
20 20
21 class GrAtlas { 21 class GrAtlas {
22 public: 22 public:
23 GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat);
24
25 int getPlotX() const { return fPlot.fX; } 23 int getPlotX() const { return fPlot.fX; }
26 int getPlotY() const { return fPlot.fY; } 24 int getPlotY() const { return fPlot.fY; }
27 GrMaskFormat getMaskFormat() const { return fMaskFormat; } 25 GrMaskFormat getMaskFormat() const { return fMaskFormat; }
28 26
29 GrTexture* texture() const { return fTexture; } 27 GrTexture* texture() const { return fTexture; }
30 28
31 bool addSubImage(int width, int height, const void*, GrIPoint16*); 29 bool addSubImage(int width, int height, const void*, GrIPoint16*);
32 30
33 static void FreeLList(GrAtlas* atlas) { 31 static void FreeLList(GrAtlas* atlas) {
34 while (atlas) { 32 while (atlas) {
35 GrAtlas* next = atlas->fNext; 33 GrAtlas* next = atlas->fNext;
36 delete atlas; 34 delete atlas;
37 atlas = next; 35 atlas = next;
38 } 36 }
39 } 37 }
40 38
41 // testing 39 // testing
42 GrAtlas* nextAtlas() const { return fNext; } 40 GrAtlas* nextAtlas() const { return fNext; }
41
robertphillips 2013/08/02 15:23:50 Does this need to be out here with the availabilit
bsalomon 2013/08/02 15:30:35 I'd feel better if this and fUsed were private, ev
jvanverth1 2013/08/02 21:49:27 Done.
42 GrAtlas* fNext;
43
44 // for recycling
45 bool fUsed;
43 46
44 private: 47 private:
48 GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat format);
45 ~GrAtlas(); // does not try to delete the fNext field 49 ~GrAtlas(); // does not try to delete the fNext field
46 50
47 GrAtlas* fNext;
48 GrTexture* fTexture; 51 GrTexture* fTexture;
49 GrRectanizer* fRects; 52 GrRectanizer* fRects;
50 GrAtlasMgr* fAtlasMgr; 53 GrAtlasMgr* fAtlasMgr;
51 GrIPoint16 fPlot; 54 GrIPoint16 fPlot;
52 GrMaskFormat fMaskFormat; 55 GrMaskFormat fMaskFormat;
53 56
54 friend class GrAtlasMgr; 57 friend class GrAtlasMgr;
55 }; 58 };
56 59
57 class GrPlotMgr; 60 class GrPlotMgr;
58 61
59 class GrAtlasMgr { 62 class GrAtlasMgr {
60 public: 63 public:
61 GrAtlasMgr(GrGpu*); 64 GrAtlasMgr(GrGpu*);
62 ~GrAtlasMgr(); 65 ~GrAtlasMgr();
63 66
64 GrAtlas* addToAtlas(GrAtlas*, int width, int height, const void*, 67 GrAtlas* addToAtlas(GrAtlas**, int width, int height, const void*,
65 GrMaskFormat, GrIPoint16*); 68 GrMaskFormat, GrIPoint16*);
69 void deleteAtlas(GrAtlas* atlas) { delete atlas; }
66 70
67 GrTexture* getTexture(GrMaskFormat format) const { 71 GrTexture* getTexture(GrMaskFormat format) const {
68 GrAssert((unsigned)format < kCount_GrMaskFormats); 72 GrAssert((unsigned)format < kCount_GrMaskFormats);
69 return fTexture[format]; 73 return fTexture[format];
70 } 74 }
71 75
72 // to be called by ~GrAtlas() 76 // to be called by ~GrAtlas()
73 void freePlot(int x, int y); 77 void freePlot(GrMaskFormat format, int x, int y);
74 78
75 private: 79 private:
76 GrGpu* fGpu; 80 GrGpu* fGpu;
77 GrTexture* fTexture[kCount_GrMaskFormats]; 81 GrTexture* fTexture[kCount_GrMaskFormats];
78 GrPlotMgr* fPlotMgr; 82 GrPlotMgr* fPlotMgr[kCount_GrMaskFormats];
79 }; 83 };
80 84
81 #endif 85 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAtlas.cpp » ('j') | src/gpu/GrTextStrike.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698