Flutter Engine
The Flutter Engine
image_encoding_impeller.h
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
5#ifndef FLUTTER_LIB_UI_PAINTING_IMAGE_ENCODING_IMPELLER_H_
6#define FLUTTER_LIB_UI_PAINTING_IMAGE_ENCODING_IMPELLER_H_
7
8#include "flutter/common/task_runners.h"
9#include "flutter/display_list/image/dl_image.h"
10#include "flutter/fml/status_or.h"
11#include "flutter/fml/synchronization/sync_switch.h"
12
13namespace impeller {
14class Context;
15} // namespace impeller
16
17namespace flutter {
18
20 public:
21 static int GetColorSpace(const std::shared_ptr<impeller::Texture>& texture);
22
23 /// Converts a DlImage to a SkImage.
24 /// This should be called from the thread that corresponds to
25 /// `dl_image->owning_context()` when gpu access is guaranteed.
26 /// See also: `ConvertImageToRaster`.
27 /// Visible for testing.
28 static void ConvertDlImageToSkImage(
29 const sk_sp<DlImage>& dl_image,
30 std::function<void(fml::StatusOr<sk_sp<SkImage>>)> encode_task,
31 const std::shared_ptr<impeller::Context>& impeller_context);
32
33 /// Converts a DlImage to a SkImage.
34 /// `encode_task` is executed with the resulting `SkImage`.
35 static void ConvertImageToRaster(
36 const sk_sp<DlImage>& dl_image,
37 std::function<void(fml::StatusOr<sk_sp<SkImage>>)> encode_task,
38 const fml::RefPtr<fml::TaskRunner>& raster_task_runner,
39 const fml::RefPtr<fml::TaskRunner>& io_task_runner,
40 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
41 const std::shared_ptr<impeller::Context>& impeller_context);
42};
43} // namespace flutter
44
45#endif // FLUTTER_LIB_UI_PAINTING_IMAGE_ENCODING_IMPELLER_H_
static int GetColorSpace(const std::shared_ptr< impeller::Texture > &texture)
static void ConvertDlImageToSkImage(const sk_sp< DlImage > &dl_image, std::function< void(fml::StatusOr< sk_sp< SkImage > >)> encode_task, const std::shared_ptr< impeller::Context > &impeller_context)
static void ConvertImageToRaster(const sk_sp< DlImage > &dl_image, std::function< void(fml::StatusOr< sk_sp< SkImage > >)> encode_task, const fml::RefPtr< fml::TaskRunner > &raster_task_runner, const fml::RefPtr< fml::TaskRunner > &io_task_runner, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch, const std::shared_ptr< impeller::Context > &impeller_context)
Dart_NativeFunction function
Definition: fuchsia.cc:51
FlTexture * texture