Flutter Engine
The Flutter Engine
Functions
imagemasksubset.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageGenerator.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "tools/GpuToolUtils.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (imagemasksubset, canvas, 480, 480)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( imagemasksubset  ,
canvas  ,
480  ,
480   
)

Definition at line 89 of file imagemasksubset.cpp.

89 {
91 paint.setColor(0xff00ff00);
92
93 const SkImageInfo info = SkImageInfo::MakeA8(kSize.width(), kSize.height());
94
95 for (size_t i = 0; i < std::size(makers); ++i) {
96 sk_sp<SkImage> image = ToolUtils::MakeTextureImage(canvas, makers[i](canvas, info));
97 if (image) {
98 canvas->drawImageRect(image, SkRect::Make(kSubset), kDest, SkSamplingOptions(),
100 sk_sp<SkImage> subset;
101
102 if (auto direct = GrAsDirectContext(canvas->recordingContext())) {
103 subset = image->makeSubset(direct, kSubset);
104 } else {
105#if defined(SK_GRAPHITE)
106 subset = image->makeSubset(canvas->recorder(), kSubset, {});
107#endif
108 }
109
110 canvas->drawImageRect(subset, kDest.makeOffset(kSize.width() * 1.5f, 0),
112 }
113 canvas->translate(0, kSize.height() * 1.5f);
114 }
115}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
const Paint & paint
Definition: color_source.cc:38
constexpr int kSize
sk_sp< const SkImage > image
Definition: SkRecords.h:269
sk_sp< SkImage > MakeTextureImage(SkCanvas *canvas, sk_sp< SkImage > orig)
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
SkSamplingOptions(SkFilterMode::kLinear))
static SkImageInfo MakeA8(int width, int height)
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669