Flutter Engine
The Flutter Engine
GrWritePixelsRenderTask.cpp
Go to the documentation of this file.
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
9
13
17 GrColorType srcColorType,
18 GrColorType dstColorType,
19 const GrMipLevel texels[],
20 int levelCount) {
22 std::move(dst),
23 rect,
24 srcColorType,
25 dstColorType,
26 texels,
27 levelCount));
28}
29
30GrWritePixelsTask::GrWritePixelsTask(GrDrawingManager* dm,
33 GrColorType srcColorType,
34 GrColorType dstColorType,
35 const GrMipLevel texels[],
36 int levelCount)
37 : fRect(rect)
38 , fSrcColorType(srcColorType)
39 , fDstColorType(dstColorType) {
40 this->addTarget(dm, std::move(dst));
41 fLevels.reset(levelCount);
42 std::copy_n(texels, levelCount, fLevels.get());
43}
44
45void GrWritePixelsTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
46 alloc->addInterval(this->target(0), alloc->curOp(), alloc->curOp(),
49 alloc->incOps();
50}
51
52GrRenderTask::ExpectedOutcome GrWritePixelsTask::onMakeClosed(GrRecordingContext*,
53 SkIRect* targetUpdateBounds) {
54 *targetUpdateBounds = fRect;
56}
57
58bool GrWritePixelsTask::onExecute(GrOpFlushState* flushState) {
59 GrSurfaceProxy* dstProxy = this->target(0);
60 if (!dstProxy->isInstantiated()) {
61 return false;
62 }
63 GrSurface* dstSurface = dstProxy->peekSurface();
64 return flushState->gpu()->writePixels(dstSurface,
65 fRect,
66 fDstColorType,
67 fSrcColorType,
68 fLevels.get(),
69 fLevels.count());
70}
SkRect fRect
Definition: FillRRectOp.cpp:73
GrColorType
Definition: GrTypesPriv.h:540
bool writePixels(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType srcColorType, const GrMipLevel texels[], int mipLevelCount, bool prepForTexSampling=false)
Definition: GrGpu.cpp:461
GrSurfaceProxy * target(int i) const
Definition: GrRenderTask.h:104
void addTarget(GrDrawingManager *dm, const GrSurfaceProxyView &view)
Definition: GrRenderTask.h:166
void addInterval(GrSurfaceProxy *, unsigned int start, unsigned int end, ActualUse actualUse, AllowRecycling SkDEBUGCODE(, bool isDirectDstRead=false))
unsigned int curOp() const
GrSurface * peekSurface() const
bool isInstantiated() const
static sk_sp< GrRenderTask > Make(GrDrawingManager *, sk_sp< GrSurfaceProxy >, SkIRect, GrColorType srcColorType, GrColorType dstColorType, const GrMipLevel[], int levelCount)
void reset(int count)
Definition: SkTemplates.h:195
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
dst
Definition: cp.py:12
Definition: SkRect.h:32