Line data Source code
1 : /*
2 : * Copyright 2016 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 : #ifndef GrTexureOpList_DEFINED
9 : #define GrTexureOpList_DEFINED
10 :
11 : #include "GrGpuResource.h"
12 : #include "GrOpList.h"
13 : #include "GrSurfaceProxy.h"
14 :
15 : #include "SkTArray.h"
16 :
17 : class GrAuditTrail;
18 : class GrGpu;
19 : class GrOp;
20 : class GrTextureProxy;
21 : struct SkIPoint;
22 : struct SkIRect;
23 :
24 : class GrTextureOpList final : public GrOpList {
25 : public:
26 : GrTextureOpList(GrTextureProxy*, GrGpu*, GrAuditTrail*);
27 :
28 : ~GrTextureOpList() override;
29 :
30 : /**
31 : * Empties the draw buffer of any queued ops.
32 : */
33 : void reset() override;
34 :
35 0 : void abandonGpuResources() override {}
36 0 : void freeGpuResources() override {}
37 :
38 : /**
39 : * Together these two functions flush all queued ops to GrGpuCommandBuffer. The return value
40 : * of executeOps() indicates whether any commands were actually issued to the GPU.
41 : */
42 : void prepareOps(GrOpFlushState* flushState) override;
43 : bool executeOps(GrOpFlushState* flushState) override;
44 :
45 : /**
46 : * Copies a pixel rectangle from one surface to another. This call may finalize
47 : * reserved vertex/index data (as though a draw call was made). The src pixels
48 : * copied are specified by srcRect. They are copied to a rect of the same
49 : * size in dst with top left at dstPoint. If the src rect is clipped by the
50 : * src bounds then pixel values in the dst rect corresponding to area clipped
51 : * by the src rect are not overwritten. This method is not guaranteed to succeed
52 : * depending on the type of surface, configs, etc, and the backend-specific
53 : * limitations.
54 : */
55 : bool copySurface(GrResourceProvider* resourceProvider,
56 : GrSurfaceProxy* dst,
57 : GrSurfaceProxy* src,
58 : const SkIRect& srcRect,
59 : const SkIPoint& dstPoint);
60 :
61 0 : GrTextureOpList* asTextureOpList() override { return this; }
62 :
63 : SkDEBUGCODE(void dump() const override;)
64 :
65 : private:
66 : // MDB TODO: The unique IDs are only needed for the audit trail. There should only be one
67 : // on the opList itself.
68 : void recordOp(std::unique_ptr<GrOp>,
69 : GrGpuResource::UniqueID resourceUniqueID,
70 : GrSurfaceProxy::UniqueID proxyUniqueID);
71 :
72 : SkSTArray<2, std::unique_ptr<GrOp>, true> fRecordedOps;
73 : GrGpu* fGpu;
74 :
75 : typedef GrOpList INHERITED;
76 : };
77 :
78 : #endif
|