Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Functions
SkImage_RasterFactories.cpp File Reference
#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkRefCnt.h"
#include "include/private/base/SkMath.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/core/SkImageFilterTypes.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkImagePriv.h"
#include "src/image/SkImage_Base.h"
#include "src/image/SkImage_Raster.h"
#include <cstddef>
#include <cstdint>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  SkImages
 

Functions

static bool valid_args (const SkImageInfo &info, size_t rowBytes, size_t *minSize)
 
SK_API sk_sp< SkImageSkImages::RasterFromBitmap (const SkBitmap &bitmap)
 
SK_API sk_sp< SkImageSkImages::RasterFromPixmapCopy (const SkPixmap &pixmap)
 
SK_API sk_sp< SkImageSkImages::RasterFromData (const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
 
SK_API sk_sp< SkImageSkImages::MakeWithFilter (sk_sp< SkImage > src, const SkImageFilter *filter, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset)
 
SK_API sk_sp< SkImageSkImages::RasterFromCompressedTextureData (sk_sp< SkData > data, int width, int height, SkTextureCompressionType type)
 
SK_API sk_sp< SkImageSkImages::RasterFromPixmap (const SkPixmap &pixmap, RasterReleaseProc rasterReleaseProc, ReleaseContext releaseContext)
 
sk_sp< SkImageMakeRasterCopyPriv (const SkPixmap &pmap, uint32_t id)
 

Function Documentation

◆ MakeRasterCopyPriv()

sk_sp< SkImage > MakeRasterCopyPriv ( const SkPixmap pmap,
uint32_t  id 
)

Definition at line 165 of file SkImage_RasterFactories.cpp.

165 {
166 size_t size;
167 if (!valid_args(pmap.info(), pmap.rowBytes(), &size) || !pmap.addr()) {
168 return nullptr;
169 }
170
171 // Here we actually make a copy of the caller's pixel data
173 return sk_make_sp<SkImage_Raster>(pmap.info(), std::move(data), pmap.rowBytes(), id);
174}
static bool valid_args(const SkImageInfo &info, size_t rowBytes, size_t *minSize)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
Definition SkData.cpp:111
size_t rowBytes() const
Definition SkPixmap.h:145
const SkImageInfo & info() const
Definition SkPixmap.h:135
const void * addr() const
Definition SkPixmap.h:153
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ valid_args()

static bool valid_args ( const SkImageInfo info,
size_t  rowBytes,
size_t *  minSize 
)
static

Definition at line 33 of file SkImage_RasterFactories.cpp.

33 {
34 const int maxDimension = SK_MaxS32 >> 2;
35
36 // TODO(mtklein): eliminate anything here that setInfo() has already checked.
37 SkBitmap b;
38 if (!b.setInfo(info, rowBytes)) {
39 return false;
40 }
41
42 if (info.width() <= 0 || info.height() <= 0) {
43 return false;
44 }
45 if (info.width() > maxDimension || info.height() > maxDimension) {
46 return false;
47 }
48 if ((unsigned)info.colorType() > (unsigned)kLastEnum_SkColorType) {
49 return false;
50 }
51 if ((unsigned)info.alphaType() > (unsigned)kLastEnum_SkAlphaType) {
52 return false;
53 }
54
55 if (kUnknown_SkColorType == info.colorType()) {
56 return false;
57 }
58 if (!info.validRowBytes(rowBytes)) {
59 return false;
60 }
61
62 size_t size = info.computeByteSize(rowBytes);
64 return false;
65 }
66
67 if (minSize) {
68 *minSize = size;
69 }
70 return true;
71}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
@ kLastEnum_SkAlphaType
last valid value
Definition SkAlphaType.h:31
@ kLastEnum_SkColorType
last valid value
Definition SkColorType.h:56
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
static constexpr int32_t SK_MaxS32
Definition SkMath.h:21
static bool b
static bool ByteSizeOverflowed(size_t byteSize)