Flutter Engine
The Flutter Engine
SkImageGenerator.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 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
12#include "src/core/SkNextID.h"
13
15 : fInfo(info)
16 , fUniqueID(kNeedNewImageUniqueID == uniqueID ? SkNextID::ImageID() : uniqueID)
17{}
18
19bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
20 if (kUnknown_SkColorType == info.colorType()) {
21 return false;
22 }
23 if (nullptr == pixels) {
24 return false;
25 }
26 if (rowBytes < info.minRowBytes()) {
27 return false;
28 }
29
30 Options defaultOpts;
31 return this->onGetPixels(info, pixels, rowBytes, defaultOpts);
32}
33
35 SkYUVAPixmapInfo* yuvaPixmapInfo) const {
36 SkASSERT(yuvaPixmapInfo);
37
38 return this->onQueryYUVAInfo(supportedDataTypes, yuvaPixmapInfo) &&
39 yuvaPixmapInfo->isSupported(supportedDataTypes);
40}
41
43 return this->onGetYUVAPlanes(yuvaPixmaps);
44}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kUnknown_SkColorType
uninitialized
Definition: SkColorType.h:20
@ kNeedNewImageUniqueID
Definition: SkImage_Base.h:33
bool getYUVAPlanes(const SkYUVAPixmaps &yuvaPixmaps)
SkImageGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
bool queryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const
virtual bool onGetYUVAPlanes(const SkYUVAPixmaps &)
virtual bool onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const
virtual bool onGetPixels(const SkImageInfo &, void *, size_t, const Options &)
bool getPixels(const SkImageInfo &info, void *pixels, size_t rowBytes)
bool isSupported(const SupportedDataTypes &) const