Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkEncoder.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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
8#ifndef SkEncoder_DEFINED
9#define SkEncoder_DEFINED
10
15
16#include <cstddef>
17#include <cstdint>
18
20public:
21 /**
22 * A single frame to be encoded into an animated image.
23 *
24 * If a frame does not fit in the canvas size, this is an error.
25 * TODO(skia:13705): Add offsets when we have support for an encoder that supports using
26 * offsets.
27 */
28 struct SK_API Frame {
29 /**
30 * Pixmap of the frame.
31 */
33 /**
34 * Duration of the frame in millseconds.
35 */
37 };
38
39 /**
40 * Encode |numRows| rows of input. If the caller requests more rows than are remaining
41 * in the src, this will encode all of the remaining rows. |numRows| must be greater
42 * than zero.
43 */
44 bool encodeRows(int numRows);
45
46 virtual ~SkEncoder() {}
47
48protected:
49
50 virtual bool onEncodeRows(int numRows) = 0;
51
52 SkEncoder(const SkPixmap& src, size_t storageBytes)
53 : fSrc(src)
54 , fCurrRow(0)
55 , fStorage(storageBytes)
56 {}
57
58 const SkPixmap& fSrc;
61};
62
63#endif
#define SK_API
Definition SkAPI.h:35
virtual ~SkEncoder()
Definition SkEncoder.h:46
skia_private::AutoTMalloc< uint8_t > fStorage
Definition SkEncoder.h:60
SkEncoder(const SkPixmap &src, size_t storageBytes)
Definition SkEncoder.h:52
virtual bool onEncodeRows(int numRows)=0
int fCurrRow
Definition SkEncoder.h:59
const SkPixmap & fSrc
Definition SkEncoder.h:58
SkPixmap pixmap
Definition SkEncoder.h:32