Move GrAtlasTextOp to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I3dde13940e57763d5a8224cb1a4b555e904351d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442716
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 33d69a0..4b06a5a 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -505,14 +505,14 @@
"$_src/gpu/ops/AtlasPathRenderer.h",
"$_src/gpu/ops/AtlasRenderTask.cpp",
"$_src/gpu/ops/AtlasRenderTask.h",
+ "$_src/gpu/ops/AtlasTextOp.cpp",
+ "$_src/gpu/ops/AtlasTextOp.h",
"$_src/gpu/ops/DashLinePathRenderer.cpp",
"$_src/gpu/ops/DashLinePathRenderer.h",
"$_src/gpu/ops/DefaultPathRenderer.cpp",
"$_src/gpu/ops/DefaultPathRenderer.h",
"$_src/gpu/ops/GrAtlasInstancedHelper.cpp",
"$_src/gpu/ops/GrAtlasInstancedHelper.h",
- "$_src/gpu/ops/GrAtlasTextOp.cpp",
- "$_src/gpu/ops/GrAtlasTextOp.h",
"$_src/gpu/ops/GrClearOp.cpp",
"$_src/gpu/ops/GrClearOp.h",
"$_src/gpu/ops/GrDashOp.cpp",
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index c1adcce..0418670 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -24,7 +24,7 @@
#include "src/gpu/text/GrTextBlobCache.h"
#if SK_GPU_V1
-#include "src/gpu/ops/GrAtlasTextOp.h"
+#include "src/gpu/ops/AtlasTextOp.h"
#endif
GrRecordingContext::ProgramData::ProgramData(std::unique_ptr<const GrProgramDesc> desc,
@@ -49,7 +49,7 @@
GrRecordingContext::~GrRecordingContext() {
#if SK_GPU_V1
- GrAtlasTextOp::ClearCache();
+ skgpu::v1::AtlasTextOp::ClearCache();
#endif
}
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/AtlasTextOp.cpp
similarity index 85%
rename from src/gpu/ops/GrAtlasTextOp.cpp
rename to src/gpu/ops/AtlasTextOp.cpp
index 4e09c70..8286a69 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/AtlasTextOp.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ops/GrAtlasTextOp.h"
+#include "src/gpu/ops/AtlasTextOp.h"
#include "include/core/SkPoint3.h"
#include "include/core/SkSpan.h"
@@ -25,17 +25,17 @@
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
#include "src/gpu/text/GrAtlasManager.h"
#include "src/gpu/text/GrDistanceFieldAdjustTable.h"
-#if SK_GPU_V1
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
-#endif
#include <new>
#include <utility>
-// If we have thread local, then cache memory for a single GrAtlasTextOp.
+namespace skgpu::v1 {
+
+// If we have thread local, then cache memory for a single AtlasTextOp.
#if defined(GR_HAS_THREAD_LOCAL)
static thread_local void* gCache = nullptr;
-void* GrAtlasTextOp::operator new(size_t s) {
+void* AtlasTextOp::operator new(size_t s) {
if (gCache != nullptr) {
return std::exchange(gCache, nullptr);
}
@@ -43,7 +43,7 @@
return ::operator new(s);
}
-void GrAtlasTextOp::operator delete(void* bytes) noexcept {
+void AtlasTextOp::operator delete(void* bytes) noexcept {
if (gCache == nullptr) {
gCache = bytes;
return;
@@ -51,18 +51,18 @@
::operator delete(bytes);
}
-void GrAtlasTextOp::ClearCache() {
+void AtlasTextOp::ClearCache() {
::operator delete(gCache);
gCache = nullptr;
}
#endif
-GrAtlasTextOp::GrAtlasTextOp(MaskType maskType,
- bool needsTransform,
- int glyphCount,
- SkRect deviceRect,
- Geometry* geo,
- GrPaint&& paint)
+AtlasTextOp::AtlasTextOp(MaskType maskType,
+ bool needsTransform,
+ int glyphCount,
+ SkRect deviceRect,
+ Geometry* geo,
+ GrPaint&& paint)
: INHERITED{ClassID()}
, fProcessors(std::move(paint))
, fNumGlyphs(glyphCount)
@@ -79,15 +79,15 @@
this->setBounds(deviceRect, HasAABloat::kNo, IsHairline::kNo);
}
-GrAtlasTextOp::GrAtlasTextOp(MaskType maskType,
- bool needsTransform,
- int glyphCount,
- SkRect deviceRect,
- SkColor luminanceColor,
- bool useGammaCorrectDistanceTable,
- uint32_t DFGPFlags,
- Geometry* geo,
- GrPaint&& paint)
+AtlasTextOp::AtlasTextOp(MaskType maskType,
+ bool needsTransform,
+ int glyphCount,
+ SkRect deviceRect,
+ SkColor luminanceColor,
+ bool useGammaCorrectDistanceTable,
+ uint32_t DFGPFlags,
+ Geometry* geo,
+ GrPaint&& paint)
: INHERITED{ClassID()}
, fProcessors(std::move(paint))
, fNumGlyphs(glyphCount)
@@ -105,13 +105,13 @@
this->setBounds(deviceRect, HasAABloat::kNo, IsHairline::kNo);
}
-auto GrAtlasTextOp::Geometry::MakeForBlob(const GrAtlasSubRun& subRun,
- const SkMatrix& drawMatrix,
- SkPoint drawOrigin,
- SkIRect clipRect,
- sk_sp<GrTextBlob> blob,
- const SkPMColor4f& color,
- SkArenaAlloc* alloc) -> Geometry* {
+auto AtlasTextOp::Geometry::MakeForBlob(const GrAtlasSubRun& subRun,
+ const SkMatrix& drawMatrix,
+ SkPoint drawOrigin,
+ SkIRect clipRect,
+ sk_sp<GrTextBlob> blob,
+ const SkPMColor4f& color,
+ SkArenaAlloc* alloc) -> Geometry* {
// Bypass the automatic dtor behavior in SkArenaAlloc. I'm leaving this up to the Op to run
// all geometry dtors for now.
void* geo = alloc->makeBytesAlignedTo(sizeof(Geometry), alignof(Geometry));
@@ -124,19 +124,19 @@
color};
}
-void GrAtlasTextOp::Geometry::fillVertexData(void *dst, int offset, int count) const {
+void AtlasTextOp::Geometry::fillVertexData(void *dst, int offset, int count) const {
SkMatrix positionMatrix = fDrawMatrix;
positionMatrix.preTranslate(fDrawOrigin.x(), fDrawOrigin.y());
fSubRun.fillVertexData(
dst, offset, count, fColor.toBytes_RGBA(), positionMatrix, fClipRect);
}
-void GrAtlasTextOp::visitProxies(const GrVisitProxyFunc& func) const {
+void AtlasTextOp::visitProxies(const GrVisitProxyFunc& func) const {
fProcessors.visitProxies(func);
}
#if GR_TEST_UTILS
-SkString GrAtlasTextOp::onDumpInfo() const {
+SkString AtlasTextOp::onDumpInfo() const {
SkString str;
int i = 0;
for(Geometry* geom = fHead; geom != nullptr; geom = geom->fNext) {
@@ -152,12 +152,13 @@
}
#endif
-GrDrawOp::FixedFunctionFlags GrAtlasTextOp::fixedFunctionFlags() const {
+GrDrawOp::FixedFunctionFlags AtlasTextOp::fixedFunctionFlags() const {
return FixedFunctionFlags::kNone;
}
-GrProcessorSet::Analysis GrAtlasTextOp::finalize(const GrCaps& caps, const GrAppliedClip* clip,
- GrClampType clampType) {
+GrProcessorSet::Analysis AtlasTextOp::finalize(const GrCaps& caps,
+ const GrAppliedClip* clip,
+ GrClampType clampType) {
GrProcessorAnalysisCoverage coverage;
GrProcessorAnalysisColor color;
if (this->maskType() == MaskType::kColorBitmap) {
@@ -193,7 +194,7 @@
return analysis;
}
-void GrAtlasTextOp::onPrepareDraws(GrMeshDrawTarget* target) {
+void AtlasTextOp::onPrepareDraws(GrMeshDrawTarget* target) {
auto resourceProvider = target->resourceProvider();
// If we need local coordinates, compute an inverse view matrix. If this is solid color, the
@@ -322,7 +323,7 @@
}
}
-void GrAtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
+void AtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
std::move(fProcessors),
GrPipeline::InputFlags::kNone);
@@ -331,8 +332,8 @@
&GrUserStencilSettings::kUnused);
}
-void GrAtlasTextOp::createDrawForGeneratedGlyphs(
- GrMeshDrawTarget* target, FlushInfo* flushInfo) const {
+void AtlasTextOp::createDrawForGeneratedGlyphs(GrMeshDrawTarget* target,
+ FlushInfo* flushInfo) const {
if (!flushInfo->fGlyphsToFlush) {
return;
}
@@ -388,8 +389,8 @@
++flushInfo->fNumDraws;
}
-GrOp::CombineResult GrAtlasTextOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
- GrAtlasTextOp* that = t->cast<GrAtlasTextOp>();
+GrOp::CombineResult AtlasTextOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
+ auto that = t->cast<AtlasTextOp>();
if (fDFGPFlags != that->fDFGPFlags ||
fMaskType != that->fMaskType ||
@@ -437,11 +438,11 @@
}
// TODO trying to figure out why lcd is so whack
-GrGeometryProcessor* GrAtlasTextOp::setupDfProcessor(SkArenaAlloc* arena,
- const GrShaderCaps& caps,
- const SkMatrix& localMatrix,
- const GrSurfaceProxyView* views,
- unsigned int numActiveViews) const {
+GrGeometryProcessor* AtlasTextOp::setupDfProcessor(SkArenaAlloc* arena,
+ const GrShaderCaps& caps,
+ const SkMatrix& localMatrix,
+ const GrSurfaceProxyView* views,
+ unsigned int numActiveViews) const {
static constexpr int kDistanceAdjustLumShift = 5;
auto dfAdjustTable = GrDistanceFieldAdjustTable::Get();
@@ -482,16 +483,16 @@
}
}
-#if GR_TEST_UTILS && SK_GPU_V1
+#if GR_TEST_UTILS
#include "src/gpu/GrDrawOpTest.h"
-GrOp::Owner GrAtlasTextOp::CreateOpTestingOnly(skgpu::v1::SurfaceDrawContext* sdc,
- const SkPaint& skPaint,
- const SkFont& font,
- const SkMatrixProvider& mtxProvider,
- const char* text,
- int x,
- int y) {
+GrOp::Owner AtlasTextOp::CreateOpTestingOnly(SurfaceDrawContext* sdc,
+ const SkPaint& skPaint,
+ const SkFont& font,
+ const SkMatrixProvider& mtxProvider,
+ const char* text,
+ int x,
+ int y) {
size_t textLen = (int)strlen(text);
SkMatrix drawMatrix(mtxProvider.localToDevice());
@@ -522,7 +523,13 @@
return op;
}
-GR_DRAW_OP_TEST_DEFINE(GrAtlasTextOp) {
+#endif
+
+} // namespace skgpu::v1
+
+#if GR_TEST_UTILS
+
+GR_DRAW_OP_TEST_DEFINE(AtlasTextOp) {
SkSimpleMatrixProvider matrixProvider(GrTest::TestMatrixInvertible(random));
SkPaint skPaint;
@@ -545,7 +552,8 @@
int xInt = (random->nextU() % kMaxTrans) * xPos;
int yInt = (random->nextU() % kMaxTrans) * yPos;
- return GrAtlasTextOp::CreateOpTestingOnly(sdc, skPaint, font, matrixProvider, text, xInt, yInt);
+ return skgpu::v1::AtlasTextOp::CreateOpTestingOnly(sdc, skPaint, font, matrixProvider,
+ text, xInt, yInt);
}
#endif
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/AtlasTextOp.h
similarity index 91%
rename from src/gpu/ops/GrAtlasTextOp.h
rename to src/gpu/ops/AtlasTextOp.h
index 4c4a7bb..83df60a 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/AtlasTextOp.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrAtlasTextOp_DEFINED
-#define GrAtlasTextOp_DEFINED
+#ifndef AtlasTextOp_DEFINED
+#define AtlasTextOp_DEFINED
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
@@ -19,11 +19,13 @@
class GrRecordingContext;
-class GrAtlasTextOp final : public GrMeshDrawOp {
+namespace skgpu::v1 {
+
+class AtlasTextOp final : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- ~GrAtlasTextOp() override {
+ ~AtlasTextOp() override {
for (const Geometry* g = fHead; g != nullptr;) {
const Geometry* next = g->fNext;
g->~Geometry();
@@ -137,22 +139,22 @@
int fNumDraws = 0;
};
- GrAtlasTextOp(MaskType maskType,
- bool needsTransform,
- int glyphCount,
- SkRect deviceRect,
- Geometry* geo,
- GrPaint&& paint);
+ AtlasTextOp(MaskType maskType,
+ bool needsTransform,
+ int glyphCount,
+ SkRect deviceRect,
+ Geometry* geo,
+ GrPaint&& paint);
- GrAtlasTextOp(MaskType maskType,
- bool needsTransform,
- int glyphCount,
- SkRect deviceRect,
- SkColor luminanceColor,
- bool useGammaCorrectDistanceTable,
- uint32_t DFGPFlags,
- Geometry* geo,
- GrPaint&& paint);
+ AtlasTextOp(MaskType maskType,
+ bool needsTransform,
+ int glyphCount,
+ SkRect deviceRect,
+ SkColor luminanceColor,
+ bool useGammaCorrectDistanceTable,
+ uint32_t DFGPFlags,
+ Geometry* geo,
+ GrPaint&& paint);
GrProgramInfo* programInfo() override {
// TODO [PI]: implement
@@ -175,7 +177,7 @@
const GrDstProxyView&,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) override {
- // We cannot surface the GrAtlasTextOp's programInfo at record time. As currently
+ // We cannot surface the AtlasTextOp's programInfo at record time. As currently
// implemented, the GP is modified at flush time based on the number of pages in the
// atlas.
}
@@ -262,4 +264,6 @@
using INHERITED = GrMeshDrawOp;
};
-#endif
+} // namespace skgpu::v1
+
+#endif // AtlasTextOp_DEFINED
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 346ddaa..dd60ba8 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -27,8 +27,10 @@
#if SK_GPU_V1
#include "src/gpu/GrBlurUtils.h"
-#include "src/gpu/ops/GrAtlasTextOp.h"
+#include "src/gpu/ops/AtlasTextOp.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
+
+using AtlasTextOp = skgpu::v1::AtlasTextOp;
#else
#include "src/gpu/SurfaceContext.h"
#endif
@@ -69,11 +71,11 @@
#if SK_GPU_V1
-GrAtlasTextOp::MaskType op_mask_type(GrMaskFormat grMaskFormat) {
+AtlasTextOp::MaskType op_mask_type(GrMaskFormat grMaskFormat) {
switch (grMaskFormat) {
- case kA8_GrMaskFormat: return GrAtlasTextOp::MaskType::kGrayscaleCoverage;
- case kA565_GrMaskFormat: return GrAtlasTextOp::MaskType::kLCDCoverage;
- case kARGB_GrMaskFormat: return GrAtlasTextOp::MaskType::kColorBitmap;
+ case kA8_GrMaskFormat: return AtlasTextOp::MaskType::kGrayscaleCoverage;
+ case kA565_GrMaskFormat: return AtlasTextOp::MaskType::kLCDCoverage;
+ case kARGB_GrMaskFormat: return AtlasTextOp::MaskType::kColorBitmap;
}
SkUNREACHABLE;
}
@@ -688,23 +690,22 @@
const SkPMColor4f drawingColor =
calculate_colors(sdc, paint, viewMatrix, fMaskFormat, &grPaint);
- GrAtlasTextOp::Geometry* geometry = GrAtlasTextOp::Geometry::MakeForBlob(
- *this,
- drawMatrix,
- drawOrigin,
- clipRect,
- sk_ref_sp<GrTextBlob>(fBlob),
- drawingColor,
- sdc->arenaAlloc());
+ auto geometry = AtlasTextOp::Geometry::MakeForBlob(*this,
+ drawMatrix,
+ drawOrigin,
+ clipRect,
+ sk_ref_sp<GrTextBlob>(fBlob),
+ drawingColor,
+ sdc->arenaAlloc());
GrRecordingContext* const rContext = sdc->recordingContext();
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(rContext,
- op_mask_type(fMaskFormat),
- false,
- this->glyphCount(),
- subRunBounds,
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ op_mask_type(fMaskFormat),
+ false,
+ this->glyphCount(),
+ subRunBounds,
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
@@ -976,24 +977,22 @@
GrPaint grPaint;
SkPMColor4f drawingColor = calculate_colors(sdc, paint, viewMatrix, fMaskFormat, &grPaint);
- GrAtlasTextOp::Geometry* geometry = GrAtlasTextOp::Geometry::MakeForBlob(
- *this,
- drawMatrix,
- drawOrigin,
- SkIRect::MakeEmpty(),
- sk_ref_sp<GrTextBlob>(fBlob),
- drawingColor,
- sdc->arenaAlloc());
+ auto geometry = AtlasTextOp::Geometry::MakeForBlob(*this,
+ drawMatrix,
+ drawOrigin,
+ SkIRect::MakeEmpty(),
+ sk_ref_sp<GrTextBlob>(fBlob),
+ drawingColor,
+ sdc->arenaAlloc());
GrRecordingContext* const rContext = sdc->recordingContext();
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
- rContext,
- op_mask_type(fMaskFormat),
- true,
- this->glyphCount(),
- this->deviceRect(drawMatrix, drawOrigin),
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ op_mask_type(fMaskFormat),
+ true,
+ this->glyphCount(),
+ this->deviceRect(drawMatrix, drawOrigin),
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
#endif // SK_GPU_V1
@@ -1241,7 +1240,7 @@
}
}
-static std::tuple<GrAtlasTextOp::MaskType, uint32_t, bool> calculate_sdf_parameters(
+static std::tuple<AtlasTextOp::MaskType, uint32_t, bool> calculate_sdf_parameters(
const skgpu::v1::SurfaceDrawContext& sdc,
const SkMatrix& drawMatrix,
bool useLCDText,
@@ -1250,7 +1249,7 @@
const SkSurfaceProps& props = sdc.surfaceProps();
bool isBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
bool isLCD = useLCDText && SkPixelGeometryIsH(props.pixelGeometry());
- using MT = GrAtlasTextOp::MaskType;
+ using MT = AtlasTextOp::MaskType;
MT maskType = !isAntiAliased ? MT::kAliasedDistanceField
: isLCD ? (isBGR ? MT::kLCDBGRDistanceField
: MT::kLCDDistanceField)
@@ -1288,27 +1287,25 @@
auto [maskType, DFGPFlags, useGammaCorrectDistanceTable] =
calculate_sdf_parameters(*sdc, drawMatrix, fUseLCDText, fAntiAliased);
- GrAtlasTextOp::Geometry* geometry = GrAtlasTextOp::Geometry::MakeForBlob(
- *this,
- drawMatrix,
- drawOrigin,
- SkIRect::MakeEmpty(),
- sk_ref_sp<GrTextBlob>(fBlob),
- drawingColor,
- sdc->arenaAlloc());
+ auto geometry = AtlasTextOp::Geometry::MakeForBlob(*this,
+ drawMatrix,
+ drawOrigin,
+ SkIRect::MakeEmpty(),
+ sk_ref_sp<GrTextBlob>(fBlob),
+ drawingColor,
+ sdc->arenaAlloc());
GrRecordingContext* const rContext = sdc->recordingContext();
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
- rContext,
- maskType,
- true,
- this->glyphCount(),
- this->deviceRect(drawMatrix, drawOrigin),
- SkPaintPriv::ComputeLuminanceColor(paint),
- useGammaCorrectDistanceTable,
- DFGPFlags,
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ maskType,
+ true,
+ this->glyphCount(),
+ this->deviceRect(drawMatrix, drawOrigin),
+ SkPaintPriv::ComputeLuminanceColor(paint),
+ useGammaCorrectDistanceTable,
+ DFGPFlags,
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
@@ -1713,7 +1710,7 @@
#if SK_GPU_V1
// Space for geometry
- alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+ alignas(alignof(AtlasTextOp::Geometry)) char fGeom[sizeof(AtlasTextOp::Geometry)];
#endif
// The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
@@ -1831,7 +1828,7 @@
GrRecordingContext* const rContext = sdc->recordingContext();
- GrAtlasTextOp::Geometry* geometry = new ((void*)fGeom) GrAtlasTextOp::Geometry{
+ auto geometry = new ((void*)fGeom) AtlasTextOp::Geometry{
*this,
drawMatrix,
drawOrigin,
@@ -1841,13 +1838,13 @@
drawingColor
};
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(rContext,
- op_mask_type(fMaskFormat),
- false,
- this->glyphCount(),
- fGlyphDeviceBounds,
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ op_mask_type(fMaskFormat),
+ false,
+ this->glyphCount(),
+ fGlyphDeviceBounds,
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
@@ -1965,7 +1962,7 @@
#if SK_GPU_V1
// Space for geometry
- alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+ alignas(alignof(AtlasTextOp::Geometry)) char fGeom[sizeof(AtlasTextOp::Geometry)];
#endif
// The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
@@ -2028,7 +2025,7 @@
// We can clip geometrically using clipRect and ignore clip if we're not using SDFs or
// transformed glyphs, and we have an axis-aligned rectangular non-AA clip.
- GrAtlasTextOp::Geometry* geometry = new ((void*)fGeom) GrAtlasTextOp::Geometry{
+ auto geometry = new ((void*)fGeom) AtlasTextOp::Geometry{
*this,
drawMatrix,
drawOrigin,
@@ -2039,14 +2036,13 @@
};
GrRecordingContext* rContext = sdc->recordingContext();
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
- rContext,
- op_mask_type(fMaskFormat),
- true,
- this->glyphCount(),
- this->deviceRect(drawMatrix, drawOrigin),
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ op_mask_type(fMaskFormat),
+ true,
+ this->glyphCount(),
+ this->deviceRect(drawMatrix, drawOrigin),
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
#endif // SK_GPU_V1
@@ -2193,7 +2189,7 @@
#if SK_GPU_V1
// Space for geometry
- alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+ alignas(alignof(AtlasTextOp::Geometry)) char fGeom[sizeof(AtlasTextOp::Geometry)];
#endif
// The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
@@ -2274,7 +2270,7 @@
auto [maskType, DFGPFlags, useGammaCorrectDistanceTable] =
calculate_sdf_parameters(*sdc, drawMatrix, fUseLCDText, fAntiAliased);
- GrAtlasTextOp::Geometry* geometry = new ((void*)fGeom) GrAtlasTextOp::Geometry {
+ auto geometry = new ((void*)fGeom) AtlasTextOp::Geometry {
*this,
drawMatrix,
drawOrigin,
@@ -2285,17 +2281,16 @@
};
GrRecordingContext* rContext = sdc->recordingContext();
- GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
- rContext,
- maskType,
- true,
- this->glyphCount(),
- this->deviceRect(drawMatrix, drawOrigin),
- SkPaintPriv::ComputeLuminanceColor(paint),
- useGammaCorrectDistanceTable,
- DFGPFlags,
- geometry,
- std::move(grPaint));
+ GrOp::Owner op = GrOp::Make<AtlasTextOp>(rContext,
+ maskType,
+ true,
+ this->glyphCount(),
+ this->deviceRect(drawMatrix, drawOrigin),
+ SkPaintPriv::ComputeLuminanceColor(paint),
+ useGammaCorrectDistanceTable,
+ DFGPFlags,
+ geometry,
+ std::move(grPaint));
return {clip, std::move(op)};
}
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index de9dbcf..c21d2af 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -28,7 +28,6 @@
#endif
class GrAtlasManager;
-class GrAtlasTextOp;
class GrDeferredUploadTarget;
class GrGlyph;
class GrMeshDrawTarget;
@@ -43,7 +42,7 @@
namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
// -- GrAtlasSubRun --------------------------------------------------------------------------------
-// GrAtlasSubRun is the API that GrAtlasTextOp uses to generate vertex data for drawing.
+// GrAtlasSubRun is the API that AtlasTextOp uses to generate vertex data for drawing.
// There are three different ways GrAtlasSubRun is specialized.
// * DirectMaskSubRun - this is by far the most common type of SubRun. The mask pixels are
// in 1:1 correspondence with the pixels on the device. The destination rectangles in this
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index ca47778..2709c3d 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -30,7 +30,7 @@
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrXferProcessor.h"
-#include "src/gpu/ops/GrAtlasTextOp.h"
+#include "src/gpu/ops/AtlasTextOp.h"
#include "src/gpu/ops/GrDrawOp.h"
#include "src/gpu/ops/GrOp.h"
#include "src/gpu/text/GrAtlasManager.h"
@@ -189,7 +189,7 @@
#if SK_GPU_V1
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
-// This test verifies that the GrAtlasTextOp::onPrepare method correctly handles a failure
+// This test verifies that the AtlasTextOp::onPrepare method correctly handles a failure
// when allocating an atlas page.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo) {
@@ -211,13 +211,14 @@
const char* text = "a";
SkSimpleMatrixProvider matrixProvider(SkMatrix::I());
- GrOp::Owner op = GrAtlasTextOp::CreateOpTestingOnly(sdc.get(), paint, font, matrixProvider,
- text, 16, 16);
+ GrOp::Owner op = skgpu::v1::AtlasTextOp::CreateOpTestingOnly(sdc.get(), paint,
+ font, matrixProvider,
+ text, 16, 16);
if (!op) {
return;
}
- GrAtlasTextOp* atlasTextOp = (GrAtlasTextOp*)op.get();
+ auto atlasTextOp = (skgpu::v1::AtlasTextOp*)op.get();
atlasTextOp->finalize(*dContext->priv().caps(), nullptr, GrClampType::kAuto);
TestingUploadTarget uploadTarget;
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 054111a..1d96c03 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -45,6 +45,7 @@
DRAW_OP_TEST_EXTERN(AAFlatteningConvexPathOp);
DRAW_OP_TEST_EXTERN(AAHairlineOp);
DRAW_OP_TEST_EXTERN(AAStrokeRectOp);
+DRAW_OP_TEST_EXTERN(AtlasTextOp);
DRAW_OP_TEST_EXTERN(ButtCapDashedCircleOp);
DRAW_OP_TEST_EXTERN(CircleOp);
DRAW_OP_TEST_EXTERN(DashOp);
@@ -54,7 +55,6 @@
DRAW_OP_TEST_EXTERN(DIEllipseOp);
DRAW_OP_TEST_EXTERN(EllipseOp);
DRAW_OP_TEST_EXTERN(FillRectOp);
-DRAW_OP_TEST_EXTERN(GrAtlasTextOp);
DRAW_OP_TEST_EXTERN(NonAALatticeOp);
DRAW_OP_TEST_EXTERN(NonAAStrokeRectOp);
DRAW_OP_TEST_EXTERN(RegionOp);
@@ -76,6 +76,7 @@
DRAW_OP_TEST_ENTRY(AAFlatteningConvexPathOp),
DRAW_OP_TEST_ENTRY(AAHairlineOp),
DRAW_OP_TEST_ENTRY(AAStrokeRectOp),
+ DRAW_OP_TEST_ENTRY(AtlasTextOp),
DRAW_OP_TEST_ENTRY(ButtCapDashedCircleOp),
DRAW_OP_TEST_ENTRY(CircleOp),
DRAW_OP_TEST_ENTRY(DashOp),
@@ -85,7 +86,6 @@
DRAW_OP_TEST_ENTRY(DIEllipseOp),
DRAW_OP_TEST_ENTRY(EllipseOp),
DRAW_OP_TEST_ENTRY(FillRectOp),
- DRAW_OP_TEST_ENTRY(GrAtlasTextOp),
DRAW_OP_TEST_ENTRY(NonAALatticeOp),
DRAW_OP_TEST_ENTRY(NonAAStrokeRectOp),
DRAW_OP_TEST_ENTRY(RegionOp),