aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-07-07 13:46:35 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-07 13:46:35 -0700
commitce4dd3de38cd7c29bf5b9d8a8efb55c08ec9be47 (patch)
tree93e49c2020bb0a75e8acc3d09b8266962a171c14 /src/gpu/SkGpuDevice.cpp
parent5e8a3c1b83b8e6f41452298a1da5343b471759fd (diff)
Split SkPicturePlayback out of SkPictureData
This splits the playback functionality out of SkPictureData. The old SkPictureData::draw method is pulled out along with its supporting functions as verbatim as possible. Some follow on CLs will be required to: re-enable profiling in the debugger (and remove the vestiges of SkTimedPicture) re-enable display of command offsets in the picture (this should probably wait until we've switched to SkRecord though) Clean up CachedOperationList (maybe fuse with SkPicture::OperationList) Split SkPicturePlayback into a base class and two derived classes Implement parallel version of GatherGPUInfo for SkRecord Landing this is blocked on removing Android's use of the abortPlayback entry point. R=mtklein@google.com, reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/377623002
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9041bdfba2..cf152fa6e5 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -30,6 +30,7 @@
#include "SkPathEffect.h"
#include "SkPicture.h"
#include "SkPictureData.h"
+#include "SkPicturePlayback.h"
#include "SkRRect.h"
#include "SkStroke.h"
#include "SkSurface.h"
@@ -1859,7 +1860,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
SkIRect query;
clipBounds.roundOut(&query);
- const SkPicture::OperationList& ops = picture->EXPERIMENTAL_getActiveOps(query);
+ SkAutoTDelete<const SkPicture::OperationList> ops(picture->EXPERIMENTAL_getActiveOps(query));
// This code pre-renders the entire layer since it will be cached and potentially
// reused with different clips (e.g., in different tiles). Because of this the
@@ -1867,12 +1868,12 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
// is used to limit which clips are pre-rendered.
static const int kSaveLayerMaxSize = 256;
- if (ops.valid()) {
+ if (NULL != ops.get()) {
// In this case the picture has been generated with a BBH so we use
// the BBH to limit the pre-rendering to just the layers needed to cover
// the region being drawn
- for (int i = 0; i < ops.numOps(); ++i) {
- uint32_t offset = ops.offset(i);
+ for (int i = 0; i < ops->numOps(); ++i) {
+ uint32_t offset = ops->offset(i);
// For now we're saving all the layers in the GPUAccelData so they
// can be nested. Additionally, the nested layers appear before
@@ -1928,7 +1929,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
}
}
- SkPictureData::PlaybackReplacements replacements;
+ SkPicturePlayback::PlaybackReplacements replacements;
// Generate the layer and/or ensure it is locked
for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
@@ -1937,7 +1938,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
- SkPictureData::PlaybackReplacements::ReplacementInfo* layerInfo =
+ SkPicturePlayback::PlaybackReplacements::ReplacementInfo* layerInfo =
replacements.push();
layerInfo->fStart = info.fSaveLayerOpID;
layerInfo->fStop = info.fRestoreOpID;
@@ -2009,9 +2010,9 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
SkIntToScalar(layer->rect().fTop));
}
- picture->fData->setDrawLimits(info.fSaveLayerOpID, info.fRestoreOpID);
- picture->fData->draw(*canvas, NULL);
- picture->fData->setDrawLimits(0, 0);
+ SkPicturePlayback playback(picture);
+ playback.setDrawLimits(info.fSaveLayerOpID, info.fRestoreOpID);
+ playback.draw(canvas, NULL);
canvas->flush();
}
@@ -2019,9 +2020,10 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi
}
// Playback using new layers
- picture->fData->setReplacements(&replacements);
- picture->fData->draw(*canvas, NULL);
- picture->fData->setReplacements(NULL);
+ SkPicturePlayback playback(picture);
+
+ playback.setReplacements(&replacements);
+ playback.draw(canvas, NULL);
// unlock the layers
for (int i = 0; i < gpuData->numSaveLayers(); ++i) {