Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrCanvas.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 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 */
8
10#include "include/core/SkRect.h"
13#include "src/core/SkDevice.h"
17
18namespace skgpu::ganesh {
19
21 if (auto gpuDevice = SkCanvasPriv::TopDevice(canvas)->asGaneshDevice()) {
22 return gpuDevice->surfaceDrawContext();
23 }
24 return nullptr;
25}
26
28 if (auto gpuDevice = SkCanvasPriv::TopDevice(canvas)->asGaneshDevice()) {
29 return gpuDevice->surfaceFillContext();
30 }
31 return nullptr;
32}
33
35 if (auto gpuDevice = SkCanvasPriv::TopDevice(canvas)->asGaneshDevice()) {
36 return gpuDevice->targetProxy();
37 }
38 return nullptr;
39}
40
43}
44
46 auto proxy = TopDeviceTargetProxy(canvas);
47 if (!proxy) {
48 return {};
49 }
50 const GrRenderTarget* renderTarget = proxy->peekRenderTarget();
51 return renderTarget ? renderTarget->getBackendRenderTarget() : GrBackendRenderTarget();
52}
53
54} // namespace skgpu::ganesh
virtual GrBackendRenderTarget getBackendRenderTarget() const =0
static SkDevice * TopDevice(const SkCanvas *canvas)
void getGlobalBounds(SkIRect *bounds) const
Definition SkDevice.h:225
SurfaceFillContext * TopDeviceSurfaceFillContext(const SkCanvas *canvas)
Definition GrCanvas.cpp:27
GrBackendRenderTarget TopLayerBackendRenderTarget(const SkCanvas *)
Definition GrCanvas.cpp:45
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
Definition GrCanvas.cpp:20
SkIRect TopLayerBounds(const SkCanvas *)
Definition GrCanvas.cpp:41
GrRenderTargetProxy * TopDeviceTargetProxy(const SkCanvas *canvas)
Definition GrCanvas.cpp:34