aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrLayerCache.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-09-29 11:39:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-29 11:39:38 -0700
commited42059d2f97d4f8d247af3cbf5dc290c32785eb (patch)
treee30c2284346b6c9f4d7cc4411d85bacd94f16a1d /src/gpu/GrLayerCache.cpp
parent92f7fc4868cb02d364c1c1ea990ea81a2aab46b9 (diff)
Move offset and CTM from LayerCache Key to per-hoisted-layer info
This CL reduces the amount of information used in the layer cache key: - the stop value isn't needed since the start value uniquely identifies the layer in the picture. - only the upper-left 2x2 portion of the CTM should be used as a key for looking up cached layers. - individual layers can be redraw in different locations so the final offset cannot be a part of the key. Since this data is no longer stored in the cached layer, but is still required to draw the cached layer, it is now stored in the per-layer information (i.e., HoistedLayer). This is split out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/). BUG=skia:2315 R=egdaniel@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/609403003
Diffstat (limited to 'src/gpu/GrLayerCache.cpp')
-rw-r--r--src/gpu/GrLayerCache.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 11a97e4c66..6ec07580c8 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -14,7 +14,7 @@ DECLARE_SKMESSAGEBUS_MESSAGE(GrPictureDeletedMessage);
#ifdef SK_DEBUG
void GrCachedLayer::validate(const GrTexture* backingTexture) const {
SkASSERT(SK_InvalidGenID != fKey.pictureID());
- SkASSERT(fKey.start() > 0 && fKey.stop() > 0);
+ SkASSERT(fKey.start() > 0);
if (fTexture) {
@@ -119,33 +119,30 @@ void GrLayerCache::freeAll() {
GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID,
int start, int stop,
- const SkIPoint& offset,
const SkMatrix& ctm,
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
- GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, offset, ctm, paint));
+ GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, ctm, paint));
fLayerHash.add(layer);
return layer;
}
GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID,
- int start, int stop,
- const SkIPoint& offset,
+ int start,
const SkMatrix& ctm) {
- SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
- return fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ctm));
+ SkASSERT(pictureID != SK_InvalidGenID && start > 0);
+ return fLayerHash.find(GrCachedLayer::Key(pictureID, start, ctm));
}
GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID,
int start, int stop,
- const SkIPoint& offset,
const SkMatrix& ctm,
const SkPaint* paint) {
SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
- GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ctm));
+ GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, start, ctm));
if (NULL == layer) {
- layer = this->createLayer(pictureID, start, stop, offset, ctm, paint);
+ layer = this->createLayer(pictureID, start, stop, ctm, paint);
}
return layer;