forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_list_complexity.cc
40 lines (33 loc) · 1.27 KB
/
display_list_complexity.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
40
// 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_complexity.h"
#include "flutter/display_list/display_list.h"
#include "flutter/display_list/display_list_complexity_gl.h"
#include "flutter/display_list/display_list_complexity_metal.h"
namespace flutter {
DisplayListNaiveComplexityCalculator*
DisplayListNaiveComplexityCalculator::instance_ = nullptr;
DisplayListComplexityCalculator*
DisplayListNaiveComplexityCalculator::GetInstance() {
if (instance_ == nullptr) {
instance_ = new DisplayListNaiveComplexityCalculator();
}
return instance_;
}
DisplayListComplexityCalculator* DisplayListComplexityCalculator::GetForBackend(
GrBackendApi backend) {
switch (backend) {
case GrBackendApi::kMetal:
return DisplayListMetalComplexityCalculator::GetInstance();
case GrBackendApi::kOpenGL:
return DisplayListGLComplexityCalculator::GetInstance();
default:
return DisplayListNaiveComplexityCalculator::GetInstance();
}
}
DisplayListComplexityCalculator*
DisplayListComplexityCalculator::GetForSoftware() {
return DisplayListNaiveComplexityCalculator::GetInstance();
}
} // namespace flutter