45class RectangleTexture :
public GM {
48 this->setBGColor(0xFFFFFFFF);
52 enum class ImageType {
64 case ImageType::kGradientCircle: {
70 SkColor colors0[] = {0xFF1060B0, 0xFF102030};
73 canvas.drawPaint(
paint);
74 SkColor colors1[] = {0xFFA07010, 0xFFA02080};
75 paint.setAntiAlias(
true);
81 case ImageType::k2x2: {
104 "CreateRectangleTextureImage");
105 if (!bet.isValid()) {
116 if (!context || context->abandoned()) {
122 *errorMsg =
"This GM requires an OpenGL context that supports texture rectangles.";
126 auto gradCircle = this->makeImagePixels(50, ImageType::kGradientCircle);
134 *errorMsg =
"Could not create gradient rectangle texture images.";
139 this->makeImagePixels(2, ImageType::k2x2));
141 *errorMsg =
"Could not create 2x2 rectangle texture image.";
148 void onGpuTeardown()
override {
149 fGradImgs[0] = fGradImgs[1] =
nullptr;
154 SkASSERT(fGradImgs[0] && fGradImgs[1] && fSmallImg);
165 constexpr SkScalar kScales[] = {1.0f, 1.2f, 0.75f};
168 for (
size_t i = 0;
i < kNumGradImages; ++
i) {
169 auto img = fGradImgs[
i];
170 int w = img->width();
171 int h = img->height();
172 for (
auto scale : kScales) {
175 for (
auto s : kSamplings) {
206 static constexpr SkScalar kOutset = 25.f;
248 static const int kNumGradImages = 2;
256DEF_GM(
return new RectangleTexture;)
#define GR_GL_TEXTURE_RECTANGLE
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ 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
#define INHERITED(method,...)
static constexpr int kSkTileModeCount
static constexpr bool SkToBool(const T &x)
bool updateBackendTexture(const GrBackendTexture &, const SkColor4f &color, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
void deleteBackendTexture(const GrBackendTexture &)
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, skgpu::Mipmapped, GrRenderable, GrProtected=GrProtected::kNo, std::string_view label={})
bool rectangleTextureSupport() const
Are textures with GL_TEXTURE_RECTANGLE type supported.
void allocPixels(const SkImageInfo &info, size_t rowBytes)
uint32_t * getAddr32(int x, int y) const
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
void setShader(sk_sp< SkShader > shader)
uint32_t uint32_t * format
union flutter::testing::@2836::KeyboardChange::@76 content
SK_API sk_sp< SkImage > AdoptTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin textureOrigin, SkColorType colorType)
SkSamplingOptions sampling
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
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
static SkPath scale(const SkPath &path, SkScalar scale)
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkCubicResampler Mitchell()
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
SkRect makeOutset(float dx, float dy) const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)
const SkMipmapMode mipmap
const SkSamplingOptions gSamplings[]