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

Unified Diff: src/gpu/GrPictureUtils.h

Issue 595543002: Update layer hoisting code to correctly render sub-picture layers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add cast Created 6 years, 3 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/GrLayerHoister.cpp ('k') | src/gpu/GrPictureUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPictureUtils.h
diff --git a/src/gpu/GrPictureUtils.h b/src/gpu/GrPictureUtils.h
index 55b294ac6985a14c00c5e59b3e6ebddd2d7f65d8..f9bab805d94344b5d362fcbead83637db7ef9157 100644
--- a/src/gpu/GrPictureUtils.h
+++ b/src/gpu/GrPictureUtils.h
@@ -9,21 +9,27 @@
#define GrPictureUtils_DEFINED
#include "SkPicture.h"
-#include "SkTDArray.h"
+#include "SkTArray.h"
// This class encapsulates the GPU-backend-specific acceleration data
// for a single SkPicture
class GrAccelData : public SkPicture::AccelData {
public:
// Information about a given saveLayer in an SkPicture
- struct SaveLayerInfo {
- // True if the SaveLayerInfo is valid. False if either 'fOffset' is
- // invalid (due to a non-invertible CTM) or 'fPaint' is NULL (due
- // to a non-copyable paint).
+ class SaveLayerInfo {
+ public:
+ SaveLayerInfo() : fPicture(NULL), fPaint(NULL) {}
+ ~SaveLayerInfo() { SkSafeUnref(fPicture); SkDELETE(fPaint); }
+
+ // True if the SaveLayerInfo is valid. False if 'fOffset' is
+ // invalid (due to a non-invertible CTM).
+ // TODO: remove fValid
bool fValid;
- // ID of the picture containing the layer. This can be the ID of
- // a sub-picture embedded within the picture owning the GrAccelData
- uint32_t fPictureID;
+ // The picture owning the layer. If the owning picture is the top-most
+ // one (i.e., the picture for which this GrAccelData was created) then
+ // this pointer is NULL. If it is a nested picture then the pointer
+ // is non-NULL and owns a ref on the picture.
+ const SkPicture* fPicture;
// The size of the saveLayer
SkISize fSize;
// The matrix state in which this layer's draws must occur. It does not
@@ -32,8 +38,7 @@ public:
// The offset that needs to be passed to drawBitmap to correctly
// position the pre-rendered layer. It is in device space.
SkIPoint fOffset;
- // The paint to use on restore. NULL if the paint was not copyable (and
- // thus that this layer should not be pulled forward).
+ // The paint to use on restore. Can be NULL since it is optional.
const SkPaint* fPaint;
// The ID of this saveLayer in the picture. 0 is an invalid ID.
size_t fSaveLayerOpID;
@@ -48,16 +53,9 @@ public:
GrAccelData(Key key) : INHERITED(key) { }
- virtual ~GrAccelData() {
- for (int i = 0; i < fSaveLayerInfo.count(); ++i) {
- SkDELETE(fSaveLayerInfo[i].fPaint);
- }
- }
+ virtual ~GrAccelData() { }
- void addSaveLayerInfo(const SaveLayerInfo& info) {
- SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID);
- *fSaveLayerInfo.push() = info;
- }
+ SaveLayerInfo& addSaveLayerInfo() { return fSaveLayerInfo.push_back(); }
int numSaveLayers() const { return fSaveLayerInfo.count(); }
@@ -72,7 +70,7 @@ public:
static SkPicture::AccelData::Key ComputeAccelDataKey();
private:
- SkTDArray<SaveLayerInfo> fSaveLayerInfo;
+ SkTArray<SaveLayerInfo, true> fSaveLayerInfo;
typedef SkPicture::AccelData INHERITED;
};
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | src/gpu/GrPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698