forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_list_benchmarks_metal.cc
39 lines (31 loc) · 1.21 KB
/
display_list_benchmarks_metal.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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_metal.h"
#include "flutter/display_list/display_list_benchmarks.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace flutter {
namespace testing {
void MetalCanvasProvider::InitializeSurface(const size_t width,
const size_t height) {
metal_context_ = std::make_unique<TestMetalContext>();
metal_surface_ =
TestMetalSurface::Create(*metal_context_, SkISize::Make(width, height));
metal_surface_->GetSurface()->getCanvas()->clear(SK_ColorTRANSPARENT);
}
sk_sp<SkSurface> MetalCanvasProvider::GetSurface() {
if (!metal_surface_) {
return nullptr;
}
return metal_surface_->GetSurface();
}
sk_sp<SkSurface> MetalCanvasProvider::MakeOffscreenSurface(
const size_t width,
const size_t height) {
metal_offscreen_surface_ =
TestMetalSurface::Create(*metal_context_, SkISize::Make(width, height));
return metal_offscreen_surface_->GetSurface();
}
RUN_DISPLAYLIST_BENCHMARKS(Metal)
} // namespace testing
} // namespace flutter