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

Unified Diff: src/gpu/GrLayerCache.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerCache.h
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index df8c670689bb2258b66be6bbf20747b80654cabb..cf35de80b5c283f8454a90f74a346ae7d4956c3e 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -31,9 +31,9 @@ public:
static uint32_t Hash(const uint32_t& key) { return SkChecksum::Mix(key); }
// GrPictureInfo proper
- GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) {
+ GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) {
#if !GR_CACHE_HOISTED_LAYERS
- memset(fPlotUses, 0, sizeof(fPlotUses));
+ memset(fPlotUses, 0, sizeof(fPlotUses));
#endif
}
@@ -49,7 +49,7 @@ public:
fPlotUses[plotID]--;
}
- int plotUsage(int plotID) const {
+ int plotUsage(int plotID) const {
SkASSERT(plotID < kNumPlots);
return fPlotUses[plotID];
}
@@ -67,7 +67,7 @@ private:
// GrCachedLayer encapsulates the caching information for a single saveLayer.
//
// Atlased layers get a ref to the backing GrTexture while non-atlased layers
-// get a ref to the GrTexture in which they reside. In both cases 'fRect'
+// get a ref to the GrTexture in which they reside. In both cases 'fRect'
// contains the layer's extent in its texture.
// Atlased layers also get a pointer to the plot in which they reside.
// For non-atlased layers, the lock field just corresponds to locking in
@@ -77,17 +77,17 @@ struct GrCachedLayer {
public:
// For SkTDynamicHash
struct Key {
- Key(uint32_t pictureID, const SkMatrix& initialMat,
- const unsigned* key, int keySize, bool copyKey = false)
- : fKeySize(keySize)
+ Key(uint32_t pictureID, const SkMatrix& initialMat,
+ const int* key, int keySize, bool copyKey = false)
+ : fKeySize(keySize)
, fFreeKey(copyKey) {
fIDMatrix.fPictureID = pictureID;
fIDMatrix.fInitialMat = initialMat;
fIDMatrix.fInitialMat.getType(); // force initialization of type so hashes match
if (copyKey) {
- unsigned* tempKey = SkNEW_ARRAY(unsigned, keySize);
- memcpy(tempKey, key, keySize*sizeof(unsigned));
+ int* tempKey = SkNEW_ARRAY(int, keySize);
+ memcpy(tempKey, key, keySize*sizeof(int));
fKey = tempKey;
} else {
fKey = key;
@@ -116,13 +116,13 @@ public:
uint32_t pictureID() const { return fIDMatrix.fPictureID; }
// TODO: remove these when GrCachedLayer & ReplacementInfo fuse
- const unsigned* key() const { SkASSERT(fFreeKey); return fKey; }
+ const int* key() const { SkASSERT(fFreeKey); return fKey; }
int keySize() const { SkASSERT(fFreeKey); return fKeySize; }
uint32_t hash() const {
uint32_t hash = SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(fKey),
fKeySize * sizeof(int));
- return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&fIDMatrix),
+ return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&fIDMatrix),
sizeof(IDMatrix), hash);
}
@@ -134,19 +134,19 @@ public:
SkMatrix fInitialMat;
} fIDMatrix;
- const unsigned* fKey;
- const int fKeySize;
- bool fFreeKey;
+ const int* fKey;
+ const int fKeySize;
+ bool fFreeKey;
};
static const Key& GetKey(const GrCachedLayer& layer) { return layer.fKey; }
static uint32_t Hash(const Key& key) { return key.hash(); }
// GrCachedLayer proper
- GrCachedLayer(uint32_t pictureID, unsigned start, unsigned stop,
+ GrCachedLayer(uint32_t pictureID, int start, int stop,
const SkIRect& srcIR, const SkIRect& dstIR,
const SkMatrix& ctm,
- const unsigned* key, int keySize,
+ const int* key, int keySize,
const SkPaint* paint)
: fKey(pictureID, ctm, key, keySize, true)
, fStart(start)
@@ -179,14 +179,14 @@ public:
uint32_t pictureID() const { return fKey.pictureID(); }
// TODO: remove these when GrCachedLayer & ReplacementInfo fuse
- const unsigned* key() const { return fKey.key(); }
+ const int* key() const { return fKey.key(); }
int keySize() const { return fKey.keySize(); }
- unsigned start() const { return fStart; }
+ int start() const { return fStart; }
// TODO: make bound debug only
const SkIRect& srcIR() const { return fSrcIR; }
const SkIRect& dstIR() const { return fDstIR; }
- unsigned stop() const { return fStop; }
+ int stop() const { return fStop; }
void setTexture(GrTexture* texture, const SkIRect& rect) {
SkRefCnt_SafeAssign(fTexture, texture);
fRect = rect;
@@ -220,9 +220,9 @@ private:
const Key fKey;
// The "saveLayer" operation index of the cached layer
- const unsigned fStart;
+ const int fStart;
// The final "restore" operation index of the cached layer
- const unsigned fStop;
+ const int fStop;
// The layer's src rect (i.e., the portion of the source scene required
// for filtering).
@@ -291,13 +291,13 @@ public:
void freeAll();
GrCachedLayer* findLayer(uint32_t pictureID, const SkMatrix& ctm,
- const unsigned* key, int keySize);
+ const int* key, int keySize);
GrCachedLayer* findLayerOrCreate(uint32_t pictureID,
- int start, int stop,
+ int start, int stop,
const SkIRect& srcIR,
const SkIRect& dstIR,
const SkMatrix& initialMat,
- const unsigned* key, int keySize,
+ const int* key, int keySize,
const SkPaint* paint);
// Attempt to place 'layer' in the atlas. Return true on success; false on failure.
@@ -357,7 +357,7 @@ private:
// We cache this information here (rather then, say, on the owning picture)
// because we want to be able to clean it up as needed (e.g., if a picture
- // is leaked and never cleans itself up we still want to be able to
+ // is leaked and never cleans itself up we still want to be able to
// remove the GrPictureInfo once its layers are purged from all the atlas
// plots).
SkTDynamicHash<GrPictureInfo, uint32_t> fPictureHash;
@@ -381,7 +381,7 @@ private:
GrCachedLayer* createLayer(uint32_t pictureID, int start, int stop,
const SkIRect& srcIR, const SkIRect& dstIR,
const SkMatrix& initialMat,
- const unsigned* key, int keySize,
+ const int* key, int keySize,
const SkPaint* paint);
// Remove all the layers (and unlock any resources) associated with 'pictureID'
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698