Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
TestImageGenerator Class Reference
Inheritance diagram for TestImageGenerator:
SkImageGenerator

Public Types

enum  TestType { kFailGetPixels_TestType , kSucceedGetPixels_TestType , kLast_TestType = kSucceedGetPixels_TestType }
 

Public Member Functions

 TestImageGenerator (TestType type, skiatest::Reporter *reporter, SkColorType colorType=kN32_SkColorType)
 
 ~TestImageGenerator () override
 
- Public Member Functions inherited from SkImageGenerator
virtual ~SkImageGenerator ()
 
uint32_t uniqueID () const
 
sk_sp< SkDatarefEncodedData ()
 
const SkImageInfogetInfo () const
 
bool isValid (GrRecordingContext *context) const
 
bool isProtected () const
 
bool getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes)
 
bool getPixels (const SkPixmap &pm)
 
bool queryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const
 
bool getYUVAPlanes (const SkYUVAPixmaps &yuvaPixmaps)
 
virtual bool isTextureGenerator () const
 

Static Public Member Functions

static int Width ()
 
static int Height ()
 
static SkColor Color ()
 
static SkPMColor PMColor ()
 

Protected Member Functions

bool onGetPixels (const SkImageInfo &info, void *pixels, size_t rowBytes, const Options &options) override
 
- Protected Member Functions inherited from SkImageGenerator
 SkImageGenerator (const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
 
virtual sk_sp< SkDataonRefEncodedData ()
 
virtual bool onGetPixels (const SkImageInfo &, void *, size_t, const Options &)
 
virtual bool onIsValid (GrRecordingContext *) const
 
virtual bool onIsProtected () const
 
virtual bool onQueryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const
 
virtual bool onGetYUVAPlanes (const SkYUVAPixmaps &)
 

Static Protected Member Functions

static SkImageInfo GetMyInfo (SkColorType colorType)
 

Additional Inherited Members

- Protected Attributes inherited from SkImageGenerator
const SkImageInfo fInfo
 
- Static Protected Attributes inherited from SkImageGenerator
static constexpr int kNeedNewImageUniqueID = 0
 

Detailed Description

Definition at line 29 of file CachedDecodingPixelRefTest.cpp.

Member Enumeration Documentation

◆ TestType

Enumerator
kFailGetPixels_TestType 
kSucceedGetPixels_TestType 
kLast_TestType 

Definition at line 31 of file CachedDecodingPixelRefTest.cpp.

Constructor & Destructor Documentation

◆ TestImageGenerator()

TestImageGenerator::TestImageGenerator ( TestType  type,
skiatest::Reporter reporter,
SkColorType  colorType = kN32_SkColorType 
)
inline

Definition at line 42 of file CachedDecodingPixelRefTest.cpp.

44 : SkImageGenerator(GetMyInfo(colorType)), fType(type), fReporter(reporter) {
45 SkASSERT((fType <= kLast_TestType) && (fType >= 0));
46 }
reporter
Definition: FontMgrTest.cpp:39
#define SkASSERT(cond)
Definition: SkAssert.h:116
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
GLenum type
SkImageGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
static SkImageInfo GetMyInfo(SkColorType colorType)

◆ ~TestImageGenerator()

TestImageGenerator::~TestImageGenerator ( )
inlineoverride

Definition at line 47 of file CachedDecodingPixelRefTest.cpp.

47{}

Member Function Documentation

◆ Color()

static SkColor TestImageGenerator::Color ( )
inlinestatic

Definition at line 39 of file CachedDecodingPixelRefTest.cpp.

39{ return ToolUtils::color_to_565(0xffaabbcc); }
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139

◆ GetMyInfo()

static SkImageInfo TestImageGenerator::GetMyInfo ( SkColorType  colorType)
inlinestaticprotected

Definition at line 50 of file CachedDecodingPixelRefTest.cpp.

50 {
53 }
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ Height()

static int TestImageGenerator::Height ( )
inlinestatic

Definition at line 37 of file CachedDecodingPixelRefTest.cpp.

37{ return 10; }

◆ onGetPixels()

bool TestImageGenerator::onGetPixels ( const SkImageInfo info,
void *  pixels,
size_t  rowBytes,
const Options options 
)
inlineoverrideprotectedvirtual

Reimplemented from SkImageGenerator.

Definition at line 55 of file CachedDecodingPixelRefTest.cpp.

56 {
57 REPORTER_ASSERT(fReporter, pixels != nullptr);
58 REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes());
59 if (fType != kSucceedGetPixels_TestType) {
60 return false;
61 }
62 if (info.colorType() != kN32_SkColorType && info.colorType() != getInfo().colorType()) {
63 return false;
64 }
65 char* bytePtr = static_cast<char*>(pixels);
66 switch (info.colorType()) {
67 case kN32_SkColorType:
68 for (int y = 0; y < info.height(); ++y) {
69 SkOpts::memset32((uint32_t*)bytePtr,
71 bytePtr += rowBytes;
72 }
73 break;
75 for (int y = 0; y < info.height(); ++y) {
76 SkOpts::memset16((uint16_t*)bytePtr,
78 bytePtr += rowBytes;
79 }
80 break;
81 default:
82 return false;
83 }
84 return true;
85 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static U16CPU SkPixel32ToPixel16(SkPMColor c)
Definition: SkColorData.h:317
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
const SkImageInfo & getInfo() const
double y
void(* memset16)(uint16_t[], uint16_t, int)
void(* memset32)(uint32_t[], uint32_t, int)

◆ PMColor()

static SkPMColor TestImageGenerator::PMColor ( )
inlinestatic

Definition at line 40 of file CachedDecodingPixelRefTest.cpp.

40{ return SkPreMultiplyColor(Color()); }
SK_API SkPMColor SkPreMultiplyColor(SkColor c)
Definition: SkColor.cpp:21

◆ Width()

static int TestImageGenerator::Width ( )
inlinestatic

Definition at line 36 of file CachedDecodingPixelRefTest.cpp.

36{ return 10; }

The documentation for this class was generated from the following file: