Flutter Engine
The Flutter Engine
Functions
FlattenableFactoryToName.cpp File Reference
#include "include/core/SkBitmap.h"
#include "include/core/SkColor.h"
#include "include/core/SkFlattenable.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkShader.h"
#include "include/effects/SkImageFilters.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

static void test_flattenable (skiatest::Reporter *r, const SkFlattenable *f, const char *desc)
 
 DEF_TEST (FlattenableFactoryToName, r)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( FlattenableFactoryToName  ,
 
)

Definition at line 33 of file FlattenableFactoryToName.cpp.

33 {
34 sk_sp<SkImageFilter> filter(SkImageFilters::Blur(0.2f, 0.7f, nullptr));
35 test_flattenable(r, filter.get(), "SkImageFilters::Blur()");
36
37 SkBitmap bm;
38 bm.allocN32Pixels(8, 8);
41 test_flattenable(r, image->makeShader(SkSamplingOptions()).get(), "SkImage::newShader()");
42}
static void test_flattenable(skiatest::Reporter *r, const SkFlattenable *f, const char *desc)
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkImage.cpp:179
sk_sp< const SkImage > image
Definition: SkRecords.h:269
const myers::Point & get(const myers::Segment &)

◆ test_flattenable()

static void test_flattenable ( skiatest::Reporter r,
const SkFlattenable f,
const char *  desc 
)
static

Definition at line 19 of file FlattenableFactoryToName.cpp.

21 {
22 if (f) {
23 SkFlattenable::Factory factory = f->getFactory();
24 REPORTER_ASSERT(r, factory);
25 if (factory) {
26 if (!SkFlattenable::FactoryToName(factory)) {
27 ERRORF(r, "SkFlattenable::FactoryToName() fails with %s.", desc);
28 }
29 }
30 }
31}
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
sk_sp< SkFlattenable >(* Factory)(SkReadBuffer &)
Definition: SkFlattenable.h:41
static const char * FactoryToName(Factory)