Flutter Engine
The Flutter Engine
ImageSlide.cpp
Go to the documentation of this file.
1/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
9
11#include "include/core/SkData.h"
14
15#include <utility>
16
18 fName = name;
19}
20
22 : fImage(std::move(image)), fRetainImage(true) {
23 fName = name;
24}
25
27 return fImage ? fImage->dimensions() : SkISize::Make(0, 0);
28}
29
31 SkASSERT(fImage);
32 canvas->drawImage(fImage, 0, 0);
33}
34
36 if (fRetainImage) {
37 SkASSERT(fImage);
38 } else {
40 fImage = SkImages::DeferredFromEncodedData(encoded);
41 }
42}
43
45 if (!fRetainImage) {
46 fImage.reset(nullptr);
47 }
48}
SkPath fPath
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkISize getDimensions() const override
Definition: ImageSlide.cpp:26
ImageSlide(const SkString &name, const SkString &path)
Definition: ImageSlide.cpp:17
void unload() override
Definition: ImageSlide.cpp:44
void load(SkScalar winWidth, SkScalar winHeight) override
Definition: ImageSlide.cpp:35
void draw(SkCanvas *canvas) override
Definition: ImageSlide.cpp:30
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
static sk_sp< SkData > MakeFromFileName(const char path[])
Definition: SkData.cpp:148
SkISize dimensions() const
Definition: SkImage.h:297
const char * c_str() const
Definition: SkString.h:133
SkString fName
Definition: Slide.h:54
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310
float SkScalar
Definition: extension.cpp:12
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: ref_ptr.h:256
Definition: SkSize.h:16
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20