Flutter Impeller
skia_conversions.cc
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 
6 #include "flutter/display_list/dl_blend_mode.h"
7 #include "flutter/display_list/dl_color.h"
8 #include "third_party/skia/modules/skparagraph/include/Paragraph.h"
9 
10 namespace impeller {
11 namespace skia_conversions {
12 
13 Color ToColor(const flutter::DlColor& color) {
14  FML_DCHECK(color.getColorSpace() == flutter::DlColorSpace::kExtendedSRGB ||
15  color.getColorSpace() == flutter::DlColorSpace::kSRGB);
16  return {
17  static_cast<Scalar>(color.getRedF()), //
18  static_cast<Scalar>(color.getGreenF()), //
19  static_cast<Scalar>(color.getBlueF()), //
20  static_cast<Scalar>(color.getAlphaF()) //
21  };
22 }
23 
25  const flutter::DlImageSampling options) {
27  switch (options) {
28  case flutter::DlImageSampling::kNearestNeighbor:
31  desc.label = "Nearest Sampler";
32  break;
33  case flutter::DlImageSampling::kLinear:
36  desc.label = "Linear Sampler";
37  break;
38  case flutter::DlImageSampling::kCubic:
39  case flutter::DlImageSampling::kMipmapLinear:
42  desc.label = "Mipmap Linear Sampler";
43  break;
44  }
45  return desc;
46 }
47 
48 } // namespace skia_conversions
49 } // namespace impeller
impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Color ToColor(const flutter::DlColor &color)
float Scalar
Definition: scalar.h:19
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kBase
The texture is sampled as if it only had a single mipmap level.
@ kNearest
Select nearest to the sample point. Most widely supported.