Update layer-pre-rendering for Chrome flag

As currently plumbed into Chromium, EXPERIMENTAL_optimize can be called multiple times per picture. Additionally, Chromium generates a lot of pictures with no layers at all.

R=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/283703007

git-svn-id: http://skia.googlecode.com/svn/trunk@14721 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-14 13:11:48 +00:00
parent 9f3b925e76
commit 8ec8bab778

View File

@ -1942,6 +1942,11 @@ SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(key);
if (NULL != existing) {
return;
}
SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key)));
picture->EXPERIMENTAL_addAccelData(data);
@ -1970,6 +1975,10 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture)
const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
if (0 == gpuData->numSaveLayers()) {
return false;
}
SkAutoTArray<bool> pullForward(gpuData->numSaveLayers());
for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
pullForward[i] = false;