46#if defined(SK_GRAPHITE)
53#if defined(SK_GRAPHITE)
74 paint.setAntiAlias(
true);
75 paint.setColor(fillC);
99 SkASSERT(imgR != imgG || (!imgR && !imgG));
116 SkRect dst1, dst2, dst3, dst4;
142 fBufferSize = RB *
H;
202 bitmap.installPixels(pmap);
220 for (
auto ch : chints) {
236 paint.setStrokeWidth(20);
245 return surface->makeImageSnapshot();
281 return surface->makeImageSnapshot();
303 for (
auto& proc : procs) {
324#if defined(SK_GRAPHITE)
326 isGPU = isGPU ||
SkToBool(recorder);
334 auto render_image = [](
SkCanvas* canvas) {
347 static constexpr int kSize = 50;
354 render_image(&bmpCanvas);
356 std::function<sk_sp<SkImage>()> imageFactories[] = {
376 render_image(canvas);
391#if defined(SK_GRAPHITE)
399 render_image(
surface->getCanvas());
400 return surface->makeImageSnapshot();
405 for (
const auto& factory : imageFactories) {
408 for (
auto mm : {
false,
true }) {
416#if defined(SK_GRAPHITE)
437 for (
int x = 0;
x < pm.
width(); ++
x) {
447 for (
int y = 0;
y < 16; ++
y) {
448 for (
int x = 0;
x < 16; ++
x) {
505 *errorMsg =
"Failed to make lazy image.";
510#if defined(SK_GRAPHITE)
518#if defined(SK_GRAPHITE)
520 subset = img->
makeSubset(recorder, {100, 100, 200, 200}, {});
524 subset = img->
makeSubset(dContext, {100, 100, 200, 200});
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_bzero(glyphs, sizeof(glyphs))
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
static SkPMColor SkPackARGB32(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static SkPMColor SkPackARGB32NoCheck(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
static SkImage_Base * as_IB(SkImage *image)
SK_API void sk_free(void *)
static void * sk_malloc_throw(size_t size)
static constexpr bool SkToBool(const T &x)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void onDraw(SkCanvas *canvas) override
SkString getName() const override
SkISize getISize() override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
SkString getName() const override
void alloc(const SkImageInfo &)
size_t bytesWritten() const
void writeImage(const SkImage *) override
void writeToMemory(void *dst) const
void allocPixels(const SkImageInfo &info, size_t rowBytes)
sk_sp< SkImage > asImage() const
const SkPixmap & pixmap() const
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
virtual skgpu::graphite::Recorder * recorder() const
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
void clear(SkColor color)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void scale(SkScalar sx, SkScalar sy)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkData > MakeUninitialized(size_t length)
@ kDisallow_CachingHint
disallows internally caching decoded and copied pixels
@ kAllow_CachingHint
allows internally caching decoded and copied pixels
bool scalePixels(const SkPixmap &dst, const SkSamplingOptions &, CachingHint cachingHint=kAllow_CachingHint) const
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
@ kStroke_Style
set to stroke geometry
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
bool scalePixels(const SkPixmap &dst, const SkSamplingOptions &) const
const uint32_t * addr32() const
uint32_t * writable_addr32(int x, int y) const
sk_sp< SkImage > readImage()
void draw(SkCanvas *canvas, SkScalar x, SkScalar y, const SkSamplingOptions &sampling, const SkPaint *paint)
sk_sp< SkImage > makeImageSnapshot()
static constexpr char kErrorMsg_DrawSkippedGpuOnly[]
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 > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkImage > RasterFromPixmapCopy(const SkPixmap &pixmap)
@ kU8
uses 8-bit unsigned int per color component
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
SkSamplingOptions sampling
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
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 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
font
Font Metadata and Metrics.
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkCubicResampler Mitchell()
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect MakeIWH(int w, int h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
void setIWH(int32_t width, int32_t height)
void setLTRB(float left, float top, float right, float bottom)
SkSerialImageProc fImageProc
static constexpr SkSize Make(SkScalar w, SkScalar h)
std::shared_ptr< const fml::Mapping > data
static void draw_pixmap(SkCanvas *canvas, const SkPixmap &pmap)
sk_sp< SkImage >(* ImageMakerProc)(const SkImageInfo &, GrRecordingContext *, void(*)(SkCanvas *))
static sk_sp< SkImage > make_gpu(const SkImageInfo &info, GrRecordingContext *ctx, void(*draw)(SkCanvas *))
static void draw_contents(SkSurface *surface, SkColor fillC)
DEF_SIMPLE_GM(scalepixels_unpremul, canvas, 1080, 280)
static void show_scaled_pixels(SkCanvas *canvas, SkImage *image)
static sk_sp< SkImage > make_codec(const SkImageInfo &info, GrRecordingContext *, void(*draw)(SkCanvas *))
const SkSamplingOptions gSamplings[]
static void test_surface(SkCanvas *canvas, SkSurface *surf, bool usePaint)
static sk_sp< SkImage > serial_deserial(SkImage *img)
static void slam_ff(const SkPixmap &pm)
static sk_sp< SkImage > make_picture(const SkImageInfo &info, GrRecordingContext *, void(*draw)(SkCanvas *))
static sk_sp< SkImage > make_lazy_image()
static sk_sp< SkImage > make_raster(const SkImageInfo &info, GrRecordingContext *, void(*draw)(SkCanvas *))
DEF_SIMPLE_GM_CAN_FAIL(new_texture_image, canvas, errorMsg, 280, 115)