De-namespace uses of MaskFormat

Bug: skia:13118
Change-Id: Iab67fd1148182fdd29a38b69f27c51b13942a2b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532400
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2022-04-21 10:51:22 -04:00 committed by SkCQ
parent bcc249a7e4
commit dfab663577
14 changed files with 147 additions and 125 deletions

View File

@ -26,6 +26,8 @@
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "tools/ToolUtils.h"
using MaskFormat = skgpu::MaskFormat;
static SkScalar draw_string(SkCanvas* canvas, const SkString& text, SkScalar x,
SkScalar y, const SkFont& font) {
SkPaint paint;
@ -71,7 +73,7 @@ protected:
static const bool kShowAtlas = false;
if (kShowAtlas) {
if (auto dContext = GrAsDirectContext(canvas->recordingContext())) {
auto img = dContext->priv().testingOnly_getFontAtlasImage(skgpu::MaskFormat::kA8);
auto img = dContext->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8);
canvas->drawImage(img, 0, 0);
}
}

View File

@ -36,6 +36,8 @@
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "tools/ToolUtils.h"
using MaskFormat = skgpu::MaskFormat;
static sk_sp<SkTextBlob> make_blob(const SkString& text, const SkFont& font) {
size_t len = text.size();
SkAutoTArray<SkScalar> pos(len);
@ -100,7 +102,7 @@ class FontRegenGM : public skiagm::GM {
// Debugging tool for GPU.
static const bool kShowAtlas = false;
if (kShowAtlas) {
auto img = dContext->priv().testingOnly_getFontAtlasImage(skgpu::MaskFormat::kA8);
auto img = dContext->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8);
canvas->drawImage(img, 200, 0);
}

View File

@ -19,6 +19,8 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
using MaskFormat = skgpu::MaskFormat;
#endif
SkRandom gRand;
@ -70,8 +72,7 @@ class AnimatedTextView : public Sample {
auto direct = GrAsDirectContext(canvas->recordingContext());
if (direct) {
SkSamplingOptions sampling(SkFilterMode::kLinear, SkMipmapMode::kNearest);
sk_sp<SkImage> image = direct->priv().testingOnly_getFontAtlasImage(
skgpu::MaskFormat::kA8);
sk_sp<SkImage> image = direct->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8);
const SkRect rect = SkRect::MakeXYWH(512.0f, 10.0f, 512.0f, 512.0f);
canvas->drawImageRect(image.get(), rect, rect, sampling, &paint,
SkCanvas::kFast_SrcRectConstraint);

View File

@ -19,6 +19,8 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
using MaskFormat = skgpu::MaskFormat;
#endif
static sk_sp<SkTypeface> chinese_typeface() {
@ -139,23 +141,20 @@ class ChineseZoomView : public Sample {
#if SK_SUPPORT_GPU
auto direct = GrAsDirectContext(canvas->recordingContext());
if (direct) {
sk_sp<SkImage> image = direct->priv().testingOnly_getFontAtlasImage(
skgpu::MaskFormat::kA8, 0);
sk_sp<SkImage> image = direct->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8,
0);
canvas->drawImageRect(image,
SkRect::MakeXYWH(10.0f, 10.0f, 512.0f, 512.0),
SkSamplingOptions(), &paint);
image = direct->priv().testingOnly_getFontAtlasImage(
skgpu::MaskFormat::kA8, 1);
image = direct->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8, 1);
canvas->drawImageRect(image,
SkRect::MakeXYWH(522.0f, 10.0f, 512.f, 512.0f),
SkSamplingOptions(), &paint);
image = direct->priv().testingOnly_getFontAtlasImage(
skgpu::MaskFormat::kA8, 2);
image = direct->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8, 2);
canvas->drawImageRect(image,
SkRect::MakeXYWH(10.0f, 522.0f, 512.0f, 512.0f),
SkSamplingOptions(), &paint);
image = direct->priv().testingOnly_getFontAtlasImage(
skgpu::MaskFormat::kA8, 3);
image = direct->priv().testingOnly_getFontAtlasImage(MaskFormat::kA8, 3);
canvas->drawImageRect(image,
SkRect::MakeXYWH(522.0f, 522.0f, 512.0f, 512.0f),
SkSamplingOptions(), &paint);

View File

@ -29,6 +29,8 @@
#include "src/image/SkImage_Base.h"
#include "src/image/SkImage_Gpu.h"
using MaskFormat = skgpu::MaskFormat;
#define ASSERT_OWNED_PROXY(P) \
SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == this->context())
#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->context()->singleOwner())
@ -158,7 +160,7 @@ void GrDirectContextPriv::printContextStats() const {
}
/////////////////////////////////////////////////
sk_sp<SkImage> GrDirectContextPriv::testingOnly_getFontAtlasImage(skgpu::MaskFormat format,
sk_sp<SkImage> GrDirectContextPriv::testingOnly_getFontAtlasImage(MaskFormat format,
unsigned int index) {
auto atlasManager = this->getAtlasManager();
if (!atlasManager) {

View File

@ -21,6 +21,8 @@
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/GrTracing.h"
using MaskFormat = skgpu::MaskFormat;
#ifdef DUMP_ATLAS_DATA
static bool gDumpAtlasData = false;
#endif
@ -674,8 +676,8 @@ GrDrawOpAtlasConfig::GrDrawOpAtlasConfig(int maxTextureSize, size_t maxBytes) {
fMaxTextureSize = std::min<int>(maxTextureSize, kMaxAtlasDim);
}
SkISize GrDrawOpAtlasConfig::atlasDimensions(skgpu::MaskFormat type) const {
if (skgpu::MaskFormat::kA8 == type) {
SkISize GrDrawOpAtlasConfig::atlasDimensions(MaskFormat type) const {
if (MaskFormat::kA8 == type) {
// A8 is always 2x the ARGB dimensions, clamped to the max allowed texture size
return { std::min<int>(2 * fARGBDimensions.width(), fMaxTextureSize),
std::min<int>(2 * fARGBDimensions.height(), fMaxTextureSize) };
@ -684,8 +686,8 @@ SkISize GrDrawOpAtlasConfig::atlasDimensions(skgpu::MaskFormat type) const {
}
}
SkISize GrDrawOpAtlasConfig::plotDimensions(skgpu::MaskFormat type) const {
if (skgpu::MaskFormat::kA8 == type) {
SkISize GrDrawOpAtlasConfig::plotDimensions(MaskFormat type) const {
if (MaskFormat::kA8 == type) {
SkISize atlasDimensions = this->atlasDimensions(type);
// For A8 we want to grow the plots at larger texture sizes to accept more of the
// larger SDF glyphs. Since the largest SDF glyph can be 170x170 with padding, this

View File

@ -18,6 +18,8 @@
#include "src/gpu/ganesh/glsl/GrGLSLVarying.h"
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
using MaskFormat = skgpu::MaskFormat;
class GrBitmapTextGeoProc::Impl : public ProgramImpl {
public:
void setData(const GrGLSLProgramDataManager& pdman,
@ -90,7 +92,7 @@ private:
append_multitexture_lookup(args, btgp.numTextureSamplers(),
texIdx, uv.fsIn(), "texColor");
if (btgp.fMaskFormat == skgpu::MaskFormat::kARGB) {
if (btgp.fMaskFormat == MaskFormat::kARGB) {
// modulate by color
fragBuilder->codeAppendf("%s = %s * texColor;", args.fOutputColor, args.fOutputColor);
fragBuilder->codeAppendf("const half4 %s = half4(1);", args.fOutputCoverage);
@ -117,7 +119,7 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(const GrShaderCaps& caps,
const GrSurfaceProxyView* views,
int numActiveViews,
GrSamplerState params,
skgpu::MaskFormat format,
MaskFormat format,
const SkMatrix& localMatrix,
bool usesW)
: INHERITED(kGrBitmapTextGeoProc_ClassID)
@ -133,8 +135,7 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(const GrShaderCaps& caps,
fInPosition = {"inPosition", kFloat2_GrVertexAttribType, SkSLType::kFloat2};
}
bool hasVertexColor = skgpu::MaskFormat::kA8 == fMaskFormat ||
skgpu::MaskFormat::kA565 == fMaskFormat;
bool hasVertexColor = MaskFormat::kA8 == fMaskFormat || MaskFormat::kA565 == fMaskFormat;
if (hasVertexColor) {
fInColor = MakeColorAttribute("inColor", wideColor);
}
@ -180,7 +181,7 @@ void GrBitmapTextGeoProc::addNewViews(const GrSurfaceProxyView* views,
void GrBitmapTextGeoProc::addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
b->addBool(fUsesW, "usesW");
static_assert(static_cast<int>(skgpu::MaskFormat::kLast) < (1u << 2));
static_assert(static_cast<int>(MaskFormat::kLast) < (1u << 2));
b->addBits(2, static_cast<int>(fMaskFormat), "maskFormat");
b->addBits(ProgramImpl::kMatrixKeyBits,
ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix),
@ -208,17 +209,17 @@ GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) {
? GrSamplerState::Filter::kLinear
: GrSamplerState::Filter::kNearest);
skgpu::MaskFormat format;
MaskFormat format;
switch (ct) {
case GrColorType::kAlpha_8:
format = skgpu::MaskFormat::kA8;
format = MaskFormat::kA8;
break;
case GrColorType::kBGR_565:
format = skgpu::MaskFormat::kA565;
format = MaskFormat::kA565;
break;
case GrColorType::kRGBA_8888:
default: // It doesn't really matter that color type and mask format agree.
format = skgpu::MaskFormat::kARGB;
format = MaskFormat::kARGB;
break;
}

View File

@ -30,6 +30,8 @@
#include <new>
#include <utility>
using MaskFormat = skgpu::MaskFormat;
namespace skgpu::v1 {
inline static constexpr int kVerticesPerGlyph = 4;
@ -206,7 +208,7 @@ void AtlasTextOp::onPrepareDraws(GrMeshDrawTarget* target) {
GrAtlasManager* atlasManager = target->atlasManager();
skgpu::MaskFormat maskFormat = this->maskFormat();
MaskFormat maskFormat = this->maskFormat();
unsigned int numActiveViews;
const GrSurfaceProxyView* views = atlasManager->getViews(maskFormat, &numActiveViews);
@ -339,7 +341,7 @@ void AtlasTextOp::createDrawForGeneratedGlyphs(GrMeshDrawTarget* target,
auto atlasManager = target->atlasManager();
GrGeometryProcessor* gp = flushInfo->fGeometryProcessor;
skgpu::MaskFormat maskFormat = this->maskFormat();
MaskFormat maskFormat = this->maskFormat();
unsigned int numActiveViews;
const GrSurfaceProxyView* views = atlasManager->getViews(maskFormat, &numActiveViews);

View File

@ -10,6 +10,8 @@
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/SmallPathShapeData.h"
using MaskFormat = skgpu::MaskFormat;
#ifdef DF_PATH_TRACKING
static int g_NumCachedShapes = 0;
static int g_NumFreedShapes = 0;
@ -56,7 +58,7 @@ bool SmallPathAtlasMgr::initAtlas(GrProxyProvider* proxyProvider, const GrCaps*
GrRenderable::kNo);
GrDrawOpAtlasConfig atlasConfig(caps->maxTextureSize(), kMaxAtlasTextureBytes);
SkISize size = atlasConfig.atlasDimensions(skgpu::MaskFormat::kA8);
SkISize size = atlasConfig.atlasDimensions(MaskFormat::kA8);
fAtlas = GrDrawOpAtlas::Make(proxyProvider, format,
GrColorTypeToSkColorType(atlasColorType),
GrColorTypeBytesPerPixel(atlasColorType),

View File

@ -32,6 +32,8 @@
#include "src/gpu/ganesh/ops/SmallPathShapeData.h"
#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
using MaskFormat = skgpu::MaskFormat;
namespace skgpu::v1 {
namespace {
@ -200,7 +202,7 @@ private:
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
target->allocator(), *target->caps().shaderCaps(), this->color(), fWideColor,
views, numActiveProxies, GrSamplerState::Filter::kNearest,
skgpu::MaskFormat::kA8, invert, false);
MaskFormat::kA8, invert, false);
}
// allocate vertices

View File

@ -15,6 +15,8 @@
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/text/GrStrikeCache.h"
using MaskFormat = skgpu::MaskFormat;
GrAtlasManager::GrAtlasManager(GrProxyProvider* proxyProvider,
size_t maxTextureBytes,
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing,
@ -33,7 +35,7 @@ void GrAtlasManager::freeAll() {
}
}
bool GrAtlasManager::hasGlyph(skgpu::MaskFormat format, GrGlyph* glyph) {
bool GrAtlasManager::hasGlyph(MaskFormat format, GrGlyph* glyph) {
SkASSERT(glyph);
return this->getAtlas(format)->hasID(glyph->fAtlasLocator.plotLocator());
}
@ -61,19 +63,19 @@ static void expand_bits(INT_TYPE* dst,
}
static void get_packed_glyph_image(
const SkGlyph& glyph, int dstRB, skgpu::MaskFormat expectedMaskFormat, void* dst) {
const SkGlyph& glyph, int dstRB, MaskFormat expectedMaskFormat, void* dst) {
const int width = glyph.width();
const int height = glyph.height();
const void* src = glyph.image();
SkASSERT(src != nullptr);
skgpu::MaskFormat maskFormat = GrGlyph::FormatFromSkGlyph(glyph.maskFormat());
MaskFormat maskFormat = GrGlyph::FormatFromSkGlyph(glyph.maskFormat());
if (maskFormat == expectedMaskFormat) {
int srcRB = glyph.rowBytes();
// Notice this comparison is with the glyphs raw mask format, and not its skgpu::MaskFormat.
// Notice this comparison is with the glyphs raw mask format, and not its MaskFormat.
if (glyph.maskFormat() != SkMask::kBW_Format) {
if (srcRB != dstRB) {
const int bbp = skgpu::MaskFormatBytesPerPixel(expectedMaskFormat);
const int bbp = MaskFormatBytesPerPixel(expectedMaskFormat);
for (int y = 0; y < height; y++) {
memcpy(dst, src, width * bbp);
src = (const char*) src + srcRB;
@ -86,12 +88,12 @@ static void get_packed_glyph_image(
// Handle 8-bit format by expanding the mask to the expected format.
const uint8_t* bits = reinterpret_cast<const uint8_t*>(src);
switch (expectedMaskFormat) {
case skgpu::MaskFormat::kA8: {
case MaskFormat::kA8: {
uint8_t* bytes = reinterpret_cast<uint8_t*>(dst);
expand_bits(bytes, bits, width, height, dstRB, srcRB);
break;
}
case skgpu::MaskFormat::kA565: {
case MaskFormat::kA565: {
uint16_t* rgb565 = reinterpret_cast<uint16_t*>(dst);
expand_bits(rgb565, bits, width, height, dstRB, srcRB);
break;
@ -100,8 +102,8 @@ static void get_packed_glyph_image(
SK_ABORT("Invalid MaskFormat");
}
}
} else if (maskFormat == skgpu::MaskFormat::kA565 &&
expectedMaskFormat == skgpu::MaskFormat::kARGB) {
} else if (maskFormat == MaskFormat::kA565 &&
expectedMaskFormat == MaskFormat::kARGB) {
// Convert if the glyph uses a 565 mask format since it is using LCD text rendering
// but the expected format is 8888 (will happen on macOS with Metal since that
// combination does not support 565).
@ -111,8 +113,8 @@ static void get_packed_glyph_image(
{0b0000'0000'0001'1111, 0, 5}, // Blue
{0, 0, 0} // Alpha
};
constexpr int a565Bpp = skgpu::MaskFormatBytesPerPixel(skgpu::MaskFormat::kA565);
constexpr int argbBpp = skgpu::MaskFormatBytesPerPixel(skgpu::MaskFormat::kARGB);
constexpr int a565Bpp = MaskFormatBytesPerPixel(MaskFormat::kA565);
constexpr int argbBpp = MaskFormatBytesPerPixel(MaskFormat::kARGB);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
uint16_t color565 = 0;
@ -130,7 +132,7 @@ static void get_packed_glyph_image(
// crbug:510931
// Retrieving the image from the cache can actually change the mask format. This case is
// very uncommon so for now we just draw a clear box for these glyphs.
const int bpp = skgpu::MaskFormatBytesPerPixel(expectedMaskFormat);
const int bpp = MaskFormatBytesPerPixel(expectedMaskFormat);
for (int y = 0; y < height; y++) {
sk_bzero(dst, width * bpp);
dst = (char*)dst + dstRB;
@ -155,9 +157,9 @@ GrDrawOpAtlas::ErrorCode GrAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
}
SkASSERT(grGlyph != nullptr);
skgpu::MaskFormat glyphFormat = GrGlyph::FormatFromSkGlyph(skGlyph.maskFormat());
skgpu::MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
int bytesPerPixel = skgpu::MaskFormatBytesPerPixel(expectedMaskFormat);
MaskFormat glyphFormat = GrGlyph::FormatFromSkGlyph(skGlyph.maskFormat());
MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
int bytesPerPixel = MaskFormatBytesPerPixel(expectedMaskFormat);
int padding;
switch (srcPadding) {
@ -220,7 +222,7 @@ GrDrawOpAtlas::ErrorCode GrAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
// add to texture atlas that matches this format
GrDrawOpAtlas::ErrorCode GrAtlasManager::addToAtlas(GrResourceProvider* resourceProvider,
GrDeferredUploadTarget* target,
skgpu::MaskFormat format,
MaskFormat format,
int width, int height, const void* image,
GrDrawOpAtlas::AtlasLocator* atlasLocator) {
return this->getAtlas(format)->addToAtlas(resourceProvider, target, width, height, image,
@ -228,7 +230,7 @@ GrDrawOpAtlas::ErrorCode GrAtlasManager::addToAtlas(GrResourceProvider* resource
}
void GrAtlasManager::addGlyphToBulkAndSetUseToken(GrDrawOpAtlas::BulkUseTokenUpdater* updater,
skgpu::MaskFormat format, GrGlyph* glyph,
MaskFormat format, GrGlyph* glyph,
GrDeferredUploadToken token) {
SkASSERT(glyph);
if (updater->add(glyph->fAtlasLocator)) {
@ -309,7 +311,7 @@ void GrAtlasManager::dump(GrDirectContext* context) const {
#else
filename.printf("fontcache_%d%d%d.png", gDumpCount, i, pageIdx);
#endif
SkColorType ct = skgpu::MaskFormatToColorType(AtlasIndexToMaskFormat(i));
SkColorType ct = MaskFormatToColorType(AtlasIndexToMaskFormat(i));
save_pixels(context, views[pageIdx], SkColorTypeToGrColorType(ct),
filename.c_str());
}
@ -330,10 +332,10 @@ void GrAtlasManager::setAtlasDimensionsToMinimum_ForTesting() {
new (&fAtlasConfig) GrDrawOpAtlasConfig{};
}
bool GrAtlasManager::initAtlas(skgpu::MaskFormat format) {
bool GrAtlasManager::initAtlas(MaskFormat format) {
int index = MaskFormatToAtlasIndex(format);
if (fAtlases[index] == nullptr) {
SkColorType colorType = skgpu::MaskFormatToColorType(format);
SkColorType colorType = MaskFormatToColorType(format);
GrColorType grColorType = SkColorTypeToGrColorType(colorType);
SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format);
SkISize plotDimensions = fAtlasConfig.plotDimensions(format);

View File

@ -14,6 +14,8 @@
#include "src/core/SkWriteBuffer.h"
#include "src/gpu/ganesh/text/GrAtlasManager.h"
using MaskFormat = skgpu::MaskFormat;
GrGlyphVector::GrGlyphVector(sk_sp<SkStrike>&& strike, SkSpan<Variant> glyphs)
: fStrike{std::move(strike)}
, fGlyphs{glyphs} {
@ -103,7 +105,7 @@ void GrGlyphVector::packedGlyphIDToGrGlyph(GrStrikeCache* cache) {
}
std::tuple<bool, int> GrGlyphVector::regenerateAtlas(int begin, int end,
skgpu::MaskFormat maskFormat,
MaskFormat maskFormat,
int srcPadding,
GrMeshDrawTarget* target) {
GrAtlasManager* atlasManager = target->atlasManager();

View File

@ -41,6 +41,7 @@
#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
using AtlasTextOp = skgpu::v1::AtlasTextOp;
using MaskFormat = skgpu::MaskFormat;
// -- GPU Text -------------------------------------------------------------------------------------
// There are three broad types of SubRun implementations for drawing text using the GPU.
@ -101,13 +102,13 @@ void pun_write(SkWriteBuffer& buffer, const T& src) {
class TransformedMaskVertexFiller {
struct PositionAndExtent;
public:
TransformedMaskVertexFiller(skgpu::MaskFormat maskFormat,
TransformedMaskVertexFiller(MaskFormat maskFormat,
int dstPadding,
SkScalar strikeToSourceScale,
SkRect sourceBounds,
SkSpan<const PositionAndExtent> positionAndExtent);
static TransformedMaskVertexFiller Make(skgpu::MaskFormat maskType,
static TransformedMaskVertexFiller Make(MaskFormat maskType,
int dstPadding,
SkScalar strikeToSourceScale,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
@ -119,11 +120,11 @@ public:
void flatten(SkWriteBuffer& buffer) const;
size_t vertexStride(const SkMatrix& matrix) const {
if (fMaskType != skgpu::MaskFormat::kARGB) {
// For formats skgpu::MaskFormat::kA565 and skgpu::MaskFormat::kA8 where A8 include SDF.
if (fMaskType != MaskFormat::kARGB) {
// For formats MaskFormat::kA565 and MaskFormat::kA8 where A8 include SDF.
return matrix.hasPerspective() ? sizeof(Mask3DVertex) : sizeof(Mask2DVertex);
} else {
// For format skgpu::MaskFormat::kARGB
// For format MaskFormat::kARGB
return matrix.hasPerspective() ? sizeof(ARGB3DVertex) : sizeof(ARGB2DVertex);
}
}
@ -138,7 +139,7 @@ public:
void* vertexBuffer) const;
AtlasTextOp::MaskType opMaskType() const;
skgpu::MaskFormat grMaskType() const {return fMaskType;}
MaskFormat grMaskType() const {return fMaskType;}
int count() const { return SkCount(fPositionAndExtent); }
private:
@ -194,7 +195,7 @@ private:
GrColor color,
const SkMatrix& matrix) const;
const skgpu::MaskFormat fMaskType;
const MaskFormat fMaskType;
const SkPoint fPaddingInset;
const SkScalar fStrikeToSourceScale;
const SkRect fSourceBounds;
@ -202,7 +203,7 @@ private:
};
TransformedMaskVertexFiller::TransformedMaskVertexFiller(
skgpu::MaskFormat maskFormat,
MaskFormat maskFormat,
int dstPadding,
SkScalar strikeToSourceScale,
SkRect sourceBounds,
@ -214,7 +215,7 @@ TransformedMaskVertexFiller::TransformedMaskVertexFiller(
, fPositionAndExtent{positionAndExtent} {}
TransformedMaskVertexFiller TransformedMaskVertexFiller::Make(
skgpu::MaskFormat maskType,
MaskFormat maskType,
int dstPadding,
SkScalar strikeToSourceScale,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
@ -250,7 +251,7 @@ std::optional<TransformedMaskVertexFiller> TransformedMaskVertexFiller::MakeFrom
if (!buffer.validate(0 <= checkingMaskType && checkingMaskType < skgpu::kMaskFormatCount)) {
return {};
}
skgpu::MaskFormat maskType = (skgpu::MaskFormat)checkingMaskType;
MaskFormat maskType = (MaskFormat)checkingMaskType;
int dstPadding = buffer.readInt();
if (!buffer.validate(0 <= dstPadding && dstPadding <= 2)) { return {}; }
SkScalar strikeToSourceScale = buffer.readScalar();
@ -305,7 +306,7 @@ void TransformedMaskVertexFiller::fillVertexData(int offset, int count,
};
if (!positionMatrix.hasPerspective()) {
if (fMaskType == skgpu::MaskFormat::kARGB) {
if (fMaskType == MaskFormat::kARGB) {
using Quad = ARGB2DVertex[4];
SkASSERT(sizeof(ARGB2DVertex) == this->vertexStride(positionMatrix));
this->fill2D(quadData((Quad*) vertexBuffer), color, positionMatrix);
@ -315,7 +316,7 @@ void TransformedMaskVertexFiller::fillVertexData(int offset, int count,
this->fill2D(quadData((Quad*) vertexBuffer), color, positionMatrix);
}
} else {
if (fMaskType == skgpu::MaskFormat::kARGB) {
if (fMaskType == MaskFormat::kARGB) {
using Quad = ARGB3DVertex[4];
SkASSERT(sizeof(ARGB3DVertex) == this->vertexStride(positionMatrix));
this->fill3D(quadData((Quad*) vertexBuffer), color, positionMatrix);
@ -380,9 +381,9 @@ void TransformedMaskVertexFiller::fill3D(SkZip<Quad, const GrGlyph*, const Verte
AtlasTextOp::MaskType TransformedMaskVertexFiller::opMaskType() const {
switch (fMaskType) {
case skgpu::MaskFormat::kA8: return AtlasTextOp::MaskType::kGrayscaleCoverage;
case skgpu::MaskFormat::kA565: return AtlasTextOp::MaskType::kLCDCoverage;
case skgpu::MaskFormat::kARGB: return AtlasTextOp::MaskType::kColorBitmap;
case MaskFormat::kA8: return AtlasTextOp::MaskType::kGrayscaleCoverage;
case MaskFormat::kA565: return AtlasTextOp::MaskType::kLCDCoverage;
case MaskFormat::kARGB: return AtlasTextOp::MaskType::kColorBitmap;
}
SkUNREACHABLE;
}
@ -420,11 +421,11 @@ struct ARGB3DVertex {
AtlasPt atlasPos;
};
AtlasTextOp::MaskType op_mask_type(skgpu::MaskFormat maskFormat) {
AtlasTextOp::MaskType op_mask_type(MaskFormat maskFormat) {
switch (maskFormat) {
case skgpu::MaskFormat::kA8: return AtlasTextOp::MaskType::kGrayscaleCoverage;
case skgpu::MaskFormat::kA565: return AtlasTextOp::MaskType::kLCDCoverage;
case skgpu::MaskFormat::kARGB: return AtlasTextOp::MaskType::kColorBitmap;
case MaskFormat::kA8: return AtlasTextOp::MaskType::kGrayscaleCoverage;
case MaskFormat::kA565: return AtlasTextOp::MaskType::kLCDCoverage;
case MaskFormat::kARGB: return AtlasTextOp::MaskType::kColorBitmap;
}
SkUNREACHABLE;
}
@ -437,11 +438,11 @@ SkMatrix position_matrix(const SkMatrix& drawMatrix, SkPoint drawOrigin) {
SkPMColor4f calculate_colors(skgpu::SurfaceContext* sc,
const SkPaint& paint,
const SkMatrixProvider& matrix,
skgpu::MaskFormat maskFormat,
MaskFormat maskFormat,
GrPaint* grPaint) {
GrRecordingContext* rContext = sc->recordingContext();
const GrColorInfo& colorInfo = sc->colorInfo();
if (maskFormat == skgpu::MaskFormat::kARGB) {
if (maskFormat == MaskFormat::kARGB) {
SkPaintToGrPaintReplaceShader(rContext, colorInfo, paint, matrix, nullptr, grPaint);
float a = grPaint->getColor4f().fA;
return {a, a, a, a};
@ -973,7 +974,7 @@ public:
using DevicePosition = skvx::Vec<2, int16_t>;
DirectMaskSubRun(const GrTextReferenceFrame* referenceFrame,
skgpu::MaskFormat format,
MaskFormat format,
const SkGlyphRect& deviceBounds,
SkSpan<const DevicePosition> devicePositions,
GrGlyphVector&& glyphs,
@ -982,7 +983,7 @@ public:
static GrSubRunOwner Make(const GrTextBlob* blob,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
skgpu::MaskFormat format,
MaskFormat format,
GrSubRunAllocator* alloc);
void draw(SkCanvas*,
@ -1032,7 +1033,7 @@ private:
SkRect deviceRect(const SkMatrix& drawMatrix, SkPoint drawOrigin) const;
const GrTextReferenceFrame* const fTextReferenceFrame;
const skgpu::MaskFormat fMaskFormat;
const MaskFormat fMaskFormat;
// The union of all the glyph bounds in device space.
const SkGlyphRect fGlyphDeviceBounds;
@ -1045,7 +1046,7 @@ private:
};
DirectMaskSubRun::DirectMaskSubRun(const GrTextReferenceFrame* referenceFrame,
skgpu::MaskFormat format,
MaskFormat format,
const SkGlyphRect& deviceBounds,
SkSpan<const DevicePosition> devicePositions,
GrGlyphVector&& glyphs,
@ -1060,7 +1061,7 @@ DirectMaskSubRun::DirectMaskSubRun(const GrTextReferenceFrame* referenceFrame,
GrSubRunOwner DirectMaskSubRun::Make(const GrTextBlob* blob,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
skgpu::MaskFormat format,
MaskFormat format,
GrSubRunAllocator* alloc) {
auto glyphLeftTop = alloc->makePODArray<DevicePosition>(accepted.size());
auto glyphIDs = alloc->makePODArray<GrGlyphVector::Variant>(accepted.size());
@ -1117,7 +1118,7 @@ bool DirectMaskSubRun::canReuse(const SkPaint& paint, const SkMatrix& positionMa
}
size_t DirectMaskSubRun::vertexStride(const SkMatrix&) const {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
return sizeof(Mask2DVertex);
} else {
return sizeof(ARGB2DVertex);
@ -1334,7 +1335,7 @@ void DirectMaskSubRun::fillVertexData(void* vertexDst, int offset, int count,
positionMatrix.mapOrigin() - fTextReferenceFrame->initialPositionMatrix().mapOrigin();
if (clip.isEmpty()) {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(positionMatrix));
direct_2D(quadData((Quad*)vertexDst), color, originOffset);
@ -1344,7 +1345,7 @@ void DirectMaskSubRun::fillVertexData(void* vertexDst, int offset, int count,
generalized_direct_2D(quadData((Quad*)vertexDst), color, originOffset);
}
} else {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(positionMatrix));
generalized_direct_2D(quadData((Quad*)vertexDst), color, originOffset, &clip);
@ -1384,7 +1385,7 @@ public:
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
SkScalar strikeToSourceScale,
skgpu::MaskFormat maskType,
MaskFormat maskType,
GrSubRunAllocator* alloc);
static GrSubRunOwner MakeFromBuffer(const GrTextReferenceFrame* referenceFrame,
@ -1455,7 +1456,7 @@ GrSubRunOwner TransformedMaskSubRun::Make(const GrTextReferenceFrame* referenceF
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
SkScalar strikeToSourceScale,
skgpu::MaskFormat maskType,
MaskFormat maskType,
GrSubRunAllocator* alloc) {
auto vertexFiller = TransformedMaskVertexFiller::Make(
maskType, 0, strikeToSourceScale, accepted, alloc);
@ -1688,7 +1689,7 @@ GrSubRunOwner SDFTSubRun::Make(const GrTextReferenceFrame* referenceFrame,
const GrSDFTMatrixRange& matrixRange,
GrSubRunAllocator* alloc) {
auto vertexFiller = TransformedMaskVertexFiller::Make(
skgpu::MaskFormat::kA8,
MaskFormat::kA8,
SK_DistanceFieldInset,
strikeToSourceScale,
accepted,
@ -1790,7 +1791,7 @@ SDFTSubRun::makeAtlasTextOp(const GrClip* clip,
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
GrPaint grPaint;
SkPMColor4f drawingColor = calculate_colors(sdc, paint, viewMatrix, skgpu::MaskFormat::kA8,
SkPMColor4f drawingColor = calculate_colors(sdc, paint, viewMatrix, MaskFormat::kA8,
&grPaint);
auto [maskType, DFGPFlags, useGammaCorrectDistanceTable] =
@ -1829,7 +1830,7 @@ void SDFTSubRun::testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) const
std::tuple<bool, int>
SDFTSubRun::regenerateAtlas(int begin, int end, GrMeshDrawTarget *target) const {
return fGlyphs.regenerateAtlas(begin, end, skgpu::MaskFormat::kA8, SK_DistanceFieldInset,
return fGlyphs.regenerateAtlas(begin, end, MaskFormat::kA8, SK_DistanceFieldInset,
target);
}
@ -1873,11 +1874,11 @@ void add_multi_mask_format(
auto glyphSpan = accepted.get<0>();
const SkGlyph* glyph = glyphSpan[0];
skgpu::MaskFormat format = GrGlyph::FormatFromSkGlyph(glyph->maskFormat());
MaskFormat format = GrGlyph::FormatFromSkGlyph(glyph->maskFormat());
size_t startIndex = 0;
for (size_t i = 1; i < accepted.size(); i++) {
glyph = glyphSpan[i];
skgpu::MaskFormat nextFormat = GrGlyph::FormatFromSkGlyph(glyph->maskFormat());
MaskFormat nextFormat = GrGlyph::FormatFromSkGlyph(glyph->maskFormat());
if (format != nextFormat) {
auto glyphsWithSameFormat = accepted.subspan(startIndex, i - startIndex);
// Take a ref on the strike. This should rarely happen.
@ -2142,7 +2143,7 @@ void GrTextBlob::processDeviceMasks(
const SkZip<SkGlyphVariant, SkPoint>& accepted, sk_sp<SkStrike>&& strike) {
SkASSERT(strike != nullptr);
auto addGlyphsWithSameFormat = [&] (const SkZip<SkGlyphVariant, SkPoint>& accepted,
skgpu::MaskFormat format,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
GrSubRunOwner subRun = DirectMaskSubRun::Make(
this, accepted, std::move(runStrike), format, &fAlloc);
@ -2184,7 +2185,7 @@ void GrTextBlob::processSourceMasks(const SkZip<SkGlyphVariant, SkPoint>& accept
sk_sp<SkStrike>&& strike,
SkScalar strikeToSourceScale) {
auto addGlyphsWithSameFormat = [&] (const SkZip<SkGlyphVariant, SkPoint>& accepted,
skgpu::MaskFormat format,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
GrSubRunOwner subRun = TransformedMaskSubRun::Make(
this, accepted, std::move(runStrike), strikeToSourceScale, format, &fAlloc);
@ -2351,7 +2352,7 @@ public:
using DevicePosition = DirectMaskSubRun::DevicePosition;
DirectMaskSubRunSlug(const GrTextReferenceFrame* referenceFrame,
skgpu::MaskFormat format,
MaskFormat format,
SkGlyphRect deviceBounds,
SkSpan<const DevicePosition> devicePositions,
GrGlyphVector&& glyphs);
@ -2359,7 +2360,7 @@ public:
static GrSubRunOwner Make(const GrTextReferenceFrame* referenceFrame,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
skgpu::MaskFormat format,
MaskFormat format,
GrSubRunAllocator* alloc);
static GrSubRunOwner MakeFromBuffer(const GrTextReferenceFrame* referenceFrame,
@ -2415,7 +2416,7 @@ private:
std::tuple<bool, SkRect> deviceRectAndCheckTransform(const SkMatrix& positionMatrix) const;
const GrTextReferenceFrame* const fReferenceFrame;
const skgpu::MaskFormat fMaskFormat;
const MaskFormat fMaskFormat;
// The vertex bounds in device space. The bounds are the joined rectangles of all the glyphs.
const SkGlyphRect fGlyphDeviceBounds;
@ -2427,7 +2428,7 @@ private:
};
DirectMaskSubRunSlug::DirectMaskSubRunSlug(const GrTextReferenceFrame* referenceFrame,
skgpu::MaskFormat format,
MaskFormat format,
SkGlyphRect deviceBounds,
SkSpan<const DevicePosition> devicePositions,
GrGlyphVector&& glyphs)
@ -2440,7 +2441,7 @@ DirectMaskSubRunSlug::DirectMaskSubRunSlug(const GrTextReferenceFrame* reference
GrSubRunOwner DirectMaskSubRunSlug::Make(const GrTextReferenceFrame* referenceFrame,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
sk_sp<SkStrike>&& strike,
skgpu::MaskFormat format,
MaskFormat format,
GrSubRunAllocator* alloc) {
auto glyphLeftTop = alloc->makePODArray<DevicePosition>(accepted.size());
auto glyphIDs = alloc->makePODArray<GrGlyphVector::Variant>(accepted.size());
@ -2483,7 +2484,7 @@ GrSubRunOwner DirectMaskSubRunSlug::MakeFromBuffer(const GrTextReferenceFrame* r
SkReadBuffer& buffer,
GrSubRunAllocator* alloc,
const SkStrikeClient* client) {
skgpu::MaskFormat maskType = (skgpu::MaskFormat)buffer.readInt();
MaskFormat maskType = (MaskFormat)buffer.readInt();
SkGlyphRect runBounds;
pun_read(buffer, &runBounds);
@ -2523,13 +2524,13 @@ int DirectMaskSubRunSlug::unflattenSize() const {
size_t DirectMaskSubRunSlug::vertexStride(const SkMatrix& positionMatrix) const {
if (!positionMatrix.hasPerspective()) {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
return sizeof(Mask2DVertex);
} else {
return sizeof(ARGB2DVertex);
}
} else {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
return sizeof(Mask3DVertex);
} else {
return sizeof(ARGB3DVertex);
@ -2679,7 +2680,7 @@ void DirectMaskSubRunSlug::fillVertexData(void* vertexDst, int offset, int count
if (noTransformNeeded) {
if (clip.isEmpty()) {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(SkMatrix::I()));
direct_2D(quadData((Quad*)vertexDst), color, originOffset);
@ -2689,7 +2690,7 @@ void DirectMaskSubRunSlug::fillVertexData(void* vertexDst, int offset, int count
generalized_direct_2D(quadData((Quad*)vertexDst), color, originOffset);
}
} else {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(SkMatrix::I()));
generalized_direct_2D(quadData((Quad*)vertexDst), color, originOffset, &clip);
@ -2702,7 +2703,7 @@ void DirectMaskSubRunSlug::fillVertexData(void* vertexDst, int offset, int count
} else if (SkMatrix inverse; fReferenceFrame->initialPositionMatrix().invert(&inverse)) {
SkMatrix viewDifference = SkMatrix::Concat(positionMatrix, inverse);
if (!viewDifference.hasPerspective()) {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask2DVertex[4];
SkASSERT(sizeof(Mask2DVertex) == this->vertexStride(positionMatrix));
transformed_direct_2D(quadData((Quad*)vertexDst), color, viewDifference);
@ -2712,7 +2713,7 @@ void DirectMaskSubRunSlug::fillVertexData(void* vertexDst, int offset, int count
transformed_direct_2D(quadData((Quad*)vertexDst), color, viewDifference);
}
} else {
if (fMaskFormat != skgpu::MaskFormat::kARGB) {
if (fMaskFormat != MaskFormat::kARGB) {
using Quad = Mask3DVertex[4];
SkASSERT(sizeof(Mask3DVertex) == this->vertexStride(positionMatrix));
transformed_direct_3D(quadData((Quad*)vertexDst), color, viewDifference);
@ -2757,7 +2758,7 @@ DirectMaskSubRunSlug::deviceRectAndCheckTransform(const SkMatrix& positionMatrix
void Slug::processDeviceMasks(
const SkZip<SkGlyphVariant, SkPoint>& accepted, sk_sp<SkStrike>&& strike) {
auto addGlyphsWithSameFormat = [&] (const SkZip<SkGlyphVariant, SkPoint>& accepted,
skgpu::MaskFormat format,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
GrSubRunOwner subRun = DirectMaskSubRunSlug::Make(
this, accepted, std::move(runStrike), format, &fAlloc);
@ -2851,7 +2852,7 @@ void Slug::processSourceMasks(const SkZip<SkGlyphVariant, SkPoint>& accepted,
SkScalar strikeToSourceScale) {
auto addGlyphsWithSameFormat = [&] (const SkZip<SkGlyphVariant, SkPoint>& accepted,
skgpu::MaskFormat format,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
GrSubRunOwner subRun = TransformedMaskSubRun::Make(
this, accepted, std::move(runStrike), strikeToSourceScale, format, &fAlloc);

View File

@ -40,6 +40,8 @@
#include <memory>
#include <utility>
using MaskFormat = skgpu::MaskFormat;
class GrResourceProvider;
static const int kNumPlots = 2;
@ -240,7 +242,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
// in the preparation of the text op
auto atlasManager = dContext->priv().getAtlasManager();
unsigned int numProxies;
atlasManager->getViews(skgpu::MaskFormat::kA8, &numProxies);
atlasManager->getViews(MaskFormat::kA8, &numProxies);
atlasManager->setMaxPages_TestingOnly(0);
flushState.setOpArgs(&opArgs);
@ -250,7 +252,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
#endif // SK_GPU_V1
void test_atlas_config(skiatest::Reporter* reporter, int maxTextureSize, size_t maxBytes,
skgpu::MaskFormat maskFormat, SkISize expectedDimensions,
MaskFormat maskFormat, SkISize expectedDimensions,
SkISize expectedPlotDimensions) {
GrDrawOpAtlasConfig config(maxTextureSize, maxBytes);
REPORTER_ASSERT(reporter, config.atlasDimensions(maskFormat) == expectedDimensions);
@ -259,56 +261,56 @@ void test_atlas_config(skiatest::Reporter* reporter, int maxTextureSize, size_t
DEF_GPUTEST(GrDrawOpAtlasConfig_Basic, reporter, options) {
// 1/4 MB
test_atlas_config(reporter, 65536, 256 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 256 * 1024, MaskFormat::kARGB,
{ 256, 256 }, { 256, 256 });
test_atlas_config(reporter, 65536, 256 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 256 * 1024, MaskFormat::kA8,
{ 512, 512 }, { 256, 256 });
// 1/2 MB
test_atlas_config(reporter, 65536, 512 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 512 * 1024, MaskFormat::kARGB,
{ 512, 256 }, { 256, 256 });
test_atlas_config(reporter, 65536, 512 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 512 * 1024, MaskFormat::kA8,
{ 1024, 512 }, { 256, 256 });
// 1 MB
test_atlas_config(reporter, 65536, 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 1024 * 1024, MaskFormat::kARGB,
{ 512, 512 }, { 256, 256 });
test_atlas_config(reporter, 65536, 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 1024 * 1024, MaskFormat::kA8,
{ 1024, 1024 }, { 256, 256 });
// 2 MB
test_atlas_config(reporter, 65536, 2 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 2 * 1024 * 1024, MaskFormat::kARGB,
{ 1024, 512 }, { 256, 256 });
test_atlas_config(reporter, 65536, 2 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 2 * 1024 * 1024, MaskFormat::kA8,
{ 2048, 1024 }, { 512, 256 });
// 4 MB
test_atlas_config(reporter, 65536, 4 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 4 * 1024 * 1024, MaskFormat::kARGB,
{ 1024, 1024 }, { 256, 256 });
test_atlas_config(reporter, 65536, 4 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 4 * 1024 * 1024, MaskFormat::kA8,
{ 2048, 2048 }, { 512, 512 });
// 8 MB
test_atlas_config(reporter, 65536, 8 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 8 * 1024 * 1024, MaskFormat::kARGB,
{ 2048, 1024 }, { 256, 256 });
test_atlas_config(reporter, 65536, 8 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 8 * 1024 * 1024, MaskFormat::kA8,
{ 2048, 2048 }, { 512, 512 });
// 16 MB (should be same as 8 MB)
test_atlas_config(reporter, 65536, 16 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 16 * 1024 * 1024, MaskFormat::kARGB,
{ 2048, 1024 }, { 256, 256 });
test_atlas_config(reporter, 65536, 16 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 16 * 1024 * 1024, MaskFormat::kA8,
{ 2048, 2048 }, { 512, 512 });
// 4MB, restricted texture size
test_atlas_config(reporter, 1024, 8 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 1024, 8 * 1024 * 1024, MaskFormat::kARGB,
{ 1024, 1024 }, { 256, 256 });
test_atlas_config(reporter, 1024, 8 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 1024, 8 * 1024 * 1024, MaskFormat::kA8,
{ 1024, 1024 }, { 256, 256 });
// 3 MB (should be same as 2 MB)
test_atlas_config(reporter, 65536, 3 * 1024 * 1024, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 3 * 1024 * 1024, MaskFormat::kARGB,
{ 1024, 512 }, { 256, 256 });
test_atlas_config(reporter, 65536, 3 * 1024 * 1024, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 3 * 1024 * 1024, MaskFormat::kA8,
{ 2048, 1024 }, { 512, 256 });
// minimum size
test_atlas_config(reporter, 65536, 0, skgpu::MaskFormat::kARGB,
test_atlas_config(reporter, 65536, 0, MaskFormat::kARGB,
{ 256, 256 }, { 256, 256 });
test_atlas_config(reporter, 65536, 0, skgpu::MaskFormat::kA8,
test_atlas_config(reporter, 65536, 0, MaskFormat::kA8,
{ 512, 512 }, { 256, 256 });
}