From c6ad06acefa096716f8dabed5342f9b89dc43dfe Mon Sep 17 00:00:00 2001 From: mtklein Date: Wed, 19 Aug 2015 09:51:00 -0700 Subject: unsigned -> int for counts and indices in picture-related code also, (C) BUG=skia: Review URL: https://codereview.chromium.org/1300163002 --- src/gpu/GrLayerCache.h | 52 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/gpu/GrLayerCache.h') diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h index df8c670689..cf35de80b5 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(fKey), fKeySize * sizeof(int)); - return SkChecksum::Murmur3(reinterpret_cast(&fIDMatrix), + return SkChecksum::Murmur3(reinterpret_cast(&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 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' -- cgit v1.2.3