Fuse GrReplacements and GrLayerCache
The conversion step from GrCachedLayer to ReplacementInfo isn't necessary.
Review URL: https://codereview.chromium.org/769533004
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index c347512..fc5be5f 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -125,7 +125,7 @@
int start, int stop,
const SkIRect& bounds,
const SkMatrix& initialMat,
- const int* key,
+ const unsigned* key,
int keySize,
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
@@ -137,7 +137,7 @@
}
GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initialMat,
- const int* key, int keySize) {
+ const unsigned* key, int keySize) {
SkASSERT(pictureID != SK_InvalidGenID);
return fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySize));
}
@@ -146,7 +146,7 @@
int start, int stop,
const SkIRect& bounds,
const SkMatrix& initialMat,
- const int* key,
+ const unsigned* key,
int keySize,
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
@@ -209,9 +209,8 @@
pictInfo->incPlotUsage(plot->id());
#endif
// The layer was successfully added to the atlas
- GrIRect16 bounds = GrIRect16::MakeXYWH(loc.fX, loc.fY,
- SkToS16(desc.fWidth),
- SkToS16(desc.fHeight));
+ const SkIRect bounds = SkIRect::MakeXYWH(loc.fX, loc.fY,
+ desc.fWidth, desc.fHeight);
layer->setTexture(fAtlas->getTexture(), bounds);
layer->setPlot(plot);
layer->setLocked(true);
@@ -250,7 +249,7 @@
return false;
}
- layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.fHeight)));
+ layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight));
layer->setLocked(true);
*needsRendering = true;
return true;
@@ -289,11 +288,11 @@
}
layer->setPlot(NULL);
- layer->setTexture(NULL, GrIRect16::MakeEmpty());
+ layer->setTexture(NULL, SkIRect::MakeEmpty());
#endif
} else {
- layer->setTexture(NULL, GrIRect16::MakeEmpty());
+ layer->setTexture(NULL, SkIRect::MakeEmpty());
}
layer->setLocked(false);