chromium/third_party/skia/include/private/chromium/GrDeferredDisplayList.h

/*
 * Copyright 2023 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrDeferredDisplayList_DEFINED
#define GrDeferredDisplayList_DEFINED

#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "include/gpu/ganesh/GrRecordingContext.h"
#include "include/private/base/SkTArray.h"
#include "include/private/chromium/GrSurfaceCharacterization.h"

class GrDirectContext;
class GrRenderTargetProxy;
class GrRenderTask;
class GrDeferredDisplayListPriv;
class SkSurface;

/*
 * This class contains pre-processed gpu operations that can be replayed into
 * an SkSurface via SkSurface::draw(GrDeferredDisplayList*).
 */
class GrDeferredDisplayList : public SkNVRefCnt<GrDeferredDisplayList> {};

namespace skgpu::ganesh {
/** Draws the deferred display list created via a GrDeferredDisplayListRecorder.
    If the deferred display list is not compatible with the surface, the draw is skipped
    and false is return.

    The xOffset and yOffset parameters are experimental and, if not both zero, will cause
    the draw to be ignored.
    When implemented, if xOffset or yOffset are non-zero, the DDL will be drawn offset by that
    amount into the surface.

    @param SkSurface            The surface to apply the commands to, cannot be nullptr.
    @param ddl                  drawing commands, cannot be nullptr.
    @return                     false if ddl is not compatible

    example: https://fiddle.skia.org/c/@Surface_draw_2
*/
SK_API bool DrawDDL(SkSurface*,
                    sk_sp<const GrDeferredDisplayList> ddl);

SK_API bool DrawDDL(sk_sp<SkSurface>,
                    sk_sp<const GrDeferredDisplayList> ddl);
}

#endif