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
6
8#include "third_party/skia/include/core/SkSurface.h"
9#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
10
11namespace flutter {
12namespace testing {
13
15
17 size_t height,
18 PixelFormat format) {
19 gl_surface_ = std::make_unique<TestGLSurface>(DlISize(width, height));
20 gl_surface_->MakeCurrent();
21
23 return true;
24}
25
26std::shared_ptr<DlSurfaceInstance> DlOpenGLSurfaceProvider::GetPrimarySurface()
27 const {
28 if (!gl_surface_->MakeCurrent()) {
29 return nullptr;
30 }
31 return primary_;
32}
33
34std::shared_ptr<DlSurfaceInstance>
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
std::shared_ptr< DlSurfaceInstance > GetPrimarySurface() const override
bool InitializeSurface(size_t width, size_t height, PixelFormat format) override
std::shared_ptr< DlSurfaceInstance > MakeOffscreenSurface(size_t width, size_t height, PixelFormat format) const override
static SkImageInfo MakeInfo(PixelFormat format, int w, int h)
uint32_t uint32_t * format
DlSurfaceProvider::PixelFormat PixelFormat
impeller::ISize32 DlISize
int32_t height
int32_t width