36#define USE_LAZY_PROXIES 1
92 const int kContentSize = contentRect.
width();
102 const int halfM1 = kContentSize/2 - 1;
121 const int kLeft = contentRect.
fLeft;
131 const char*
src =
static_cast<const char*
>(contentBM.
getPixels());
132 size_t srcRB = contentBM.
rowBytes();
137 for (
int y = 0;
y < contentBM.
height(); ++
y) {
168 paint.setColorFragmentProcessor(std::move(
fp));
182 , fContentRect(
SkIRect::MakeXYWH(kLeftContentOffset, kTopContentOffset,
183 kContentSize, kContentSize)) {
184 this->setBGColor(0xFFCCCCCC);
196 if (!dContext || dContext->abandoned()) {
201 { kLeftContentOffset + kContentSize + kRightContentPadding,
202 kTopContentOffset + kContentSize + kBottomContentPadding },
206 if (!fView.
proxy()) {
207 *errorMsg =
"Failed to create proxy";
217 *errorMsg = kErrorMsg_DrawSkippedGpuOnly;
229 kContentSize, kContentSize);
242 x += 2*kContentSize+kPad;
245 y += 2*kContentSize+kPad;
252 inline static constexpr int kLeftContentOffset = 8;
253 inline static constexpr int kTopContentOffset = 16;
254 inline static constexpr int kRightContentPadding = 24;
255 inline static constexpr int kBottomContentPadding = 80;
257 inline static constexpr int kPad = 4;
259 inline static constexpr int kContentSize = 32;
269 using INHERITED =
GM;
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
@ kOpaque_SkAlphaType
pixel is opaque
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static void SkRectMemcpy(void *dst, size_t dstRB, const void *src, size_t srcRB, size_t trimRowBytes, int rowCount)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static constexpr int kSkTileModeCount
const GrCaps * caps() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
GrDirectContextPriv priv()
static sk_sp< GrTextureProxy > MakeFullyLazyProxy(LazyInstantiateCallback &&, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, GrProtected, const GrCaps &, UseAllocator)
GrRecordingContextPriv priv()
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, skgpu::Protected isProtected, std::string_view label)
GrSurfaceProxy * proxy() const
const GrBackendFormat & backendFormat() const
static std::unique_ptr< GrFragmentProcessor > MakeSubset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState, const SkRect &subset, const GrCaps &caps, const float border[4]=kDefaultBorder, bool alwaysUseShaderTileMode=false)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void eraseArea(const SkIRect &area, SkColor c) const
void * getAddr(int x, int y) const
bool setAlphaType(SkAlphaType alphaType)
void eraseColor(SkColor4f) const
virtual GrRecordingContext * recordingContext() const
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static const SkMatrix & I()
void drawRect(const GrClip *, GrPaint &&paint, GrAA, const SkMatrix &viewMatrix, const SkRect &, const GrStyle *style=nullptr)
SkString getName() const override
SkISize getISize() override
LazyTilingGM(GrSurfaceOrigin origin)
DrawResult onGpuSetup(SkCanvas *canvas, SkString *errorMsg, GraphiteTestContext *) override
DrawResult onDraw(GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg) override
uint32_t uint32_t * format
static GrSurfaceProxyView create_view(GrDirectContext *dContext, const SkBitmap &src, GrSurfaceOrigin origin)
static void draw_texture(const GrCaps *caps, skgpu::ganesh::SurfaceDrawContext *sdc, const GrSurfaceProxyView &src, const SkIRect &srcRect, const SkIRect &drawRect, const SkMatrix &mat, GrSamplerState::WrapMode xTileMode, GrSamplerState::WrapMode yTileMode)
static SkBitmap create_bitmap(SkIRect contentRect, SkISize fullSize, GrSurfaceOrigin origin)
GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext *dContext, GrRenderable renderable, GrSurfaceOrigin origin, GrCPixmap pixmap)
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)