Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 377623002: Split SkPicturePlayback out of SkPictureData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add virtual dtor for SkPicturePlayback Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPictureUtils.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9041bdfba25b1ec3859e3c0b0095a17139ef01d7..cf152fa6e51b023027c697250b06fd1fb05725dd 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) {
« no previous file with comments | « src/gpu/GrPictureUtils.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698