64 kNumVertImages*kImageSize + (kNumVertImages+1)*kSpacer);
69 constexpr int kNumLines = 100;
70 constexpr SkScalar kAngleStep = 360.0f / kNumLines;
71 constexpr int kInnerOffset = 10;
75 auto canvas = surf->getCanvas();
84 canvas->translate(kImageSize/2.0f, kImageSize/2.0f);
85 for (
int i = 0; i < kNumLines; ++i, angle += kAngleStep) {
88 canvas->drawLine(cos * kInnerOffset, sin * kInnerOffset,
89 cos * kImageSize/2, sin * kImageSize/2, p);
91 fImage = surf->makeImageSnapshot();
101 SkScalar gScales[] = { 0.9f, 0.8f, 0.75f, 0.6f, 0.5f, 0.4f, 0.25f, 0.2f, 0.1f };
103 SkASSERT(kNumVertImages-1 == (
int)std::size(gScales)/2);
106 for (
int i = 0; i < (
int)std::size(gScales); ++i) {
110 if (i <= (
int)std::size(gScales)/2) {
111 yOff = kSpacer + i * (fImage->
height() + kSpacer);
114 yOff = (std::size(gScales) - i) * (fImage->
height() + kSpacer) -
height;
121 for (
int i = 0; i < (
int)std::size(gScales); ++i) {
125 if (i <= (
int)std::size(gScales)/2) {
126 xOff = fImage->
width() + 2*kSpacer;
127 yOff = kSpacer + i * (fImage->
height() + kSpacer);
131 yOff = kSpacer + (std::size(gScales) - i - 1) * (fImage->
height() + kSpacer);
139 inline static constexpr int kImageSize = 256;
140 inline static constexpr int kSpacer = 10;
141 inline static constexpr int kNumVertImages = 5;
147 using INHERITED =
GM;
173 surf->
width() *3/5.f,
212 static constexpr float kScales[] = {1.f, 0.5f, 0.25f, 0.125f};
216 for (
bool shader : {
false,
true}) {
219 for (
float sy : kScales) {
221 for (
float sx : kScales) {
223 canvas->
scale(sx, sy);
224 auto image = this->updateImage(
surface.get(), kColors[c]);
234 c = (c + 1) % std::size(kColors);
240 for (
float sx : kScales) {
248 inline static constexpr int kPad = 5;
255DEF_GM(
return new AnisoMipsGM();)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kTopLeft_GrSurfaceOrigin
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kUnknown_SkColorType
uninitialized
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
#define INHERITED(method,...)
#define SkScalarSin(radians)
#define SkScalarCos(radians)
#define SkScalarFloorToInt(x)
Type::kYUV Type::kRGBA() int(0.7 *637)
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
virtual GrRecordingContext * recordingContext() const
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)
SkImageInfo imageInfo() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
SkISize dimensions() const
sk_sp< SkImage > withDefaultMipmaps() const
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
sk_sp< SkImage > makeImageSnapshot()
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
sk_sp< SkImage > updateImage(SkSurface *surf, SkColor color)
SkString getName() const override
SkString getName() const override
void onDraw(SkCanvas *canvas) override
void draw(SkCanvas *canvas, int x, int y, int xSize, int ySize)
void onOnceBeforeDraw() override
SkISize getISize() override
static const int kImageSize
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
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)
static constexpr SkISize Make(int32_t w, int32_t h)
sk_sp< SkColorSpace > refColorSpace() const
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkColorType colorType() const
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr SkSamplingOptions Aniso(int maxAniso)