forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rasterizer.cc
35 lines (25 loc) · 1.07 KB
/
rasterizer.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
// Copyright 2016 The Chromium 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/content_handler/rasterizer.h"
#include "flutter/content_handler/software_rasterizer.h"
#if FLUTTER_ENABLE_VULKAN
#include "flutter/content_handler/vulkan_rasterizer.h"
#endif // FLUTTER_ENABLE_VULKAN
namespace flutter_runner {
Rasterizer::~Rasterizer() = default;
std::unique_ptr<Rasterizer> Rasterizer::Create() {
#if FLUTTER_ENABLE_VULKAN
auto vulkan_rasterizer = std::make_unique<VulkanRasterizer>();
if (!vulkan_rasterizer->IsValid()) {
FTL_DLOG(INFO) << "Could not initialize a valid vulkan rasterizer. "
"Attempting to fallback to the software rasterizer.";
return std::make_unique<SoftwareRasterizer>();
}
FTL_DLOG(INFO) << "Successfully initialized a valid vulkan rasterizer.";
return vulkan_rasterizer;
#else // FLUTTER_ENABLE_VULKAN
return std::make_unique<SoftwareRasterizer>();
#endif // FLUTTER_ENABLE_VULKAN
}
} // namespace flutter_runner