47#if defined(SK_GRAPHITE)
55 paint.setAntiAlias(
true);
58 paint.setStrokeWidth(10);
92 matrix.setTranslate(-100, -100);
95 matrix.postTranslate(-50, -50);
97 matrix.postTranslate(50, 50);
116 canvas->
scale(0.25f, 0.25f);
137 matrix.setTranslate(-100, -100);
169 return std::make_unique<RasterGenerator>(bm);
189#if defined(SK_GRAPHITE)
196 surface->getCanvas()->clear(0);
197 surface->getCanvas()->translate(-100, -100);
198 surface->getCanvas()->drawPicture(pic);
199 fImage =
surface->makeImageSnapshot();
230 "SurfaceProxyView_GenerateTexture");
241 if (!dContext && !canvas->
recorder()) {
247 return std::make_unique<TextureGenerator>(canvas,
info, pic);
254 FactoryFunc fFactory;
262 fFactory(factory), fUseTexture(useTexture) {
282 auto gen = fFactory(canvas, fPicture);
287 auto textureGen = std::unique_ptr<GrTextureGenerator>(
304 auto gen = fFactory(canvas, fPicture);
311 auto textureGen = std::unique_ptr<GrTextureGenerator>(
320#if defined(SK_GRAPHITE)
372 std::move(colorInfo)));
398 errorMsg->
printf(
"Could not create cached images");
404 this->
drawRow(dContext, canvas, 1.0);
409 this->
drawRow(dContext, canvas, 0.25f);
414 this->
drawRow(dContext, canvas, 2.0f);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct)
@ kTopLeft_GrSurfaceOrigin
#define SkASSERT_RELEASE(cond)
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
@ kNew_Uncached_Unbudgeted
static SkImage_Base * as_IB(SkImage *image)
sk_sp< T > sk_ref_sp(T *obj)
bool matches(GrContext_Base *candidate) const
GrRecordingContextPriv priv()
static GrSurfaceProxyView Copy(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Mipmapped mipmapped, SkIRect srcRect, SkBackingFit fit, skgpu::Budgeted budgeted, std::string_view label)
DrawResult onDraw(SkCanvas *canvas, SkString *errorMsg) override
SkString getName() const override
void onOnceBeforeDraw() override
void drawRow(GrDirectContext *dContext, SkCanvas *canvas, float scale) const
static void draw_as_tex(SkCanvas *canvas, SkImage *image, SkScalar x, SkScalar y)
SkISize getISize() override
ImageCacheratorGM(const char suffix[], FactoryFunc factory, bool useTexture)
static void draw_placeholder(SkCanvas *canvas, SkScalar x, SkScalar y, int w, int h)
bool makeCaches(SkCanvas *canvas)
static void draw_as_bitmap(GrDirectContext *dContext, SkCanvas *canvas, SkImage *image, SkScalar x, SkScalar y)
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
SkString getName() const override
void drawSet(SkCanvas *canvas) const
bool onGetPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, const Options &) override
RasterGenerator(const SkBitmap &bm)
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawOval(const SkRect &oval, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
virtual skgpu::graphite::Recorder * recorder() const
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void clear(SkColor color)
void scale(SkScalar sx, SkScalar sy)
void drawPicture(const SkPicture *picture)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkColorSpace > MakeSRGB()
SkISize dimensions() const
uint32_t uniqueID() const
SkAlphaType alphaType() const
sk_sp< SkColorSpace > refColorSpace() const
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
static SkMatrix Translate(SkScalar dx, SkScalar dy)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
void printf(const char format[],...) SK_PRINTF_LIKE(2
GrSurfaceProxyView onGenerateTexture(GrRecordingContext *rContext, const SkImageInfo &info, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy) override
TextureGenerator(SkCanvas *canvas, const SkImageInfo &info, sk_sp< SkPicture > pic)
static std::unique_ptr< SkImageGenerator > make_pic_generator(SkCanvas *, sk_sp< SkPicture > pic)
static void draw_something(SkCanvas *canvas, const SkRect &bounds)
static std::unique_ptr< SkImageGenerator > make_ras_generator(SkCanvas *, sk_sp< SkPicture > pic)
static std::unique_ptr< SkImageGenerator > make_tex_generator(SkCanvas *canvas, sk_sp< SkPicture > pic)
std::unique_ptr< SkImageGenerator > MakeFromPicture(const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >, SkSurfaceProps props)
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
SK_API sk_sp< SkImage > DeferredFromTextureGenerator(std::unique_ptr< GrTextureGenerator > gen)
SK_API sk_sp< SkImage > DeferredFromGenerator(std::unique_ptr< SkImageGenerator > imageGenerator)
@ kU8
uses 8-bit unsigned int per color component
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
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 policy
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
std::tuple< GrSurfaceProxyView, GrColorType > AsView(GrRecordingContext *rContext, const SkImage *img, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy)
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
constexpr float left() const
constexpr float top() const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
constexpr float right() const
constexpr float bottom() const