Flutter Engine
 
Loading...
Searching...
No Matches
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
14
15namespace impeller {
16class Context;
17} // namespace impeller
18
19namespace flutter {
20
22 public:
23 static int GetColorSpace(const std::shared_ptr<impeller::Texture>& texture);
24
25 /// Converts a DlImage to a SkImage.
26 /// This should be called from the thread that corresponds to
27 /// `dl_image->owning_context()` when gpu access is guaranteed.
28 /// See also: `ConvertImageToRaster`.
29 /// Visible for testing.
30 static void ConvertDlImageToSkImage(
31 const sk_sp<DlImage>& dl_image,
32 std::function<void(fml::StatusOr<sk_sp<SkImage>>)> encode_task,
34 const std::shared_ptr<impeller::Context>& impeller_context);
35
36 /// Converts a DlImage to a SkImage.
37 /// `encode_task` is executed with the resulting `SkImage`.
38 static void ConvertImageToRaster(
39 const sk_sp<DlImage>& dl_image,
40 std::function<void(fml::StatusOr<sk_sp<SkImage>>)> encode_task,
41 const fml::RefPtr<fml::TaskRunner>& raster_task_runner,
42 const fml::RefPtr<fml::TaskRunner>& io_task_runner,
44 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
45 const std::shared_ptr<impeller::Context>& impeller_context);
46};
47} // namespace flutter
48
49#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 fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > &snapshot_delegate, 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 fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > &snapshot_delegate, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch, const std::shared_ptr< impeller::Context > &impeller_context)
FlTexture * texture