1 /* 2 * Copyright 2021 Google LLC 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 GrWritePixelsTask_DEFINED 9 #define GrWritePixelsTask_DEFINED 10 11 #include "include/core/SkRect.h" 12 #include "include/core/SkRefCnt.h" 13 #include "include/private/base/SkDebug.h" 14 #include "include/private/base/SkTemplates.h" 15 #include "include/private/gpu/ganesh/GrTypesPriv.h" 16 #include "src/gpu/ganesh/GrRenderTask.h" 17 18 class GrDrawingManager; 19 class GrOpFlushState; 20 class GrRecordingContext; 21 class GrResourceAllocator; 22 class GrSurfaceProxy; 23 24 class GrWritePixelsTask final : public GrRenderTask { 25 public: 26 static sk_sp<GrRenderTask> Make(GrDrawingManager*, 27 sk_sp<GrSurfaceProxy>, 28 SkIRect, 29 GrColorType srcColorType, 30 GrColorType dstColorType, 31 const GrMipLevel[], 32 int levelCount); 33 34 private: 35 GrWritePixelsTask(GrDrawingManager*, 36 sk_sp<GrSurfaceProxy> dst, 37 SkIRect, 38 GrColorType srcColorType, 39 GrColorType dstColorType, 40 const GrMipLevel[], 41 int levelCount); 42 onIsUsed(GrSurfaceProxy * proxy)43 bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; } 44 void gatherProxyIntervals(GrResourceAllocator*) const override; 45 ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override; 46 bool onExecute(GrOpFlushState*) override; 47 48 #if defined(GPU_TEST_UTILS) name()49 const char* name() const final { return "WritePixels"; } 50 #endif 51 #ifdef SK_DEBUG visitProxies_debugOnly(const GrVisitProxyFunc &)52 void visitProxies_debugOnly(const GrVisitProxyFunc&) const override {} 53 #endif 54 55 skia_private::AutoSTArray<16, GrMipLevel> fLevels; 56 SkIRect fRect; 57 GrColorType fSrcColorType; 58 GrColorType fDstColorType; 59 }; 60 61 #endif 62 63