Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
Loading...
Searching...
No Matches
dl_test_surface_gl.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "
flutter/display_list/testing/dl_test_surface_gl.h
"
6
7
#include "
flutter/display_list/testing/skia/dl_test_surface_instance_skia.h
"
8
#include "third_party/skia/include/core/SkSurface.h"
9
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
10
11
namespace
flutter
{
12
namespace
testing {
13
14
using
PixelFormat
=
DlSurfaceProvider::PixelFormat
;
15
16
bool
DlOpenGLSurfaceProvider::InitializeSurface
(
size_t
width
,
17
size_t
height
,
18
PixelFormat
format) {
19
gl_surface_ = std::make_unique<TestGLSurface>(
DlISize
(
width
,
height
));
20
gl_surface_->MakeCurrent();
21
22
primary_ =
MakeOffscreenSurface
(
width
,
height
,
format
);
23
return
true
;
24
}
25
26
std::shared_ptr<DlSurfaceInstance>
DlOpenGLSurfaceProvider::GetPrimarySurface
()
27
const
{
28
if
(!gl_surface_->MakeCurrent()) {
29
return
nullptr
;
30
}
31
return
primary_;
32
}
33
34
std::shared_ptr<DlSurfaceInstance>
35
DlOpenGLSurfaceProvider::MakeOffscreenSurface
(
size_t
width
,
36
size_t
height
,
37
PixelFormat
format)
const
{
38
auto
offscreen_surface = SkSurfaces::RenderTarget(
39
(GrRecordingContext*)gl_surface_->GetGrContext().get(),
40
skgpu::Budgeted::kNo,
MakeInfo
(
format
,
width
,
height
), 1,
41
kTopLeft_GrSurfaceOrigin,
nullptr
,
false
);
42
43
offscreen_surface->getCanvas()->clear(SK_ColorTRANSPARENT);
44
return
std::make_shared<DlSurfaceInstanceSkia>(offscreen_surface);
45
}
46
47
}
// namespace testing
48
}
// namespace flutter
flutter::testing::DlOpenGLSurfaceProvider::GetPrimarySurface
std::shared_ptr< DlSurfaceInstance > GetPrimarySurface() const override
Definition
dl_test_surface_gl.cc:26
flutter::testing::DlOpenGLSurfaceProvider::InitializeSurface
bool InitializeSurface(size_t width, size_t height, PixelFormat format) override
Definition
dl_test_surface_gl.cc:16
flutter::testing::DlOpenGLSurfaceProvider::MakeOffscreenSurface
std::shared_ptr< DlSurfaceInstance > MakeOffscreenSurface(size_t width, size_t height, PixelFormat format) const override
Definition
dl_test_surface_gl.cc:35
flutter::testing::DlSurfaceProvider::PixelFormat
PixelFormat
Definition
dl_test_surface_provider.h:92
flutter::testing::DlSurfaceProvider::MakeInfo
static SkImageInfo MakeInfo(PixelFormat format, int w, int h)
Definition
dl_test_surface_provider.h:105
dl_test_surface_gl.h
dl_test_surface_instance_skia.h
format
uint32_t uint32_t * format
Definition
fl_texture_registrar_test.cc:42
flutter::testing::PixelFormat
DlSurfaceProvider::PixelFormat PixelFormat
Definition
dl_rendering_unittests.cc:340
flutter
Definition
asset_manager.cc:10
flutter::DlISize
impeller::ISize32 DlISize
Definition
dl_geometry_types.h:26
height
int32_t height
Definition
serialization_callbacks.cc:1
width
int32_t width
Definition
serialization_callbacks.cc:0
display_list
testing
dl_test_surface_gl.cc
Generated on Mon May 25 2026 06:07:32 for Flutter Engine Uber Docs by
1.9.8