Revert r14571 (Infrastructure changes to support pull saveLayers forward task - https://codereview.chromium.org/266203003) due to breaking Android unit tests
git-svn-id: http://skia.googlecode.com/svn/trunk@14578 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 3119a9e..714a6da 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1910,8 +1910,16 @@
return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples());
}
+// In the future this may not be a static method if we need to incorporate the
+// clip and matrix state into the key
+SkPicture::AccelData::Key SkGpuDevice::ComputeAccelDataKey() {
+ static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::GenerateDomain();
+
+ return gGPUID;
+}
+
void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
- SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
+ SkPicture::AccelData::Key key = ComputeAccelDataKey();
GPUAccelData* data = SkNEW_ARGS(GPUAccelData, (key));
@@ -1926,7 +1934,7 @@
bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) {
- SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
+ SkPicture::AccelData::Key key = ComputeAccelDataKey();
const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
if (NULL == data) {
@@ -1935,6 +1943,27 @@
const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
+//#define SK_PRINT_PULL_FORWARD_INFO 1
+
+#ifdef SK_PRINT_PULL_FORWARD_INFO
+ static bool gPrintedAccelData = false;
+
+ if (!gPrintedAccelData) {
+ for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
+ const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
+
+ SkDebugf("%d: Width: %d Height: %d SL: %d R: %d hasNestedLayers: %s\n",
+ i,
+ info.fSize.fWidth,
+ info.fSize.fHeight,
+ info.fSaveLayerOpID,
+ info.fRestoreOpID,
+ info.fHasNestedLayers ? "T" : "F");
+ }
+ gPrintedAccelData = true;
+ }
+#endif
+
SkAutoTArray<bool> pullForward(gpuData->numSaveLayers());
for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
pullForward[i] = false;
@@ -1955,6 +1984,10 @@
const SkPicture::OperationList& ops = picture->EXPERIMENTAL_getActiveOps(clip);
+#ifdef SK_PRINT_PULL_FORWARD_INFO
+ SkDebugf("rect: %d %d %d %d\n", clip.fLeft, clip.fTop, clip.fRight, clip.fBottom);
+#endif
+
for (int i = 0; i < ops.numOps(); ++i) {
for (int j = 0; j < gpuData->numSaveLayers(); ++j) {
const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j);
@@ -1965,5 +1998,17 @@
}
}
+#ifdef SK_PRINT_PULL_FORWARD_INFO
+ SkDebugf("Need SaveLayers: ");
+ for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
+ if (pullForward[i]) {
+ const GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(picture, i);
+
+ SkDebugf("%d (%d), ", i, layer->layerID());
+ }
+ }
+ SkDebugf("\n");
+#endif
+
return false;
}