10#if !defined(SK_BUILD_FOR_GOOGLE3)
39#if defined(SK_GRAPHITE)
59 const float kAnglePerTooth = 2.0f *
SK_ScalarPI / (3 * numTeeth);
68 for (
int i = 0;
i < numTeeth; ++
i, angle += 3*kAnglePerTooth) {
70 tmp.
lineTo(
gen_pt(angle+(1.5f*kAnglePerTooth), innerRad));
71 tmp.
lineTo(
gen_pt(angle+(2.5f*kAnglePerTooth), innerRad));
72 tmp.
lineTo(
gen_pt(angle+(3.0f*kAnglePerTooth), outerRad));
78 if (fInnerRad > 0.5f) {
101 paint.setAntiAlias(
false);
111#if defined(SK_GRAPHITE)
147 SkISize levelDims = dimensions;
148 for (
int i = 0;
i < numMipLevels; ++
i) {
158 (
unsigned char*) &pixels[
offset])) {
159 return {
nullptr,
nullptr};
170#if defined(SK_GRAPHITE)
174 sk_gpu_test::ManagedGraphiteTexture::MakeFromCompressedData(recorder,
201 std::move(tmp), dimensions.
width(), dimensions.
height(), compression);
203 return {
image,
nullptr};
230 fImgDimensions.
set(20, 60);
234 fImgDimensions.
set(13, 61);
237 fImgDimensions.
set(kBaseTexWidth, kBaseTexHeight);
248 name.append(
"_npot");
250 name.append(
"_nmof");
257 return SkISize::Make(2*kCellWidth + 3*kPad, 2*kBaseTexHeight + 3*kPad);
263 if (dContext && dContext->abandoned()) {
287 if (!fOpaqueETC2Image.
fImage || !fOpaqueBC1Image.
fImage || !fTransparentBC1Image.
fImage) {
288 *errorMsg =
"Failed to create compressed images.";
296 fOpaqueETC2Image.
fImage =
nullptr;
297 fOpaqueBC1Image.
fImage =
nullptr;
298 fTransparentBC1Image.
fImage =
nullptr;
305 this->drawCell(canvas, fOpaqueETC2Image.
fImage.
get(), { kPad, kPad });
307 this->drawCell(canvas, fOpaqueBC1Image.
fImage.
get(), { 2*kPad + kCellWidth, kPad });
309 this->drawCell(canvas, fTransparentBC1Image.
fImage.
get(),
310 { 2*kPad + kCellWidth, 2*kPad + kBaseTexHeight });
316 SkISize levelDimensions = fImgDimensions;
318 levelDimensions.
height()) + 1;
322 bool isCompressed =
false;
342 for (
int i = 0;
i < numMipLevels; ++
i) {
344 levelDimensions.
width(), levelDimensions.
height());
349 canvas->
drawRect(r, redStrokePaint);
363 static const int kPad = 8;
364 static const int kBaseTexWidth = 64;
365 static const int kCellWidth = 1.5f * kBaseTexWidth;
366 static const int kBaseTexHeight = 64;
376 using INHERITED =
GM;
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
size_t SkCompressedDataSize(SkTextureCompressionType type, SkISize dimensions, TArray< size_t > *individualMipOffsets, bool mipmapped)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static SkImage_Base * as_IB(SkImage *image)
#define SkScalarSin(radians)
#define SkScalarCos(radians)
DrawResult onGpuSetup(SkCanvas *canvas, SkString *errorMsg, GraphiteTestContext *graphiteTestContext) override
CompressedTexturesGM(Type type)
SkString getName() const override
SkISize getISize() override
void onGpuTeardown() override
void onDraw(SkCanvas *canvas) override
const GrCaps * caps() const
bool isFormatCompressed(const GrBackendFormat &format) const
GrImageContextPriv priv()
const GrBackendFormat & backendFormat() const
void allocPixels(const SkImageInfo &info, size_t rowBytes)
const SkPixmap & pixmap() const
SkColorType colorType() const
uint16_t * getAddr16(int x, int y) const
void eraseColor(SkColor4f) 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
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawPath(const SkPath &path, const SkPaint &paint)
static sk_sp< SkData > MakeUninitialized(size_t length)
virtual GrImageContext * context() const
virtual bool isTextureBacked() const =0
static int ComputeLevelCount(int baseWidth, int baseHeight)
void setStyle(Style style)
void setColor(SkColor color)
@ kStroke_Style
set to stroke geometry
SkPath & addCircle(SkScalar x, SkScalar y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
SkPath & moveTo(SkScalar x, SkScalar y)
void setFillType(SkPathFillType ft)
SkPath & lineTo(SkScalar x, SkScalar y)
GM(SkColor backgroundColor=SK_ColorWHITE)
GraphiteTestContext * graphiteTestContext() const
static SkPoint gen_pt(float angle, const SkVector &scale)
static SkPath make_gear(SkISize dimensions, int numTeeth)
SkBitmap render_level(SkISize dimensions, SkColor color, SkColorType colorType, bool opaque)
static CompressedImageObjects make_compressed_image(SkCanvas *canvas, const SkISize dimensions, SkColorType colorType, bool opaque, SkTextureCompressionType compression)
@ kNormal
Default priority level.
int etc1_encode_image(const etc1_byte *pIn, etc1_uint32 width, etc1_uint32 height, etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte *pOut)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API sk_sp< SkImage > WrapTexture(skgpu::graphite::Recorder *, const skgpu::graphite::BackendTexture &, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, skgpu::Origin origin, GenerateMipmapsFromBase generateMipmapsFromBase, TextureReleaseProc=nullptr, ReleaseContext=nullptr, std::string_view label={})
SK_API sk_sp< SkImage > TextureFromCompressedTextureData(GrDirectContext *direct, sk_sp< SkData > data, int width, int height, SkTextureCompressionType type, skgpu::Mipmapped mipmapped=skgpu::Mipmapped::kNo, GrProtected isProtected=GrProtected::kNo)
SK_API sk_sp< SkImage > RasterFromCompressedTextureData(sk_sp< SkData > data, int width, int height, SkTextureCompressionType type)
sk_sp< const SkImage > image
SkSamplingOptions sampling
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
GrTextureProxy * GetTextureImageProxy(SkImage *image, GrRecordingContext *rContext)
static constexpr SkColorType CompressionTypeToSkColorType(SkTextureCompressionType compression)
static constexpr SkCubicResampler Mitchell()
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t width() const
void set(int32_t w, int32_t h)
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)