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

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

Issue 1413403009: Clean up GrBatchAtlas a bit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bpp size Created 5 years, 1 month 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 | « no previous file | src/gpu/GrBatchAtlas.cpp » ('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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrBatchAtlas_DEFINED 8 #ifndef GrBatchAtlas_DEFINED
9 #define GrBatchAtlas_DEFINED 9 #define GrBatchAtlas_DEFINED
10 10
11 #include "GrTexture.h" 11 #include "GrTexture.h"
12 #include "batches/GrDrawBatch.h" 12 #include "batches/GrDrawBatch.h"
13 #include "SkPoint.h" 13 #include "SkPoint.h"
14 #include "SkTDArray.h" 14 #include "SkTDArray.h"
15 #include "SkTInternalLList.h" 15 #include "SkTInternalLList.h"
16 16
17 class BatchPlot; 17 class BatchPlot;
18 class GrRectanizer; 18 class GrRectanizer;
19 19
20 typedef SkTInternalLList<BatchPlot> GrBatchPlotList;
21
22 struct GrBatchAtlasConfig { 20 struct GrBatchAtlasConfig {
23 int numPlotsX() const { return fWidth / fPlotWidth; } 21 int numPlotsX() const { return fWidth / fPlotWidth; }
24 int numPlotsY() const { return fHeight / fPlotWidth; } 22 int numPlotsY() const { return fHeight / fPlotWidth; }
25 int fWidth; 23 int fWidth;
26 int fHeight; 24 int fHeight;
27 int fPlotWidth; 25 int fPlotWidth;
28 int fPlotHeight; 26 int fPlotHeight;
29 }; 27 };
30 28
31 class GrBatchAtlas { 29 class GrBatchAtlas {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }; 111 };
114 112
115 void setLastUseTokenBulk(const BulkUseTokenUpdater& reffer, GrBatchToken); 113 void setLastUseTokenBulk(const BulkUseTokenUpdater& reffer, GrBatchToken);
116 114
117 static const int kGlyphMaxDim = 256; 115 static const int kGlyphMaxDim = 256;
118 static bool GlyphTooLargeForAtlas(int width, int height) { 116 static bool GlyphTooLargeForAtlas(int width, int height) {
119 return width > kGlyphMaxDim || height > kGlyphMaxDim; 117 return width > kGlyphMaxDim || height > kGlyphMaxDim;
120 } 118 }
121 119
122 private: 120 private:
121 typedef SkTInternalLList<BatchPlot> GrBatchPlotList;
122
123 static uint32_t GetIndexFromID(AtlasID id) { 123 static uint32_t GetIndexFromID(AtlasID id) {
124 return id & 0xffff; 124 return id & 0xffff;
125 } 125 }
126 126
127 // top 48 bits are reserved for the generation ID 127 // top 48 bits are reserved for the generation ID
128 static uint64_t GetGenerationFromID(AtlasID id) { 128 static uint64_t GetGenerationFromID(AtlasID id) {
129 return (id >> 16) & 0xffffffffffff; 129 return (id >> 16) & 0xffffffffffff;
130 } 130 }
131 131
132 inline void updatePlot(GrDrawBatch::Target*, AtlasID*, BatchPlot*); 132 inline void updatePlot(GrDrawBatch::Target*, AtlasID*, BatchPlot*);
133 133
134 inline void makeMRU(BatchPlot* plot); 134 inline void makeMRU(BatchPlot* plot);
135 135
136 inline void processEviction(AtlasID); 136 inline void processEviction(AtlasID);
137 137
138 GrTexture* fTexture; 138 GrTexture* fTexture;
139 uint32_t fNumPlotsX; 139 SkDEBUGCODE(uint32_t fNumPlots;)
140 uint32_t fNumPlotsY; 140
141 uint32_t fPlotWidth;
142 uint32_t fPlotHeight;
143 size_t fBPP;
144 uint64_t fAtlasGeneration; 141 uint64_t fAtlasGeneration;
145 142
146 struct EvictionData { 143 struct EvictionData {
147 EvictionFunc fFunc; 144 EvictionFunc fFunc;
148 void* fData; 145 void* fData;
149 }; 146 };
150 147
151 SkTDArray<EvictionData> fEvictionCallbacks; 148 SkTDArray<EvictionData> fEvictionCallbacks;
152 // allocated array of GrBatchPlots 149 // allocated array of GrBatchPlots
153 SkAutoTUnref<BatchPlot>* fPlotArray; 150 SkAutoTUnref<BatchPlot>* fPlotArray;
154 // LRU list of GrPlots (MRU at head - LRU at tail) 151 // LRU list of GrPlots (MRU at head - LRU at tail)
155 GrBatchPlotList fPlotList; 152 GrBatchPlotList fPlotList;
156 }; 153 };
157 154
158 #endif 155 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrBatchAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698