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

Side by Side Diff: src/gpu/GrLayerCache.cpp

Issue 1300163002: unsigned -> int for counts and indices in picture-related code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 5 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/GrLayerCache.h ('k') | src/gpu/GrRecordReplaceDraw.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 2014 Google Inc. 2 * Copyright 2014 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 #include "GrAtlas.h" 8 #include "GrAtlas.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // The atlas only lets go of its texture when the atlas is deleted. 122 // The atlas only lets go of its texture when the atlas is deleted.
123 fAtlas.free(); 123 fAtlas.free();
124 } 124 }
125 125
126 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, 126 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID,
127 int start, int stop, 127 int start, int stop,
128 const SkIRect& srcIR, 128 const SkIRect& srcIR,
129 const SkIRect& dstIR, 129 const SkIRect& dstIR,
130 const SkMatrix& initialMat, 130 const SkMatrix& initialMat,
131 const unsigned* key, 131 const int* key,
132 int keySize, 132 int keySize,
133 const SkPaint* paint) { 133 const SkPaint* paint) {
134 SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0); 134 SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
135 135
136 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, 136 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop,
137 srcIR, dstIR, initialMat, 137 srcIR, dstIR, initialMat,
138 key, keySize, paint)); 138 key, keySize, paint));
139 fLayerHash.add(layer); 139 fLayerHash.add(layer);
140 return layer; 140 return layer;
141 } 141 }
142 142
143 GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initi alMat, 143 GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initi alMat,
144 const unsigned* key, int keySize) { 144 const int* key, int keySize) {
145 SkASSERT(pictureID != SK_InvalidGenID); 145 SkASSERT(pictureID != SK_InvalidGenID);
146 return fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySiz e)); 146 return fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySiz e));
147 } 147 }
148 148
149 GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID, 149 GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID,
150 int start, int stop, 150 int start, int stop,
151 const SkIRect& srcIR, 151 const SkIRect& srcIR,
152 const SkIRect& dstIR, 152 const SkIRect& dstIR,
153 const SkMatrix& initialMat, 153 const SkMatrix& initialMat,
154 const unsigned* key, 154 const int* key,
155 int keySize, 155 int keySize,
156 const SkPaint* paint) { 156 const SkPaint* paint) {
157 SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0); 157 SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
158 GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, initial Mat, key, keySize)); 158 GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, initial Mat, key, keySize));
159 if (NULL == layer) { 159 if (NULL == layer) {
160 layer = this->createLayer(pictureID, start, stop, 160 layer = this->createLayer(pictureID, start, stop,
161 srcIR, dstIR, initialMat, 161 srcIR, dstIR, initialMat,
162 key, keySize, paint); 162 key, keySize, paint);
163 } 163 }
164 164
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 GrPlot* plot = fAtlas->addToAtlas(&pictInfo->fPlotUsage, 209 GrPlot* plot = fAtlas->addToAtlas(&pictInfo->fPlotUsage,
210 desc.fWidth, desc.fHeight, 210 desc.fWidth, desc.fHeight,
211 NULL, &loc); 211 NULL, &loc);
212 // addToAtlas can allocate the backing texture 212 // addToAtlas can allocate the backing texture
213 SkDEBUGCODE(avl.setBackingTexture(fAtlas->getTexture())); 213 SkDEBUGCODE(avl.setBackingTexture(fAtlas->getTexture()));
214 if (plot) { 214 if (plot) {
215 #if !GR_CACHE_HOISTED_LAYERS 215 #if !GR_CACHE_HOISTED_LAYERS
216 pictInfo->incPlotUsage(plot->id()); 216 pictInfo->incPlotUsage(plot->id());
217 #endif 217 #endif
218 // The layer was successfully added to the atlas 218 // The layer was successfully added to the atlas
219 const SkIRect bounds = SkIRect::MakeXYWH(loc.fX, loc.fY, 219 const SkIRect bounds = SkIRect::MakeXYWH(loc.fX, loc.fY,
220 desc.fWidth, desc.fHeig ht); 220 desc.fWidth, desc.fHeig ht);
221 layer->setTexture(fAtlas->getTexture(), bounds); 221 layer->setTexture(fAtlas->getTexture(), bounds);
222 layer->setPlot(plot); 222 layer->setPlot(plot);
223 layer->setLocked(true); 223 layer->setLocked(true);
224 this->incPlotLock(layer->plot()->id()); 224 this->incPlotLock(layer->plot()->id());
225 *needsRendering = true; 225 *needsRendering = true;
226 return true; 226 return true;
227 } 227 }
228 228
229 // The layer was rejected by the atlas (even though we know it is 229 // The layer was rejected by the atlas (even though we know it is
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 fileName.appendf("\\%d", layer->fKey.pictureID()); 510 fileName.appendf("\\%d", layer->fKey.pictureID());
511 for (int i = 0; i < layer->fKey.keySize(); ++i) { 511 for (int i = 0; i < layer->fKey.keySize(); ++i) {
512 fileName.appendf("-%d", layer->fKey.key()[i]); 512 fileName.appendf("-%d", layer->fKey.key()[i]);
513 } 513 }
514 fileName.appendf(".png"); 514 fileName.appendf(".png");
515 515
516 layer->texture()->surfacePriv().savePixels(fileName.c_str()); 516 layer->texture()->surfacePriv().savePixels(fileName.c_str());
517 } 517 }
518 } 518 }
519 #endif 519 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | src/gpu/GrRecordReplaceDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698