Flutter Engine
image_shader.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 
5 #include "flutter/lib/ui/painting/image_shader.h"
6 
7 #include "flutter/lib/ui/ui_dart_state.h"
12 
13 using tonic::ToDart;
14 
15 namespace flutter {
16 
17 static void ImageShader_constructor(Dart_NativeArguments args) {
19 }
20 
22 
23 #define FOR_EACH_BINDING(V) V(ImageShader, initWithImage)
24 
26 
27 void ImageShader::RegisterNatives(tonic::DartLibraryNatives* natives) {
28  natives->Register(
29  {{"ImageShader_constructor", ImageShader_constructor, 1, true},
31 }
32 
34  return fml::MakeRefCounted<ImageShader>();
35 }
36 
38  SkTileMode tmx,
39  SkTileMode tmy,
40  const tonic::Float64List& matrix4) {
41  if (!image) {
42  Dart_ThrowException(
43  ToDart("ImageShader constructor called with non-genuine Image."));
44  return;
45  }
46  SkMatrix sk_matrix = ToSkMatrix(matrix4);
48  image->image()->makeShader(tmx, tmy, &sk_matrix)));
49 }
50 
51 ImageShader::ImageShader() = default;
52 
53 ImageShader::~ImageShader() = default;
54 
55 } // namespace flutter
G_BEGIN_DECLS FlValue * args
~ImageShader() override
static void ImageShader_constructor(Dart_NativeArguments args)
Definition: image_shader.cc:17
void DartCallConstructor(Sig func, Dart_NativeArguments args)
Definition: dart_args.h:218
#define DART_NATIVE_CALLBACK(CLASS, METHOD)
IMPLEMENT_WRAPPERTYPEINFO(ui, Scene)
void set_shader(flutter::SkiaGPUObject< SkShader > shader)
Definition: shader.h:24
void initWithImage(CanvasImage *image, SkTileMode tmx, SkTileMode tmy, const tonic::Float64List &matrix4)
Definition: image_shader.cc:37
static fml::RefPtr< ImageShader > Create()
Definition: image_shader.cc:33
#define DART_REGISTER_NATIVE(CLASS, METHOD)
Dart_Handle ToDart(const T &object)
SkMatrix ToSkMatrix(const tonic::Float64List &matrix4)
Definition: matrix.cc:20
static flutter::SkiaGPUObject< T > CreateGPUObject(sk_sp< T > object)
Definition: ui_dart_state.h:78
sk_sp< SkImage > image() const
Definition: image.h:37
#define FOR_EACH_BINDING(V)
Definition: image_shader.cc:23