37 Star 178 Fork 209

OpenHarmony-SIG/flutter_engine
关闭

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
display_list_benchmarks_gl.cc 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
George Wright 提交于 2022-01-20 05:39 +08:00 . Refactor DisplayList Benchmarks (#30913)
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/display_list/display_list_benchmarks_gl.h"
#include "flutter/display_list/display_list_benchmarks.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace flutter {
namespace testing {
void OpenGLCanvasProvider::InitializeSurface(const size_t width,
const size_t height) {
surface_size_ = SkISize::Make(width, height);
gl_surface_ = std::make_unique<TestGLSurface>(surface_size_);
gl_surface_->MakeCurrent();
const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);
surface_ = SkSurface::MakeRenderTarget(
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
kTopLeft_GrSurfaceOrigin, nullptr, false);
surface_->getCanvas()->clear(SK_ColorTRANSPARENT);
}
sk_sp<SkSurface> OpenGLCanvasProvider::GetSurface() {
if (!gl_surface_->MakeCurrent()) {
return nullptr;
}
return surface_;
}
sk_sp<SkSurface> OpenGLCanvasProvider::MakeOffscreenSurface(
const size_t width,
const size_t height) {
surface_size_ = SkISize::Make(width, height);
const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);
auto offscreen_surface = SkSurface::MakeRenderTarget(
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
kTopLeft_GrSurfaceOrigin, nullptr, false);
offscreen_surface->getCanvas()->clear(SK_ColorTRANSPARENT);
return offscreen_surface;
}
RUN_DISPLAYLIST_BENCHMARKS(OpenGL)
} // namespace testing
} // namespace flutter
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony-sig/flutter_engine.git
git@gitee.com:openharmony-sig/flutter_engine.git
openharmony-sig
flutter_engine
flutter_engine
3.7.12-ohos-1.0.3

搜索帮助