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 GrOpList_DEFINED 9 #define GrOpList_DEFINED 10 11 #include "include/core/SkRefCnt.h" 12 #include "include/private/SkColorData.h" 13 #include "include/private/SkTDArray.h" 14 #include "src/gpu/GrRenderTask.h" 15 #include "src/gpu/GrTextureProxy.h" 16 17 class GrAuditTrail; 18 class GrOpMemoryPool; 19 class GrGpuBuffer; 20 21 class GrOpList : public GrRenderTask { 22 public: 23 GrOpList(sk_sp<GrOpMemoryPool>, sk_sp<GrSurfaceProxy>, GrAuditTrail*); 24 ~GrOpList() override; 25 26 /** 27 * Copies a pixel rectangle from a proxy into this opLists's target. This call may finalize 28 * reserved vertex/index data (as though a draw call was made). The src pixels copied are 29 * specified by srcRect. They are copied to a rect of the same size in this opList's target with 30 * top left at dstPoint. If the src rect is clipped by the src bounds then pixel values in the 31 * dst rect corresponding to area clipped by the src rect are not overwritten. This method is 32 * not guaranteed to succeed depending on the type of surface, configs, etc, and the 33 * backend-specific limitations. 34 */ 35 virtual bool copySurface(GrRecordingContext*, 36 GrSurfaceProxy* src, 37 const SkIRect& srcRect, 38 const SkIPoint& dstPoint) = 0; 39 40 virtual void transferFrom(GrRecordingContext*, 41 const SkIRect& srcRect, 42 GrColorType surfaceColorType, 43 GrColorType dstColorType, 44 sk_sp<GrGpuBuffer> dst, 45 size_t dstOffset) = 0; 46 47 void endFlush() override; 48 49 /* 50 * Dump out the GrOpList dependency DAG 51 */ 52 SkDEBUGCODE(void dump(bool printDependencies) const override;) 53 54 protected: 55 // This is a backpointer to the GrOpMemoryPool that holds the memory for this opLists' ops. 56 // In the DDL case, these back pointers keep the DDL's GrOpMemoryPool alive as long as its 57 // constituent opLists survive. 58 sk_sp<GrOpMemoryPool> fOpMemoryPool; 59 GrAuditTrail* fAuditTrail; 60 61 GrLoadOp fColorLoadOp = GrLoadOp::kLoad; 62 SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT; 63 GrLoadOp fStencilLoadOp = GrLoadOp::kLoad; 64 }; 65 66 #endif 67