aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrLayerHoister.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrLayerHoister.cpp')
-rw-r--r--src/gpu/GrLayerHoister.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 70c10d7f69..67e3c19a2f 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -9,6 +9,7 @@
#include "GrLayerHoister.h"
#include "GrRecordReplaceDraw.h"
+#include "SkBigPicture.h"
#include "SkCanvas.h"
#include "SkDeviceImageFilterProxy.h"
#include "SkDeviceProperties.h"
@@ -21,7 +22,7 @@
// Create the layer information for the hoisted layer and secure the
// required texture/render target resources.
-static void prepare_for_hoisting(GrLayerCache* layerCache,
+static void prepare_for_hoisting(GrLayerCache* layerCache,
const SkPicture* topLevelPicture,
const SkMatrix& initialMat,
const SkLayerInfo::BlockInfo& info,
@@ -74,7 +75,7 @@ static void prepare_for_hoisting(GrLayerCache* layerCache,
} else {
hl = recycled->append();
}
-
+
layerCache->addUse(layer);
hl->fLayer = layer;
hl->fPicture = pict;
@@ -129,12 +130,12 @@ void GrLayerHoister::FindLayersToAtlas(GrContext* context,
}
GrLayerCache* layerCache = context->getLayerCache();
-
layerCache->processDeletedPictures();
- SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
-
- const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_getAccelData(key);
+ const SkBigPicture::AccelData* topLevelData = NULL;
+ if (const SkBigPicture* bp = topLevelPicture->asSkBigPicture()) {
+ topLevelData = bp->accelData();
+ }
if (!topLevelData) {
return;
}
@@ -189,9 +190,10 @@ void GrLayerHoister::FindLayersToHoist(GrContext* context,
layerCache->processDeletedPictures();
- SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
-
- const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_getAccelData(key);
+ const SkBigPicture::AccelData* topLevelData = NULL;
+ if (const SkBigPicture* bp = topLevelPicture->asSkBigPicture()) {
+ topLevelData = bp->accelData();
+ }
if (!topLevelData) {
return;
}
@@ -239,7 +241,11 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
for (int i = 0; i < atlased.count(); ++i) {
const GrCachedLayer* layer = atlased[i].fLayer;
- const SkPicture* pict = atlased[i].fPicture;
+ const SkBigPicture* pict = atlased[i].fPicture->asSkBigPicture();
+ if (!pict) {
+ // TODO: can we assume / assert this?
+ continue;
+ }
const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcIR().fTop);
SkDEBUGCODE(const SkPaint* layerPaint = layer->paint();)
@@ -265,10 +271,7 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
atlasCanvas->setMatrix(initialCTM);
atlasCanvas->concat(atlased[i].fLocalMat);
- SkRecordPartialDraw(*pict->fRecord.get(), atlasCanvas,
- pict->drawablePicts(), pict->drawableCount(),
- layer->start() + 1, layer->stop(), initialCTM);
-
+ pict->partialPlayback(atlasCanvas, layer->start() + 1, layer->stop(), initialCTM);
atlasCanvas->restore();
}
@@ -328,7 +331,11 @@ void GrLayerHoister::FilterLayer(GrContext* context,
void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLayer>& layers) {
for (int i = 0; i < layers.count(); ++i) {
GrCachedLayer* layer = layers[i].fLayer;
- const SkPicture* pict = layers[i].fPicture;
+ const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture();
+ if (!pict) {
+ // TODO: can we assume / assert this?
+ continue;
+ }
const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcIR().fTop);
// Each non-atlased layer has its own GrTexture
@@ -353,10 +360,7 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
layerCanvas->setMatrix(initialCTM);
layerCanvas->concat(layers[i].fLocalMat);
- SkRecordPartialDraw(*pict->fRecord.get(), layerCanvas,
- pict->drawablePicts(), pict->drawableCount(),
- layer->start()+1, layer->stop(), initialCTM);
-
+ pict->partialPlayback(layerCanvas, layer->start()+1, layer->stop(), initialCTM);
layerCanvas->flush();
if (layer->filter()) {