Flutter Engine
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 "third_party/skia/include/core/SkSurface.h"
8
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
9
10
namespace
flutter
{
11
namespace
testing {
12
13
using
PixelFormat
=
DlSurfaceProvider::PixelFormat
;
14
15
bool
DlOpenGLSurfaceProvider::InitializeSurface
(
size_t
width
,
16
size_t
height
,
17
PixelFormat
format) {
18
gl_surface_ = std::make_unique<TestGLSurface>(
DlISize
(
width
,
height
));
19
gl_surface_->MakeCurrent();
20
21
primary_ =
MakeOffscreenSurface
(
width
,
height
,
format
);
22
return
true
;
23
}
24
25
std::shared_ptr<DlSurfaceInstance>
DlOpenGLSurfaceProvider::GetPrimarySurface
()
26
const
{
27
if
(!gl_surface_->MakeCurrent()) {
28
return
nullptr
;
29
}
30
return
primary_;
31
}
32
33
std::shared_ptr<DlSurfaceInstance>
34
DlOpenGLSurfaceProvider::MakeOffscreenSurface
(
size_t
width
,
35
size_t
height
,
36
PixelFormat
format)
const
{
37
auto
offscreen_surface = SkSurfaces::RenderTarget(
38
(GrRecordingContext*)gl_surface_->GetGrContext().get(),
39
skgpu::Budgeted::kNo,
MakeInfo
(
format
,
width
,
height
), 1,
40
kTopLeft_GrSurfaceOrigin,
nullptr
,
false
);
41
42
offscreen_surface->getCanvas()->clear(SK_ColorTRANSPARENT);
43
return
std::make_shared<DlSurfaceInstanceBase>(offscreen_surface);
44
}
45
46
}
// namespace testing
47
}
// namespace flutter
flutter::testing::DlOpenGLSurfaceProvider::GetPrimarySurface
std::shared_ptr< DlSurfaceInstance > GetPrimarySurface() const override
Definition
dl_test_surface_gl.cc:25
flutter::testing::DlOpenGLSurfaceProvider::InitializeSurface
bool InitializeSurface(size_t width, size_t height, PixelFormat format) override
Definition
dl_test_surface_gl.cc:15
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:34
flutter::testing::DlSurfaceProvider::PixelFormat
PixelFormat
Definition
dl_test_surface_provider.h:59
flutter::testing::DlSurfaceProvider::MakeInfo
static SkImageInfo MakeInfo(PixelFormat format, int w, int h)
Definition
dl_test_surface_provider.h:62
dl_test_surface_gl.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:378
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 Thu Nov 6 2025 16:11:21 for Flutter Engine by
1.9.8