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

Side by Side Diff: src/gpu/GrPictureUtils.h

Issue 266203003: Infrastructure changes to support pull saveLayers forward task (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fixed Android error Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/gpu/GrPictureUtils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrPictureUtils_DEFINED 8 #ifndef GrPictureUtils_DEFINED
9 #define GrPictureUtils_DEFINED 9 #define GrPictureUtils_DEFINED
10 10
11 #include "SkPicture.h" 11 #include "SkPicture.h"
12 #include "SkTDArray.h" 12 #include "SkTDArray.h"
13 13
14 // This class encapsulates the GPU-backend-specific acceleration data 14 // This class encapsulates the GPU-backend-specific acceleration data
15 // for a single SkPicture 15 // for a single SkPicture
16 class GPUAccelData : public SkPicture::AccelData { 16 class GPUAccelData : public SkPicture::AccelData {
17 public: 17 public:
18 // Information about a given saveLayer in an SkPicture 18 // Information about a given saveLayer in an SkPicture
19 struct SaveLayerInfo { 19 struct SaveLayerInfo {
20 // True if the SaveLayerInfo is valid. False if either 'fOffset' is
21 // invalid (due to a non-invertible CTM) or 'fPaint' is NULL (due
22 // to a non-copyable paint).
23 bool fValid;
20 // The size of the saveLayer 24 // The size of the saveLayer
21 SkISize fSize; 25 SkISize fSize;
26 // The CTM in which this layer's draws must occur. It already incorporat es
27 // the translation needed to map the layer's top-left point to the origi n.
28 SkMatrix fCTM;
29 // The offset that needs to be passed to drawBitmap to correctly
30 // position the pre-rendered layer.
31 SkPoint fOffset;
32 // The paint to use on restore. NULL if the paint was not copyable (and
33 // thus that this layer should not be pulled forward).
34 const SkPaint* fPaint;
22 // The ID of this saveLayer in the picture. 0 is an invalid ID. 35 // The ID of this saveLayer in the picture. 0 is an invalid ID.
23 size_t fSaveLayerOpID; 36 size_t fSaveLayerOpID;
24 // The ID of the matching restore in the picture. 0 is an invalid ID. 37 // The ID of the matching restore in the picture. 0 is an invalid ID.
25 size_t fRestoreOpID; 38 size_t fRestoreOpID;
26 // True if this saveLayer has at least one other saveLayer nested within it. 39 // True if this saveLayer has at least one other saveLayer nested within it.
27 // False otherwise. 40 // False otherwise.
28 bool fHasNestedLayers; 41 bool fHasNestedLayers;
42 // True if this saveLayer is nested within another. False otherwise.
43 bool fIsNested;
29 }; 44 };
30 45
31 GPUAccelData(Key key) : INHERITED(key) { } 46 GPUAccelData(Key key) : INHERITED(key) { }
32 47
33 void addSaveLayerInfo(const SaveLayerInfo& info) { 48 void addSaveLayerInfo(const SaveLayerInfo& info) {
34 SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID); 49 SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID);
35 *fSaveLayerInfo.push() = info; 50 *fSaveLayerInfo.push() = info;
36 } 51 }
37 52
38 int numSaveLayers() const { return fSaveLayerInfo.count(); } 53 int numSaveLayers() const { return fSaveLayerInfo.count(); }
39 54
40 const SaveLayerInfo& saveLayerInfo(int index) const { 55 const SaveLayerInfo& saveLayerInfo(int index) const {
41 SkASSERT(index < fSaveLayerInfo.count()); 56 SkASSERT(index < fSaveLayerInfo.count());
42 57
43 return fSaveLayerInfo[index]; 58 return fSaveLayerInfo[index];
44 } 59 }
45 60
61 // We may, in the future, need to pass in the GPUDevice in order to
62 // incorporate the clip and matrix state into the key
63 static SkPicture::AccelData::Key ComputeAccelDataKey();
64
46 protected: 65 protected:
47 SkTDArray<SaveLayerInfo> fSaveLayerInfo; 66 SkTDArray<SaveLayerInfo> fSaveLayerInfo;
48 67
49 private: 68 private:
50 typedef SkPicture::AccelData INHERITED; 69 typedef SkPicture::AccelData INHERITED;
51 }; 70 };
52 71
53 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData); 72 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData);
54 73
55 #endif // GrPictureUtils_DEFINED 74 #endif // GrPictureUtils_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/gpu/GrPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698