Flutter Engine
The Flutter Engine
Classes | Functions
CachedDecodingPixelRefTest.cpp File Reference
#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageGenerator.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "include/private/SkColorData.h"
#include "src/core/SkMemset.h"
#include "tests/Test.h"
#include "tools/ToolUtils.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <utility>

Go to the source code of this file.

Classes

class  TestImageGenerator
 

Functions

 DEF_TEST (Image_NewFromGenerator, r)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( Image_NewFromGenerator  ,
 
)

Definition at line 94 of file CachedDecodingPixelRefTest.cpp.

94 {
95 const TestImageGenerator::TestType testTypes[] = {
98 };
99 const SkColorType testColorTypes[] = {
100 kN32_SkColorType,
102 };
103 for (size_t i = 0; i < std::size(testTypes); ++i) {
105 for (const SkColorType testColorType : testColorTypes) {
106 auto gen = std::make_unique<TestImageGenerator>(test, r, testColorType);
108 if (nullptr == image) {
109 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed [%zu]", i);
110 continue;
111 }
115
118 SkCanvas canvas(bitmap);
119 const SkColor kDefaultColor = 0xffabcdef;
120 canvas.clear(kDefaultColor);
121 canvas.drawImage(image, 0, 0);
124 r, TestImageGenerator::Color() == bitmap.getColor(0, 0));
125 }
126 else {
127 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0, 0));
128 }
129 }
130 }
131}
SkColorType
Definition: SkColorType.h:19
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
uint32_t SkColor
Definition: SkColor.h:37
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
virtual bool isLazyGenerated() const =0
int width() const
Definition: SkImage.h:285
int height() const
Definition: SkImage.h:291
SK_API sk_sp< SkImage > DeferredFromGenerator(std::unique_ptr< SkImageGenerator > imageGenerator)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: bitmap.py:1
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
Definition: gen.py:1