1 /* 2 * Copyright 2019 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 #include "src/gpu/GrTransferFromRenderTask.h" 9 10 #include "src/gpu/GrGpu.h" 11 #include "src/gpu/GrOpFlushState.h" 12 #include "src/gpu/GrResourceAllocator.h" 13 #include "src/gpu/GrResourceProvider.h" 14 gatherProxyIntervals(GrResourceAllocator * alloc) const15void GrTransferFromRenderTask::gatherProxyIntervals(GrResourceAllocator* alloc) const { 16 // This renderTask doesn't have "normal" ops. In this case we still need to add an interval (so 17 // fEndOfOpsTaskOpIndices will remain in sync), so we create a fake op# to capture the fact that 18 // we read fSrcProxy. 19 alloc->addInterval(fSrcProxy.get(), alloc->curOp(), alloc->curOp(), 20 GrResourceAllocator::ActualUse::kYes); 21 alloc->incOps(); 22 } 23 onExecute(GrOpFlushState * flushState)24bool GrTransferFromRenderTask::onExecute(GrOpFlushState* flushState) { 25 if (!fSrcProxy->isInstantiated()) { 26 return false; 27 } 28 return flushState->gpu()->transferPixelsFrom(fSrcProxy->peekSurface(), 29 fSrcRect, 30 fSurfaceColorType, 31 fDstColorType, 32 fDstBuffer, 33 fDstOffset); 34 } 35