diff options
78 files changed, 577 insertions, 588 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index d58e5910b0..f924ee070a 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -192,8 +192,8 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); - sk_sp<GrDrawBatch> batch = sk_make_sp<BezierCubicOrConicTestBatch>( - gp, bounds, color, klmEqs, klmSigns[c]); + sk_sp<GrDrawOp> batch = sk_make_sp<BezierCubicOrConicTestBatch>( + gp, bounds, color, klmEqs, klmSigns[c]); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); } @@ -324,7 +324,7 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); @@ -536,7 +536,7 @@ protected: GrPathUtils::QuadUVMatrix DevToUV(pts); - sk_sp<GrDrawBatch> batch(new BezierQuadTestBatch(gp, bounds, color, DevToUV)); + sk_sp<GrDrawOp> batch(new BezierQuadTestBatch(gp, bounds, color, DevToUV)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); } diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index 47e5a73384..b114f49fa4 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -10,7 +10,7 @@ #include "GrContext.h" #include "GrRenderTargetContextPriv.h" #include "SkRRect.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrRRectEffect.h" @@ -87,7 +87,7 @@ protected: SkRect bounds = testBounds; bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index f6a9dae0a5..d70674279c 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -15,7 +15,7 @@ #include "GrRenderTargetContextPriv.h" #include "SkGrPriv.h" #include "SkGradientShader.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrConstColorProcessor.h" @@ -109,7 +109,7 @@ protected: grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix, renderRect, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 880574217d..68aa9d0396 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -183,7 +183,7 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - sk_sp<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000)); + sk_sp<GrDrawOp> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); @@ -222,7 +222,7 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - sk_sp<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff000000)); + sk_sp<GrDrawOp> batch(new PolyBoundsBatch(rect, 0xff000000)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); diff --git a/gm/rrects.cpp b/gm/rrects.cpp index 29e81bd298..268e449319 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -9,7 +9,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrRenderTargetContextPriv.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrRRectEffect.h" #endif @@ -115,7 +115,7 @@ protected: SkRect bounds = rrect.getBounds(); bounds.outset(2.f, 2.f); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index ad192d68eb..e51a9065be 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -16,7 +16,7 @@ #include "SkBitmap.h" #include "SkGr.h" #include "SkGradientShader.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrTextureDomain.h" @@ -127,7 +127,7 @@ protected: const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index dcc8b15952..6b90dad9cc 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -16,7 +16,7 @@ #include "SkBitmap.h" #include "SkGr.h" #include "SkGradientShader.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrRectBatchFactory.h" #include "effects/GrYUVEffect.h" @@ -126,7 +126,7 @@ protected: SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); @@ -242,7 +242,7 @@ protected: SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); grPaint.addColorFragmentProcessor(fp); - sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill( + sk_sp<GrDrawOp> batch(GrRectBatchFactory::CreateNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get()); } diff --git a/gn/gpu.gni b/gn/gpu.gni index 0fb0b53754..cb58a8fb6f 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -253,10 +253,10 @@ skia_gpu_sources = [ "$_src/gpu/batches/GrDefaultPathRenderer.cpp", "$_src/gpu/batches/GrDefaultPathRenderer.h", "$_src/gpu/batches/GrDiscardBatch.h", - "$_src/gpu/batches/GrDrawBatch.cpp", - "$_src/gpu/batches/GrDrawBatch.h", "$_src/gpu/batches/GrDrawAtlasBatch.cpp", "$_src/gpu/batches/GrDrawAtlasBatch.h", + "$_src/gpu/batches/GrDrawOp.cpp", + "$_src/gpu/batches/GrDrawOp.h", "$_src/gpu/batches/GrDrawPathBatch.cpp", "$_src/gpu/batches/GrDrawPathBatch.h", "$_src/gpu/batches/GrDrawVerticesBatch.cpp", diff --git a/include/gpu/GrRenderTargetContext.h b/include/gpu/GrRenderTargetContext.h index 6e46cd90fa..c957c7ad53 100644 --- a/include/gpu/GrRenderTargetContext.h +++ b/include/gpu/GrRenderTargetContext.h @@ -18,8 +18,8 @@ #include "../private/GrRenderTargetProxy.h" class GrClip; -class GrDrawBatch; class GrDrawingManager; +class GrDrawOp; class GrFixedClip; class GrPipelineBuilder; class GrRenderTarget; @@ -451,7 +451,7 @@ private: // This entry point allows the GrTextContext-derived classes to add their batches to // the GrOpList. - void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDrawBatch* batch); + void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDrawOp* batch); GrRenderTargetOpList* getOpList(); diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp index 684db22c12..32e7b1c369 100644 --- a/src/gpu/GrBatchAtlas.cpp +++ b/src/gpu/GrBatchAtlas.cpp @@ -14,8 +14,8 @@ GrBatchAtlas::BatchPlot::BatchPlot(int index, uint64_t genID, int offX, int offY, int width, int height, GrPixelConfig config) - : fLastUpload(GrBatchDrawToken::AlreadyFlushedToken()) - , fLastUse(GrBatchDrawToken::AlreadyFlushedToken()) + : fLastUpload(GrDrawOpUploadToken::AlreadyFlushedToken()) + , fLastUse(GrDrawOpUploadToken::AlreadyFlushedToken()) , fIndex(index) , fGenID(genID) , fID(CreateId(fIndex, fGenID)) @@ -86,7 +86,7 @@ bool GrBatchAtlas::BatchPlot::addSubImage(int width, int height, const void* ima return true; } -void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawBatch::WritePixelsFn& writePixels, +void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixels, GrTexture* texture) { // We should only be issuing uploads if we are in fact dirty SkASSERT(fDirty && fData && texture); @@ -158,7 +158,7 @@ void GrBatchAtlas::processEviction(AtlasID id) { } } -inline void GrBatchAtlas::updatePlot(GrDrawBatch::Target* target, AtlasID* id, BatchPlot* plot) { +inline void GrBatchAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, BatchPlot* plot) { this->makeMRU(plot); // If our most recent upload has already occurred then we have to insert a new @@ -168,8 +168,8 @@ inline void GrBatchAtlas::updatePlot(GrDrawBatch::Target* target, AtlasID* id, B // With c+14 we could move sk_sp into lamba to only ref once. sk_sp<BatchPlot> plotsp(SkRef(plot)); GrTexture* texture = fTexture.get(); - GrBatchDrawToken lastUploadToken = target->addAsapUpload( - [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels) { + GrDrawOpUploadToken lastUploadToken = target->addAsapUpload( + [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) { plotsp->uploadToTexture(writePixels, texture); } ); @@ -178,7 +178,7 @@ inline void GrBatchAtlas::updatePlot(GrDrawBatch::Target* target, AtlasID* id, B *id = plot->id(); } -bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawBatch::Target* target, +bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, int height, const void* image, SkIPoint16* loc) { // We should already have a texture, TODO clean this up SkASSERT(fTexture); @@ -238,8 +238,8 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawBatch::Target* target, // With c+14 we could move sk_sp into lamba to only ref once. sk_sp<BatchPlot> plotsp(SkRef(newPlot.get())); GrTexture* texture = fTexture.get(); - GrBatchDrawToken lastUploadToken = target->addInlineUpload( - [plotsp, texture] (GrDrawBatch::WritePixelsFn& writePixels) { + GrDrawOpUploadToken lastUploadToken = target->addInlineUpload( + [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) { plotsp->uploadToTexture(writePixels, texture); } ); diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h index 7cf15bd336..2019131379 100644 --- a/src/gpu/GrBatchAtlas.h +++ b/src/gpu/GrBatchAtlas.h @@ -13,7 +13,7 @@ #include "SkTDArray.h" #include "SkTInternalLList.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" class GrRectanizer; @@ -50,7 +50,7 @@ public: // NOTE: If the client intends to refer to the atlas, they should immediately call 'setUseToken' // with the currentToken from the batch target, otherwise the next call to addToAtlas might // cause an eviction - bool addToAtlas(AtlasID*, GrDrawBatch::Target*, int width, int height, const void* image, + bool addToAtlas(AtlasID*, GrDrawOp::Target*, int width, int height, const void* image, SkIPoint16* loc); GrTexture* getTexture() const { return fTexture.get(); } @@ -64,7 +64,7 @@ public: } // To ensure the atlas does not evict a given entry, the client must set the last use token - inline void setLastUseToken(AtlasID id, GrBatchDrawToken batchToken) { + inline void setLastUseToken(AtlasID id, GrDrawOpUploadToken batchToken) { SkASSERT(this->hasID(id)); uint32_t index = GetIndexFromID(id); SkASSERT(index < fNumPlots); @@ -123,7 +123,7 @@ public: friend class GrBatchAtlas; }; - void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrBatchDrawToken batchToken) { + void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrDrawOpUploadToken batchToken) { int count = updater.fPlotsToUpdate.count(); for (int i = 0; i < count; i++) { BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]].get(); @@ -166,12 +166,12 @@ private: // we don't need to issue a new upload even if we update the cpu backing store. We use // lastUse to determine when we can evict a plot from the cache, ie if the last use has // already flushed through the gpu then we can reuse the plot. - GrBatchDrawToken lastUploadToken() const { return fLastUpload; } - GrBatchDrawToken lastUseToken() const { return fLastUse; } - void setLastUploadToken(GrBatchDrawToken batchToken) { fLastUpload = batchToken; } - void setLastUseToken(GrBatchDrawToken batchToken) { fLastUse = batchToken; } + GrDrawOpUploadToken lastUploadToken() const { return fLastUpload; } + GrDrawOpUploadToken lastUseToken() const { return fLastUse; } + void setLastUploadToken(GrDrawOpUploadToken batchToken) { fLastUpload = batchToken; } + void setLastUseToken(GrDrawOpUploadToken batchToken) { fLastUse = batchToken; } - void uploadToTexture(GrDrawBatch::WritePixelsFn&, GrTexture* texture); + void uploadToTexture(GrDrawOp::WritePixelsFn&, GrTexture* texture); void resetRects(); private: @@ -192,8 +192,8 @@ private: return generation << 16 | index; } - GrBatchDrawToken fLastUpload; - GrBatchDrawToken fLastUse; + GrDrawOpUploadToken fLastUpload; + GrDrawOpUploadToken fLastUse; const uint32_t fIndex; uint64_t fGenID; @@ -226,7 +226,7 @@ private: return (id >> 16) & 0xffffffffffff; } - inline void updatePlot(GrDrawBatch::Target*, AtlasID*, BatchPlot*); + inline void updatePlot(GrDrawOp::Target*, AtlasID*, BatchPlot*); inline void makeMRU(BatchPlot* plot) { if (fPlotList.head() == plot) { diff --git a/src/gpu/GrBatchFlushState.cpp b/src/gpu/GrBatchFlushState.cpp index 4e51ae4ddd..5bc02bdb83 100644 --- a/src/gpu/GrBatchFlushState.cpp +++ b/src/gpu/GrBatchFlushState.cpp @@ -16,7 +16,7 @@ GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourcePro , fCommandBuffer(nullptr) , fVertexPool(gpu) , fIndexPool(gpu) - , fLastIssuedToken(GrBatchDrawToken::AlreadyFlushedToken()) + , fLastIssuedToken(GrDrawOpUploadToken::AlreadyFlushedToken()) , fLastFlushedToken(0) {} void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount, diff --git a/src/gpu/GrBatchFlushState.h b/src/gpu/GrBatchFlushState.h index 794bc60da4..f075dfb2d2 100644 --- a/src/gpu/GrBatchFlushState.h +++ b/src/gpu/GrBatchFlushState.h @@ -24,7 +24,7 @@ public: /** Inserts an upload to be executed after all batches in the flush prepared their draws but before the draws are executed to the backend 3D API. */ - void addASAPUpload(GrDrawBatch::DeferredUploadFn&& upload) { + void addASAPUpload(GrDrawOp::DeferredUploadFn&& upload) { fAsapUploads.emplace_back(std::move(upload)); } @@ -32,26 +32,26 @@ public: GrResourceProvider* resourceProvider() const { return fResourceProvider; } /** Has the token been flushed to the backend 3D API. */ - bool hasDrawBeenFlushed(GrBatchDrawToken token) const { + bool hasDrawBeenFlushed(GrDrawOpUploadToken token) const { return token.fSequenceNumber <= fLastFlushedToken.fSequenceNumber; } /** Issue a token to an operation that is being enqueued. */ - GrBatchDrawToken issueDrawToken() { - return GrBatchDrawToken(++fLastIssuedToken.fSequenceNumber); + GrDrawOpUploadToken issueDrawToken() { + return GrDrawOpUploadToken(++fLastIssuedToken.fSequenceNumber); } /** Call every time a draw that was issued a token is flushed */ void flushToken() { ++fLastFlushedToken.fSequenceNumber; } /** Gets the next draw token that will be issued. */ - GrBatchDrawToken nextDrawToken() const { - return GrBatchDrawToken(fLastIssuedToken.fSequenceNumber + 1); + GrDrawOpUploadToken nextDrawToken() const { + return GrDrawOpUploadToken(fLastIssuedToken.fSequenceNumber + 1); } /** The last token flushed to all the way to the backend API. */ - GrBatchDrawToken nextTokenToFlush() const { - return GrBatchDrawToken(fLastFlushedToken.fSequenceNumber + 1); + GrDrawOpUploadToken nextTokenToFlush() const { + return GrDrawOpUploadToken(fLastFlushedToken.fSequenceNumber + 1); } void* makeVertexSpace(size_t vertexSize, int vertexCount, @@ -71,8 +71,8 @@ public: fAsapUploads.reset(); } - void doUpload(GrDrawBatch::DeferredUploadFn& upload) { - GrDrawBatch::WritePixelsFn wp = [this] (GrSurface* surface, + void doUpload(GrDrawOp::DeferredUploadFn& upload) { + GrDrawOp::WritePixelsFn wp = [this] (GrSurface* surface, int left, int top, int width, int height, GrPixelConfig config, const void* buffer, size_t rowBytes) -> bool { @@ -98,20 +98,20 @@ public: private: - GrGpu* fGpu; + GrGpu* fGpu; - GrResourceProvider* fResourceProvider; + GrResourceProvider* fResourceProvider; - GrGpuCommandBuffer* fCommandBuffer; + GrGpuCommandBuffer* fCommandBuffer; - GrVertexBufferAllocPool fVertexPool; - GrIndexBufferAllocPool fIndexPool; + GrVertexBufferAllocPool fVertexPool; + GrIndexBufferAllocPool fIndexPool; - SkSTArray<4, GrDrawBatch::DeferredUploadFn> fAsapUploads; + SkSTArray<4, GrDrawOp::DeferredUploadFn> fAsapUploads; - GrBatchDrawToken fLastIssuedToken; + GrDrawOpUploadToken fLastIssuedToken; - GrBatchDrawToken fLastFlushedToken; + GrDrawOpUploadToken fLastFlushedToken; }; /** @@ -130,22 +130,22 @@ private: * upload must occur before. The upload will then occur between the draw that requires the new * data but after the token that requires the old data. * - * TODO: Currently the token/upload interface is spread over GrDrawBatch, GrVertexBatch, - * GrDrawBatch::Target, and GrVertexBatch::Target. However, the interface at the GrDrawBatch + * TODO: Currently the token/upload interface is spread over GrDrawOp, GrVertexBatch, + * GrDrawOp::Target, and GrVertexBatch::Target. However, the interface at the GrDrawOp * level is not complete and isn't useful. We should push it down to GrVertexBatch until it - * is required at the GrDrawBatch level. + * is required at the GrDrawOp level. */ /** - * GrDrawBatch instances use this object to allocate space for their geometry and to issue the draws + * GrDrawOp instances use this object to allocate space for their geometry and to issue the draws * that render their batch. */ -class GrDrawBatch::Target { +class GrDrawOp::Target { public: - Target(GrBatchFlushState* state, GrDrawBatch* batch) : fState(state), fBatch(batch) {} + Target(GrBatchFlushState* state, GrDrawOp* batch) : fState(state), fBatch(batch) {} /** Returns the token of the draw that this upload will occur before. */ - GrBatchDrawToken addInlineUpload(DeferredUploadFn&& upload) { + GrDrawOpUploadToken addInlineUpload(DeferredUploadFn&& upload) { fBatch->fInlineUploads.emplace_back(std::move(upload), fState->nextDrawToken()); return fBatch->fInlineUploads.back().fUploadBeforeToken; } @@ -153,36 +153,36 @@ public: /** Returns the token of the draw that this upload will occur before. Since ASAP uploads are done first during a flush, this will be the first token since the most recent flush. */ - GrBatchDrawToken addAsapUpload(DeferredUploadFn&& upload) { + GrDrawOpUploadToken addAsapUpload(DeferredUploadFn&& upload) { fState->addASAPUpload(std::move(upload)); return fState->nextTokenToFlush(); } - bool hasDrawBeenFlushed(GrBatchDrawToken token) const { + bool hasDrawBeenFlushed(GrDrawOpUploadToken token) const { return fState->hasDrawBeenFlushed(token); } /** Gets the next draw token that will be issued by this target. This can be used by a batch to record that the next draw it issues will use a resource (e.g. texture) while preparing that draw. */ - GrBatchDrawToken nextDrawToken() const { return fState->nextDrawToken(); } + GrDrawOpUploadToken nextDrawToken() const { return fState->nextDrawToken(); } const GrCaps& caps() const { return fState->caps(); } GrResourceProvider* resourceProvider() const { return fState->resourceProvider(); } protected: - GrDrawBatch* batch() { return fBatch; } + GrDrawOp* batch() { return fBatch; } GrBatchFlushState* state() { return fState; } private: GrBatchFlushState* fState; - GrDrawBatch* fBatch; + GrDrawOp* fBatch; }; -/** Extension of GrDrawBatch::Target for use by GrVertexBatch. Adds the ability to create vertex +/** Extension of GrDrawOp::Target for use by GrVertexBatch. Adds the ability to create vertex draws. */ -class GrVertexBatch::Target : public GrDrawBatch::Target { +class GrVertexBatch::Target : public GrDrawOp::Target { public: Target(GrBatchFlushState* state, GrVertexBatch* batch) : INHERITED(state, batch) {} @@ -205,7 +205,7 @@ public: private: GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batch()); } - typedef GrDrawBatch::Target INHERITED; + typedef GrDrawOp::Target INHERITED; }; #endif diff --git a/src/gpu/GrBatchTest.cpp b/src/gpu/GrBatchTest.cpp index fe320a268a..40a88b7538 100644 --- a/src/gpu/GrBatchTest.cpp +++ b/src/gpu/GrBatchTest.cpp @@ -51,7 +51,7 @@ static BatchTestFunc gTestBatches[] = { DRAW_BATCH_TEST_ENTRY(VerticesBatch) }; -GrDrawBatch* GrRandomDrawBatch(SkRandom* random, GrContext* context) { +GrDrawOp* GrRandomDrawBatch(SkRandom* random, GrContext* context) { uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gTestBatches))); BatchTestFunc func = gTestBatches[index]; return (*func)(random, context); diff --git a/src/gpu/GrBatchTest.h b/src/gpu/GrBatchTest.h index c6cfa0d9c7..5d7fa634b5 100644 --- a/src/gpu/GrBatchTest.h +++ b/src/gpu/GrBatchTest.h @@ -12,7 +12,7 @@ #ifdef GR_TEST_UTILS -class GrDrawBatch; +class GrDrawOp; class GrContext; class SkRandom; @@ -23,17 +23,17 @@ class SkRandom; // Batches should define test functions using DRAW_BATCH_TEST_DEFINE. The other macros defined // below are used exclusively by the test harness. -typedef GrDrawBatch* (*BatchTestFunc)(SkRandom* random, GrContext* context); +typedef GrDrawOp* (*BatchTestFunc)(SkRandom* random, GrContext* context); #define DRAW_BATCH_TEST_DEFINE(Batch) \ - GrDrawBatch* Batch##__Test(SkRandom* random, GrContext* context) + GrDrawOp* Batch##__Test(SkRandom* random, GrContext* context) #define DRAW_BATCH_TEST_EXTERN(Batch) \ - extern GrDrawBatch* Batch##__Test(SkRandom*, GrContext* context); + extern GrDrawOp* Batch##__Test(SkRandom*, GrContext* context); #define DRAW_BATCH_TEST_ENTRY(Batch) \ Batch##__Test #define DRAW_BATCH_TEST_FRIEND(Batch) \ - friend GrDrawBatch* Batch##__Test(SkRandom* random, GrContext* context); + friend GrDrawOp* Batch##__Test(SkRandom* random, GrContext* context); -GrDrawBatch* GrRandomDrawBatch(SkRandom*, GrContext*); +GrDrawOp* GrRandomDrawBatch(SkRandom*, GrContext*); #endif #endif diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h index f8c938ba64..3bb00711fb 100644 --- a/src/gpu/GrGpuCommandBuffer.h +++ b/src/gpu/GrGpuCommandBuffer.h @@ -9,7 +9,7 @@ #define GrGpuCommandBuffer_DEFINED #include "GrColor.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" class GrBatchFlushState; class GrFixedClip; @@ -73,7 +73,7 @@ public: const SkRect& bounds); // Performs an upload of vertex data in the middle of a set of a set of draws - virtual void inlineUpload(GrBatchFlushState* state, GrDrawBatch::DeferredUploadFn& upload) = 0; + virtual void inlineUpload(GrBatchFlushState* state, GrDrawOp::DeferredUploadFn& upload) = 0; /** * Clear the passed in render target. Ignores the draw state and clip. diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index b5fa7fd36c..4adccf98fb 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -607,9 +607,9 @@ public: SkScalar fSweepAngleRadians; bool fUseCenter; }; - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, SkPoint center, - SkScalar radius, const GrStyle& style, - const ArcParams* arcParams = nullptr) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, SkPoint center, + SkScalar radius, const GrStyle& style, + const ArcParams* arcParams = nullptr) { SkASSERT(circle_stays_circle(viewMatrix)); const SkStrokeRec& stroke = style.strokeRec(); if (style.hasPathEffect()) { @@ -1151,8 +1151,8 @@ private: class EllipseBatch : public GrVertexBatch { public: DEFINE_OP_CLASS_ID - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& ellipse, - const SkStrokeRec& stroke) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& ellipse, + const SkStrokeRec& stroke) { SkASSERT(viewMatrix.rectStaysRect()); // do any matrix crunching before we reset the draw state for device coords @@ -1383,10 +1383,10 @@ class DIEllipseBatch : public GrVertexBatch { public: DEFINE_OP_CLASS_ID - static GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& ellipse, - const SkStrokeRec& stroke) { + static GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& ellipse, + const SkStrokeRec& stroke) { SkPoint center = SkPoint::Make(ellipse.centerX(), ellipse.centerY()); SkScalar xRadius = SkScalarHalf(ellipse.width()); SkScalar yRadius = SkScalarHalf(ellipse.height()); @@ -2087,9 +2087,9 @@ public: // If devStrokeWidths values are <= 0 indicates then fill only. Otherwise, strokeOnly indicates // whether the rrect is only stroked or stroked and filled. - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& devRect, - float devXRadius, float devYRadius, SkVector devStrokeWidths, - bool strokeOnly) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& devRect, + float devXRadius, float devYRadius, SkVector devStrokeWidths, + bool strokeOnly) { SkASSERT(devXRadius > 0.5); SkASSERT(devYRadius > 0.5); SkASSERT((devStrokeWidths.fX > 0) == (devStrokeWidths.fY > 0)); @@ -2312,11 +2312,11 @@ private: typedef GrVertexBatch INHERITED; }; -static GrDrawBatch* create_rrect_batch(GrColor color, - bool needsDistance, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - const SkStrokeRec& stroke) { +static GrDrawOp* create_rrect_batch(GrColor color, + bool needsDistance, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + const SkStrokeRec& stroke) { SkASSERT(viewMatrix.rectStaysRect()); SkASSERT(rrect.isSimple()); SkASSERT(!rrect.isOval()); @@ -2384,12 +2384,12 @@ static GrDrawBatch* create_rrect_batch(GrColor color, } } -GrDrawBatch* GrOvalRenderer::CreateRRectBatch(GrColor color, - bool needsDistance, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps) { +GrDrawOp* GrOvalRenderer::CreateRRectBatch(GrColor color, + bool needsDistance, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps) { if (rrect.isOval()) { return CreateOvalBatch(color, viewMatrix, rrect.getBounds(), stroke, shaderCaps); } @@ -2403,11 +2403,11 @@ GrDrawBatch* GrOvalRenderer::CreateRRectBatch(GrColor color, /////////////////////////////////////////////////////////////////////////////// -GrDrawBatch* GrOvalRenderer::CreateOvalBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& oval, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps) { +GrDrawOp* GrOvalRenderer::CreateOvalBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& oval, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps) { // we can draw circles SkScalar width = oval.width(); if (SkScalarNearlyEqual(width, oval.height()) && circle_stays_circle(viewMatrix)) { @@ -2431,13 +2431,13 @@ GrDrawBatch* GrOvalRenderer::CreateOvalBatch(GrColor color, /////////////////////////////////////////////////////////////////////////////// -GrDrawBatch* GrOvalRenderer::CreateArcBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& oval, - SkScalar startAngle, SkScalar sweepAngle, - bool useCenter, - const GrStyle& style, - const GrShaderCaps* shaderCaps) { +GrDrawOp* GrOvalRenderer::CreateArcBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& oval, + SkScalar startAngle, SkScalar sweepAngle, + bool useCenter, + const GrStyle& style, + const GrShaderCaps* shaderCaps) { SkASSERT(!oval.isEmpty()); SkASSERT(sweepAngle); SkScalar width = oval.width(); @@ -2483,8 +2483,8 @@ DRAW_BATCH_TEST_DEFINE(CircleBatch) { arcParamsTmp.fUseCenter = random->nextBool(); arcParams = &arcParamsTmp; } - GrDrawBatch* batch = CircleBatch::Create(color, viewMatrix, center, radius, - GrStyle(stroke, nullptr), arcParams); + GrDrawOp* batch = CircleBatch::Create(color, viewMatrix, center, radius, + GrStyle(stroke, nullptr), arcParams); if (batch) { return batch; } diff --git a/src/gpu/GrOvalRenderer.h b/src/gpu/GrOvalRenderer.h index 804216ac0e..21144bd4f1 100644 --- a/src/gpu/GrOvalRenderer.h +++ b/src/gpu/GrOvalRenderer.h @@ -10,7 +10,7 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class GrShaderCaps; class GrStyle; class SkMatrix; @@ -23,26 +23,26 @@ class SkStrokeRec; */ class GrOvalRenderer { public: - static GrDrawBatch* CreateOvalBatch(GrColor, - const SkMatrix& viewMatrix, - const SkRect& oval, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps); - static GrDrawBatch* CreateRRectBatch(GrColor, - bool needsDistance, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps); + static GrDrawOp* CreateOvalBatch(GrColor, + const SkMatrix& viewMatrix, + const SkRect& oval, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps); + static GrDrawOp* CreateRRectBatch(GrColor, + bool needsDistance, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps); - static GrDrawBatch* CreateArcBatch(GrColor, - const SkMatrix& viewMatrix, - const SkRect& oval, - SkScalar startAngle, - SkScalar sweepAngle, - bool useCenter, - const GrStyle&, - const GrShaderCaps* shaderCaps); + static GrDrawOp* CreateArcBatch(GrColor, + const SkMatrix& viewMatrix, + const SkRect& oval, + SkScalar startAngle, + SkScalar sweepAngle, + bool useCenter, + const GrStyle&, + const GrShaderCaps* shaderCaps); }; #endif // GrOvalRenderer_DEFINED diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 1bff9c6923..fcff2adafd 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -22,7 +22,7 @@ #include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrSimpleTextureEffect.h" -class GrDrawBatch; +class GrDrawOp; class GrCaps; class GrPaint; class GrTexture; @@ -294,7 +294,7 @@ public: /////////////////////////////////////////////////////////////////////////// - bool usePLSDstRead(const GrDrawBatch* batch) const; + bool usePLSDstRead(const GrDrawOp* batch) const; private: // Some of the auto restore objects assume that no effects are removed during their lifetime. diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp index 183a42fb33..76e13b60d7 100644 --- a/src/gpu/GrProcOptInfo.cpp +++ b/src/gpu/GrProcOptInfo.cpp @@ -9,7 +9,7 @@ #include "GrGeometryProcessor.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" void GrProcOptInfo::calcWithInitialValues(const GrFragmentProcessor * const processors[], int cnt, diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h index 87e7cd9c69..1853212b69 100644 --- a/src/gpu/GrProcOptInfo.h +++ b/src/gpu/GrProcOptInfo.h @@ -11,7 +11,7 @@ #include "GrColor.h" #include "GrInvariantOutput.h" -class GrDrawBatch; +class GrDrawOp; class GrFragmentProcessor; class GrPrimitiveProcessor; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index f6645e329b..2cd08e63f7 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -420,7 +420,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip, return true; } - sk_sp<GrDrawBatch> batch; + sk_sp<GrDrawOp> batch; bool useHWAA; if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) { @@ -551,7 +551,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip, bool useHWAA; bool snapToPixelCenters = false; - sk_sp<GrDrawBatch> batch; + sk_sp<GrDrawOp> batch; GrColor color = paint.getColor(); if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { @@ -688,9 +688,9 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip, if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) { InstancedRendering* ir = this->getOpList()->instancedRendering(); - sk_sp<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), - croppedLocalRect, paint.isAntiAlias(), - fInstancedPipelineInfo, &useHWAA)); + sk_sp<GrDrawOp> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), + croppedLocalRect, paint.isAntiAlias(), + fInstancedPipelineInfo, &useHWAA)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -705,10 +705,10 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip, } if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { - sk_sp<GrDrawBatch> batch(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), - viewMatrix, - croppedRect, - croppedLocalRect)); + sk_sp<GrDrawOp> batch(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), + viewMatrix, + croppedRect, + croppedLocalRect)); GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->drawBatch(pipelineBuilder, clip, batch.get()); return; @@ -747,9 +747,9 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip, if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) { InstancedRendering* ir = this->getOpList()->instancedRendering(); - sk_sp<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), - localMatrix, paint.isAntiAlias(), - fInstancedPipelineInfo, &useHWAA)); + sk_sp<GrDrawOp> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), + localMatrix, paint.isAntiAlias(), + fInstancedPipelineInfo, &useHWAA)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -764,8 +764,8 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip, } if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { - sk_sp<GrDrawBatch> batch(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, - localMatrix, croppedRect)); + sk_sp<GrDrawOp> batch(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, + localMatrix, croppedRect)); GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); return; @@ -811,10 +811,10 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip, viewMatrix.mapRect(&bounds); - sk_sp<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(), - primitiveType, viewMatrix, positions, - vertexCount, indices, indexCount, - colors, texCoords, bounds)); + sk_sp<GrDrawOp> batch(new GrDrawVerticesBatch(paint.getColor(), + primitiveType, viewMatrix, positions, + vertexCount, indices, indexCount, + colors, texCoords, bounds)); GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -836,8 +836,8 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip, AutoCheckFlush acf(fDrawingManager); - sk_sp<GrDrawBatch> batch(new GrDrawAtlasBatch(paint.getColor(), viewMatrix, spriteCount, - xform, texRect, colors)); + sk_sp<GrDrawOp> batch(new GrDrawAtlasBatch(paint.getColor(), viewMatrix, spriteCount, + xform, texRect, colors)); GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -880,9 +880,9 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip, if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() && stroke.isFillStyle()) { InstancedRendering* ir = this->getOpList()->instancedRendering(); - sk_sp<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(), - paint.isAntiAlias(), fInstancedPipelineInfo, - &useHWAA)); + sk_sp<GrDrawOp> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(), + paint.isAntiAlias(), fInstancedPipelineInfo, + &useHWAA)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get()); @@ -892,12 +892,12 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip, if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); - sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.getColor(), - paint.usesDistanceVectorField(), - viewMatrix, - rrect, - stroke, - shaderCaps)); + sk_sp<GrDrawOp> batch(GrOvalRenderer::CreateRRectBatch(paint.getColor(), + paint.usesDistanceVectorField(), + viewMatrix, + rrect, + stroke, + shaderCaps)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get()); @@ -937,9 +937,9 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip, //if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() && // stroke.isFillStyle()) { // InstancedRendering* ir = this->getOpList()->instancedRendering(); - // SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(), - // paint.isAntiAlias(), fInstancedPipelineInfo, - // &useHWAA)); + // SkAutoTUnref<GrDrawOp> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(), + // paint.isAntiAlias(), fInstancedPipelineInfo, + // &useHWAA)); // if (batch) { // GrPipelineBuilder pipelineBuilder(paint, useHWAA); // this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch); @@ -949,13 +949,12 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip, if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); - sk_sp<GrDrawBatch> batch(CreateShadowRRectBatch( - paint.getColor(), - viewMatrix, - rrect, - blurRadius, - stroke, - shaderCaps)); + sk_sp<GrDrawOp> batch(CreateShadowRRectBatch(paint.getColor(), + viewMatrix, + rrect, + blurRadius, + stroke, + shaderCaps)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -982,9 +981,9 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip, if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) { bool useHWAA; InstancedRendering* ir = this->getOpList()->instancedRendering(); - sk_sp<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, viewMatrix, - paintIn.getColor(), paintIn.isAntiAlias(), - fInstancedPipelineInfo, &useHWAA)); + sk_sp<GrDrawOp> batch(ir->recordDRRect(origOuter, origInner, viewMatrix, + paintIn.getColor(), paintIn.isAntiAlias(), + fInstancedPipelineInfo, &useHWAA)); if (batch) { GrPipelineBuilder pipelineBuilder(paintIn, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1095,7 +1094,7 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip, return this->drawPath(clip, paint, viewMatrix, path, style); } - sk_sp<GrDrawBatch> batch(GrRegionBatch::Create(paint.getColor(), viewMatrix, region)); + sk_sp<GrDrawOp> batch(GrRegionBatch::Create(paint.getColor(), viewMatrix, region)); GrPipelineBuilder pipelineBuilder(paint, false); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); } @@ -1123,9 +1122,9 @@ void GrRenderTargetContext::drawOval(const GrClip& clip, if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() && stroke.isFillStyle()) { InstancedRendering* ir = this->getOpList()->instancedRendering(); - sk_sp<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.getColor(), - paint.isAntiAlias(), fInstancedPipelineInfo, - &useHWAA)); + sk_sp<GrDrawOp> batch(ir->recordOval(oval, viewMatrix, paint.getColor(), + paint.isAntiAlias(), fInstancedPipelineInfo, + &useHWAA)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1135,11 +1134,11 @@ void GrRenderTargetContext::drawOval(const GrClip& clip, if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); - sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), - viewMatrix, - oval, - stroke, - shaderCaps)); + sk_sp<GrDrawOp> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), + viewMatrix, + oval, + stroke, + shaderCaps)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1164,14 +1163,14 @@ void GrRenderTargetContext::drawArc(const GrClip& clip, bool useHWAA; if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); - sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateArcBatch(paint.getColor(), - viewMatrix, - oval, - startAngle, - sweepAngle, - useCenter, - style, - shaderCaps)); + sk_sp<GrDrawOp> batch(GrOvalRenderer::CreateArcBatch(paint.getColor(), + viewMatrix, + oval, + startAngle, + sweepAngle, + useCenter, + style, + shaderCaps)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1199,9 +1198,9 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip, AutoCheckFlush acf(fDrawingManager); - sk_sp<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), viewMatrix, - imageWidth, imageHeight, - std::move(iter), dst)); + sk_sp<GrDrawOp> batch(GrNinePatch::CreateNonAA(paint.getColor(), viewMatrix, + imageWidth, imageHeight, + std::move(iter), dst)); GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1234,7 +1233,7 @@ void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip, const GrUserStencilSettings* ss, bool useHWAA) { SkASSERT(!useHWAA || this->isStencilBufferMultisampled()); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, localRect, localMatrix)); GrPipelineBuilder pipelineBuilder(paint, useHWAA); @@ -1364,7 +1363,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip, SkRect rects[2]; if (fills_as_nested_rects(viewMatrix, path, rects)) { - sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFillNestedRects( + sk_sp<GrDrawOp> batch(GrRectBatchFactory::CreateAAFillNestedRects( paint.getColor(), viewMatrix, rects)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); @@ -1378,11 +1377,11 @@ void GrRenderTargetContext::drawPath(const GrClip& clip, if (isOval && !path.isInverseFillType()) { const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); - sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), - viewMatrix, - ovalRect, - style.strokeRec(), - shaderCaps)); + sk_sp<GrDrawOp> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), + viewMatrix, + ovalRect, + style.strokeRec(), + shaderCaps)); if (batch) { GrPipelineBuilder pipelineBuilder(paint, useHWAA); this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get()); @@ -1552,7 +1551,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip, } void GrRenderTargetContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip& clip, - GrDrawBatch* batch) { + GrDrawOp* batch) { ASSERT_SINGLE_OWNER RETURN_IF_ABANDONED SkDEBUGCODE(this->validate();) diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h index 8d682ac9a0..ff17505972 100644 --- a/src/gpu/GrRenderTargetContextPriv.h +++ b/src/gpu/GrRenderTargetContextPriv.h @@ -91,7 +91,7 @@ public: } void testingOnly_drawBatch(const GrPaint&, - GrDrawBatch* batch, + GrDrawOp* batch, const GrUserStencilSettings* = nullptr, bool snapToCenters = false); diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index ad20771ccd..98fdc7fc6a 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -31,7 +31,7 @@ #include "batches/GrClearStencilClipBatch.h" #include "batches/GrCopySurfaceBatch.h" #include "batches/GrDiscardBatch.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "batches/GrDrawPathBatch.h" #include "batches/GrRectBatchFactory.h" #include "batches/GrStencilPathBatch.h" @@ -271,7 +271,7 @@ static void batch_bounds(SkRect* bounds, const GrOp* batch) { void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrRenderTargetContext* renderTargetContext, const GrClip& clip, - GrDrawBatch* batch) { + GrDrawOp* batch) { // Setup clip SkRect bounds; batch_bounds(&bounds, batch); diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h index aad141731d..238a048413 100644 --- a/src/gpu/GrRenderTargetOpList.h +++ b/src/gpu/GrRenderTargetOpList.h @@ -16,7 +16,7 @@ #include "GrPathRendering.h" #include "GrXferProcessor.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "SkClipStack.h" #include "SkMatrix.h" @@ -82,7 +82,7 @@ public: */ const GrCaps* caps() const { return fGpu->caps(); } - void drawBatch(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&, GrDrawBatch*); + void drawBatch(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&, GrDrawOp*); void addBatch(sk_sp<GrOp>); diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index b5dc81475b..0eef23ae4b 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -9,7 +9,7 @@ #include "GrCaps.h" #include "GrContext.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "GrRenderTargetContext.h" #include "GrPipelineBuilder.h" #include "GrShape.h" @@ -194,8 +194,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture, maskMatrix, GrSamplerParams::kNone_FilterMode)); - sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), - SkMatrix::I(), - dstRect, nullptr, &invert)); + sk_sp<GrDrawOp> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), SkMatrix::I(), + dstRect, nullptr, &invert)); renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get()); } diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 55aae87fa3..e978ec4603 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -67,9 +67,9 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetCo const SkMatrix& viewMatrix, const SkRect& rect, const SkMatrix& localMatrix) { - sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), - viewMatrix, rect, - nullptr, &localMatrix)); + sk_sp<GrDrawOp> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), + viewMatrix, rect, + nullptr, &localMatrix)); GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint)); pipelineBuilder.setUserStencil(&userStencilSettings); diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp index 8f100503e6..6c01901687 100644 --- a/src/gpu/batches/GrAAConvexPathRenderer.cpp +++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp @@ -1000,8 +1000,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { SkPath path; args.fShape->asPath(&path); - sk_sp<GrDrawBatch> batch(new AAConvexPathBatch(args.fPaint->getColor(), - *args.fViewMatrix, path)); + sk_sp<GrDrawOp> batch(new AAConvexPathBatch(args.fPaint->getColor(), *args.fViewMatrix, path)); GrPipelineBuilder pipelineBuilder(*args.fPaint); pipelineBuilder.setUserStencil(args.fUserStencilSettings); diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp index 8ece0c9db6..d56254d2d7 100644 --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp @@ -417,7 +417,7 @@ private: return true; } - void writePathVertices(GrDrawBatch::Target* target, + void writePathVertices(GrDrawOp::Target* target, GrBatchAtlas* atlas, intptr_t offset, GrColor color, @@ -540,11 +540,11 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { } } - sk_sp<GrDrawBatch> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(), - *args.fShape, - args.fAntiAlias, *args.fViewMatrix, - fAtlas.get(), &fShapeCache, &fShapeList, - args.fGammaCorrect)); + sk_sp<GrDrawOp> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(), + *args.fShape, + args.fAntiAlias, *args.fViewMatrix, + fAtlas.get(), &fShapeCache, &fShapeList, + args.fGammaCorrect)); GrPipelineBuilder pipelineBuilder(*args.fPaint); pipelineBuilder.setUserStencil(args.fUserStencilSettings); diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp index c8804daacf..042b3745ac 100644 --- a/src/gpu/batches/GrAAFillRectBatch.cpp +++ b/src/gpu/batches/GrAAFillRectBatch.cpp @@ -344,34 +344,34 @@ private: namespace GrAAFillRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& devRect) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& devRect) { return new AAFillRectBatch(color, viewMatrix, rect, devRect, nullptr); } -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkMatrix& localMatrix, - const SkRect& rect, - const SkRect& devRect) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkMatrix& localMatrix, + const SkRect& rect, + const SkRect& devRect) { return new AAFillRectBatch(color, viewMatrix, rect, devRect, &localMatrix); } -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkMatrix& localMatrix, - const SkRect& rect) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkMatrix& localMatrix, + const SkRect& rect) { SkRect devRect; viewMatrix.mapRect(&devRect, rect); return Create(color, viewMatrix, localMatrix, rect, devRect); } -GrDrawBatch* CreateWithLocalRect(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& localRect) { +GrDrawOp* CreateWithLocalRect(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& localRect) { SkRect devRect; viewMatrix.mapRect(&devRect, rect); SkMatrix localMatrix; diff --git a/src/gpu/batches/GrAAFillRectBatch.h b/src/gpu/batches/GrAAFillRectBatch.h index b4fa2328aa..62940d2ec2 100644 --- a/src/gpu/batches/GrAAFillRectBatch.h +++ b/src/gpu/batches/GrAAFillRectBatch.h @@ -10,32 +10,32 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class SkMatrix; class GrOp; struct SkRect; namespace GrAAFillRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& devRect); - -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkMatrix& localMatrix, - const SkRect& rect); - -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkMatrix& localMatrix, - const SkRect& rect, - const SkRect& devRect); - -GrDrawBatch* CreateWithLocalRect(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& localRect); +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& devRect); + +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkMatrix& localMatrix, + const SkRect& rect); + +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkMatrix& localMatrix, + const SkRect& rect, + const SkRect& devRect); + +GrDrawOp* CreateWithLocalRect(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& localRect); }; #endif diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp index d7b3d69664..67fa00dc65 100644 --- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp @@ -951,11 +951,11 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const { } } -static GrDrawBatch* create_hairline_batch(GrColor color, - const SkMatrix& viewMatrix, - const SkPath& path, - const GrStyle& style, - const SkIRect& devClipBounds) { +static GrDrawOp* create_hairline_batch(GrColor color, + const SkMatrix& viewMatrix, + const SkPath& path, + const GrStyle& style, + const SkIRect& devClipBounds) { SkScalar hairlineCoverage; uint8_t newCoverage = 0xff; if (GrPathRenderer::IsStrokeHairlineOrEquivalent(style, viewMatrix, &hairlineCoverage)) { @@ -977,9 +977,9 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { SkPath path; args.fShape->asPath(&path); - sk_sp<GrDrawBatch> batch(create_hairline_batch(args.fPaint->getColor(), - *args.fViewMatrix, path, - args.fShape->style(), devClipBounds)); + sk_sp<GrDrawOp> batch(create_hairline_batch(args.fPaint->getColor(), + *args.fViewMatrix, path, + args.fShape->style(), devClipBounds)); GrPipelineBuilder pipelineBuilder(*args.fPaint); pipelineBuilder.setUserStencil(args.fUserStencilSettings); diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp index 10f1d72e9c..a91f7f605c 100644 --- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp @@ -355,11 +355,11 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin(); SkScalar miterLimit = stroke.getMiter(); - sk_sp<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint->getColor(), - *args.fViewMatrix, - path, strokeWidth, - stroke.getStyle(), - join, miterLimit)); + sk_sp<GrDrawOp> batch(new AAFlatteningConvexPathBatch(args.fPaint->getColor(), + *args.fViewMatrix, + path, strokeWidth, + stroke.getStyle(), + join, miterLimit)); GrPipelineBuilder pipelineBuilder(*args.fPaint); pipelineBuilder.setUserStencil(args.fUserStencilSettings); diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp index 8f13adc752..dc93146393 100644 --- a/src/gpu/batches/GrAAStrokeRectBatch.cpp +++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp @@ -132,8 +132,8 @@ public: fMiterStroke = true; } - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, - const SkStrokeRec& stroke) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, + const SkStrokeRec& stroke) { bool isMiter; if (!allowed_stroke(stroke, &isMiter)) { return nullptr; @@ -597,17 +597,17 @@ void AAStrokeRectBatch::generateAAStrokeRectGeometry(void* vertices, namespace GrAAStrokeRectBatch { -GrDrawBatch* CreateFillBetweenRects(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& devOutside, - const SkRect& devInside) { +GrDrawOp* CreateFillBetweenRects(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& devOutside, + const SkRect& devInside) { return new AAStrokeRectBatch(color, viewMatrix, devOutside, devInside); } -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec& stroke) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec& stroke) { return AAStrokeRectBatch::Create(color, viewMatrix, rect, stroke); } diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h index 73020d5e45..f29efb8d80 100644 --- a/src/gpu/batches/GrAAStrokeRectBatch.h +++ b/src/gpu/batches/GrAAStrokeRectBatch.h @@ -10,7 +10,7 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class GrResourceProvider; class SkMatrix; struct SkRect; @@ -18,15 +18,15 @@ class SkStrokeRec; namespace GrAAStrokeRectBatch { -GrDrawBatch* CreateFillBetweenRects(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& devOutside, - const SkRect& devInside); +GrDrawOp* CreateFillBetweenRects(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& devOutside, + const SkRect& devInside); -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec& stroke); +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec& stroke); } diff --git a/src/gpu/batches/GrAnalyticRectBatch.cpp b/src/gpu/batches/GrAnalyticRectBatch.cpp index 5e196cc674..eed11b90db 100644 --- a/src/gpu/batches/GrAnalyticRectBatch.cpp +++ b/src/gpu/batches/GrAnalyticRectBatch.cpp @@ -388,11 +388,11 @@ private: typedef GrVertexBatch INHERITED; }; -GrDrawBatch* GrAnalyticRectBatch::CreateAnalyticRectBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& croppedRect, - const SkRect& bounds) { +GrDrawOp* GrAnalyticRectBatch::CreateAnalyticRectBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& croppedRect, + const SkRect& bounds) { return new AnalyticRectBatch(color, viewMatrix, rect, croppedRect, bounds); } diff --git a/src/gpu/batches/GrAnalyticRectBatch.h b/src/gpu/batches/GrAnalyticRectBatch.h index cdb6118c6e..0c07c2a9c6 100644 --- a/src/gpu/batches/GrAnalyticRectBatch.h +++ b/src/gpu/batches/GrAnalyticRectBatch.h @@ -10,7 +10,7 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class SkMatrix; struct SkRect; @@ -26,11 +26,11 @@ struct SkRect; */ class GrAnalyticRectBatch { public: - static GrDrawBatch* CreateAnalyticRectBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& croppedRect, - const SkRect& bounds); + static GrDrawOp* CreateAnalyticRectBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& croppedRect, + const SkRect& bounds); }; #endif // GrAnalyticRectBatch_DEFINED diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp index d1833d7192..b64f5de957 100644 --- a/src/gpu/batches/GrDashLinePathRenderer.cpp +++ b/src/gpu/batches/GrDashLinePathRenderer.cpp @@ -39,11 +39,11 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { } SkPoint pts[2]; SkAssertResult(args.fShape->asLine(pts, nullptr)); - sk_sp<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fPaint->getColor(), - *args.fViewMatrix, - pts, - aaMode, - args.fShape->style())); + sk_sp<GrDrawOp> batch(GrDashingEffect::CreateDashLineBatch(args.fPaint->getColor(), + *args.fViewMatrix, + pts, + aaMode, + args.fShape->style())); if (!batch) { return false; } diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp index 5faf81a0d1..884c37bf3b 100644 --- a/src/gpu/batches/GrDefaultPathRenderer.cpp +++ b/src/gpu/batches/GrDefaultPathRenderer.cpp @@ -562,7 +562,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget } const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() : viewMatrix; - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr, &localMatrix)); @@ -573,10 +573,9 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get()); } else { - sk_sp<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(), path, - srcSpaceTol, - newCoverage, viewMatrix, - isHairline, devBounds)); + sk_sp<GrDrawOp> batch(new DefaultPathBatch(paint.getColor(), path, srcSpaceTol, + newCoverage, viewMatrix, isHairline, + devBounds)); GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint)); pipelineBuilder.setDrawFace(drawFace[p]); diff --git a/src/gpu/batches/GrDrawBatch.cpp b/src/gpu/batches/GrDrawOp.cpp index b73f7515ec..3abf2ceba1 100644 --- a/src/gpu/batches/GrDrawBatch.cpp +++ b/src/gpu/batches/GrDrawOp.cpp @@ -5,17 +5,17 @@ * found in the LICENSE file. */ -#include "GrDrawBatch.h" +#include "GrDrawOp.h" -GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { } +GrDrawOp::GrDrawOp(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { } -GrDrawBatch::~GrDrawBatch() { +GrDrawOp::~GrDrawOp() { if (fPipelineInstalled) { this->pipeline()->~GrPipeline(); } } -void GrDrawBatch::getPipelineOptimizations(GrPipelineOptimizations* opt) const { +void GrDrawOp::getPipelineOptimizations(GrPipelineOptimizations* opt) const { GrInitInvariantOutput color; GrInitInvariantOutput coverage; this->computePipelineOptimizations(&color, &coverage, &opt->fOverrides); @@ -23,7 +23,7 @@ void GrDrawBatch::getPipelineOptimizations(GrPipelineOptimizations* opt) const { opt->fCoveragePOI.initUsingInvariantOutput(coverage); } -bool GrDrawBatch::installPipeline(const GrPipeline::CreateArgs& args) { +bool GrDrawOp::installPipeline(const GrPipeline::CreateArgs& args) { GrXPOverridesForBatch overrides; void* location = fPipelineStorage.get(); if (!GrPipeline::CreateAt(location, args, &overrides)) { diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawOp.h index 2184552d58..8ad22d9ac3 100644 --- a/src/gpu/batches/GrDrawBatch.h +++ b/src/gpu/batches/GrDrawOp.h @@ -15,49 +15,49 @@ struct GrInitInvariantOutput; /** - * GrDrawBatches are flushed in two phases (preDraw, and draw). In preDraw uploads to GrGpuResources - * and draws are determined and scheduled. They are issued in the draw phase. GrBatchToken is used - * to sequence the uploads relative to each other and to draws. + * GrDrawOps are flushed in two phases (preDraw, and draw). In preDraw uploads to GrGpuResources + * and draws are determined and scheduled. They are issued in the draw phase. GrDrawOpUploadToken is + * used to sequence the uploads relative to each other and to draws. **/ -class GrBatchDrawToken { +class GrDrawOpUploadToken { public: - static GrBatchDrawToken AlreadyFlushedToken() { return GrBatchDrawToken(0); } + static GrDrawOpUploadToken AlreadyFlushedToken() { return GrDrawOpUploadToken(0); } - GrBatchDrawToken(const GrBatchDrawToken& that) : fSequenceNumber(that.fSequenceNumber) {} - GrBatchDrawToken& operator =(const GrBatchDrawToken& that) { + GrDrawOpUploadToken(const GrDrawOpUploadToken& that) : fSequenceNumber(that.fSequenceNumber) {} + GrDrawOpUploadToken& operator =(const GrDrawOpUploadToken& that) { fSequenceNumber = that.fSequenceNumber; return *this; } - bool operator==(const GrBatchDrawToken& that) const { + bool operator==(const GrDrawOpUploadToken& that) const { return fSequenceNumber == that.fSequenceNumber; } - bool operator!=(const GrBatchDrawToken& that) const { return !(*this == that); } + bool operator!=(const GrDrawOpUploadToken& that) const { return !(*this == that); } private: - GrBatchDrawToken(); - explicit GrBatchDrawToken(uint64_t sequenceNumber) : fSequenceNumber(sequenceNumber) {} + GrDrawOpUploadToken(); + explicit GrDrawOpUploadToken(uint64_t sequenceNumber) : fSequenceNumber(sequenceNumber) {} friend class GrBatchFlushState; uint64_t fSequenceNumber; }; /** - * Base class for GrBatches that draw. These batches have a GrPipeline installed by GrOpList. + * Base class for GrOps that draw. These batches have a GrPipeline installed by GrOpList. */ -class GrDrawBatch : public GrOp { +class GrDrawOp : public GrOp { public: /** Method that performs an upload on behalf of a DeferredUploadFn. */ using WritePixelsFn = std::function<bool(GrSurface* texture, int left, int top, int width, int height, GrPixelConfig config, const void* buffer, size_t rowBytes)>; - /** See comments before GrDrawBatch::Target definition on how deferred uploaders work. */ + /** See comments before GrDrawOp::Target definition on how deferred uploaders work. */ using DeferredUploadFn = std::function<void(WritePixelsFn&)>; class Target; - GrDrawBatch(uint32_t classID); - ~GrDrawBatch() override; + GrDrawOp(uint32_t classID); + ~GrDrawOp() override; /** * Fills in a structure informing the XP of overrides to its normal behavior. @@ -125,13 +125,14 @@ private: protected: struct QueuedUpload { - QueuedUpload(DeferredUploadFn&& upload, GrBatchDrawToken token) + QueuedUpload(DeferredUploadFn&& upload, GrDrawOpUploadToken token) : fUpload(std::move(upload)) , fUploadBeforeToken(token) {} DeferredUploadFn fUpload; - GrBatchDrawToken fUploadBeforeToken; + GrDrawOpUploadToken fUploadBeforeToken; }; - SkTArray<QueuedUpload> fInlineUploads; + + SkTArray<QueuedUpload> fInlineUploads; private: SkAlignedSTStorage<1, GrPipeline> fPipelineStorage; diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h index 9de29e2171..6dca9dcd98 100644 --- a/src/gpu/batches/GrDrawPathBatch.h +++ b/src/gpu/batches/GrDrawPathBatch.h @@ -9,7 +9,7 @@ #define GrDrawPathBatch_DEFINED #include "GrBatchFlushState.h" -#include "GrDrawBatch.h" +#include "GrDrawOp.h" #include "GrGpu.h" #include "GrPath.h" #include "GrPathRendering.h" @@ -18,7 +18,7 @@ #include "SkTLList.h" -class GrDrawPathBatchBase : public GrDrawBatch { +class GrDrawPathBatchBase : public GrDrawOp { public: void computePipelineOptimizations(GrInitInvariantOutput* color, GrInitInvariantOutput* coverage, @@ -58,14 +58,14 @@ private: GrStencilSettings fStencilPassSettings; GrXPOverridesForBatch fOverrides; - typedef GrDrawBatch INHERITED; + typedef GrDrawOp INHERITED; }; class GrDrawPathBatch final : public GrDrawPathBatchBase { public: DEFINE_OP_CLASS_ID - static GrDrawBatch* Create(const SkMatrix& viewMatrix, GrColor color, const GrPath* path) { + static GrDrawOp* Create(const SkMatrix& viewMatrix, GrColor color, const GrPath* path) { return new GrDrawPathBatch(viewMatrix, color, path); } @@ -155,9 +155,9 @@ public: SkDEBUGCODE(int fReserveCnt;) }; - static GrDrawBatch* Create(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x, SkScalar y, - GrColor color, GrPathRendering::FillType fill, GrPathRange* range, - const InstanceData* instanceData, const SkRect& bounds) { + static GrDrawOp* Create(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x, SkScalar y, + GrColor color, GrPathRendering::FillType fill, GrPathRange* range, + const InstanceData* instanceData, const SkRect& bounds) { return new GrDrawPathRangeBatch(viewMatrix, scale, x, y, color, fill, range, instanceData, bounds); } diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp index 77d4e6b0bf..1a345c0c5d 100644 --- a/src/gpu/batches/GrMSAAPathRenderer.cpp +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp @@ -658,7 +658,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon } const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() : viewMatrix; - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr, &localMatrix)); diff --git a/src/gpu/batches/GrNinePatch.cpp b/src/gpu/batches/GrNinePatch.cpp index 7ca8d6840a..f9a660125b 100644 --- a/src/gpu/batches/GrNinePatch.cpp +++ b/src/gpu/batches/GrNinePatch.cpp @@ -180,8 +180,8 @@ private: }; namespace GrNinePatch { -GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth, int imageHeight, - std::unique_ptr<SkLatticeIter> iter, const SkRect& dst) { +GrDrawOp* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth, int imageHeight, + std::unique_ptr<SkLatticeIter> iter, const SkRect& dst) { return new GrNonAANinePatchBatch(color, viewMatrix, imageWidth, imageHeight, std::move(iter), dst); } diff --git a/src/gpu/batches/GrNinePatch.h b/src/gpu/batches/GrNinePatch.h index 02664c6449..94551e811a 100644 --- a/src/gpu/batches/GrNinePatch.h +++ b/src/gpu/batches/GrNinePatch.h @@ -11,7 +11,7 @@ #include "GrColor.h" #include "SkCanvas.h" -class GrDrawBatch; +class GrDrawOp; class SkBitmap; class SkLatticeIter; class SkMatrix; @@ -19,8 +19,8 @@ struct SkIRect; struct SkRect; namespace GrNinePatch { -GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth, int imageHeight, - std::unique_ptr<SkLatticeIter> iter, const SkRect& dst); +GrDrawOp* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth, int imageHeight, + std::unique_ptr<SkLatticeIter> iter, const SkRect& dst); }; #endif diff --git a/src/gpu/batches/GrNonAAFillRectBatch.cpp b/src/gpu/batches/GrNonAAFillRectBatch.cpp index 8f45a8f93e..db6499bc84 100644 --- a/src/gpu/batches/GrNonAAFillRectBatch.cpp +++ b/src/gpu/batches/GrNonAAFillRectBatch.cpp @@ -192,11 +192,11 @@ private: namespace GrNonAAFillRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect* localRect, - const SkMatrix* localMatrix) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect* localRect, + const SkMatrix* localMatrix) { return new NonAAFillRectBatch(color, viewMatrix, rect, localRect, localMatrix); } diff --git a/src/gpu/batches/GrNonAAFillRectBatch.h b/src/gpu/batches/GrNonAAFillRectBatch.h index ac28d0fb46..6cf7cc310e 100644 --- a/src/gpu/batches/GrNonAAFillRectBatch.h +++ b/src/gpu/batches/GrNonAAFillRectBatch.h @@ -10,23 +10,23 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class SkMatrix; struct SkRect; namespace GrNonAAFillRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect* localRect, - const SkMatrix* localMatrix); - -GrDrawBatch* CreateWithPerspective(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect* localRect, - const SkMatrix* localMatrix); +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect* localRect, + const SkMatrix* localMatrix); + +GrDrawOp* CreateWithPerspective(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect* localRect, + const SkMatrix* localMatrix); }; diff --git a/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp b/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp index 2dcd3e21b4..dddd23c2df 100644 --- a/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp +++ b/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp @@ -234,11 +234,11 @@ private: namespace GrNonAAFillRectBatch { -GrDrawBatch* CreateWithPerspective(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect* localRect, - const SkMatrix* localMatrix) { +GrDrawOp* CreateWithPerspective(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect* localRect, + const SkMatrix* localMatrix) { return new GrNonAAFillRectPerspectiveBatch(color, viewMatrix, rect, localRect, localMatrix); } diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp index 2cc1a7d22c..9017b8056b 100644 --- a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp +++ b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp @@ -70,8 +70,8 @@ public: coverage->setKnownSingleComponent(0xff); } - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, - const SkStrokeRec& stroke, bool snapToPixelCenters) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, + const SkStrokeRec& stroke, bool snapToPixelCenters) { if (!allowed_stroke(stroke)) { return nullptr; } @@ -189,11 +189,11 @@ private: namespace GrNonAAStrokeRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec& stroke, - bool snapToPixelCenters) { +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec& stroke, + bool snapToPixelCenters) { return NonAAStrokeRectBatch::Create(color, viewMatrix, rect, stroke, snapToPixelCenters); } diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.h b/src/gpu/batches/GrNonAAStrokeRectBatch.h index 4d94337cc0..b05e530397 100644 --- a/src/gpu/batches/GrNonAAStrokeRectBatch.h +++ b/src/gpu/batches/GrNonAAStrokeRectBatch.h @@ -12,18 +12,18 @@ #include "SkTypes.h" -class GrDrawBatch; +class GrDrawOp; struct SkRect; class SkStrokeRec; class SkMatrix; namespace GrNonAAStrokeRectBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec&, - bool snapToPixelCenters); +GrDrawOp* Create(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec&, + bool snapToPixelCenters); } diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp index 924e2a8bc6..1cccc10018 100644 --- a/src/gpu/batches/GrPLSPathRenderer.cpp +++ b/src/gpu/batches/GrPLSPathRenderer.cpp @@ -935,7 +935,7 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { SkPath path; args.fShape->asPath(&path); - sk_sp<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(), path, *args.fViewMatrix)); + sk_sp<GrDrawOp> batch(new PLSPathBatch(args.fPaint->getColor(), path, *args.fViewMatrix)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fRenderTargetContext->mustUseHWAA(*args.fPaint)); diff --git a/src/gpu/batches/GrRectBatchFactory.cpp b/src/gpu/batches/GrRectBatchFactory.cpp index d2ba7f4442..7bef91770c 100644 --- a/src/gpu/batches/GrRectBatchFactory.cpp +++ b/src/gpu/batches/GrRectBatchFactory.cpp @@ -13,9 +13,9 @@ namespace GrRectBatchFactory { -GrDrawBatch* CreateAAFillNestedRects(GrColor color, - const SkMatrix& viewMatrix, - const SkRect rects[2]) { +GrDrawOp* CreateAAFillNestedRects(GrColor color, + const SkMatrix& viewMatrix, + const SkRect rects[2]) { SkASSERT(viewMatrix.rectStaysRect()); SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty()); diff --git a/src/gpu/batches/GrRectBatchFactory.h b/src/gpu/batches/GrRectBatchFactory.h index 5ae1934d49..df1d60f998 100644 --- a/src/gpu/batches/GrRectBatchFactory.h +++ b/src/gpu/batches/GrRectBatchFactory.h @@ -26,11 +26,11 @@ class SkStrokeRec; */ namespace GrRectBatchFactory { -inline GrDrawBatch* CreateNonAAFill(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect* localRect, - const SkMatrix* localMatrix) { +inline GrDrawOp* CreateNonAAFill(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect* localRect, + const SkMatrix* localMatrix) { if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective())) { return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, rect, localRect, localMatrix); @@ -39,11 +39,11 @@ inline GrDrawBatch* CreateNonAAFill(GrColor color, } } -inline GrDrawBatch* CreateAAFill(const GrPaint& paint, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkRect& croppedRect, - const SkRect& devRect) { +inline GrDrawOp* CreateAAFill(const GrPaint& paint, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkRect& croppedRect, + const SkRect& devRect) { if (!paint.usesDistanceVectorField()) { return GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, croppedRect, devRect); } else { @@ -52,33 +52,31 @@ inline GrDrawBatch* CreateAAFill(const GrPaint& paint, } } -inline GrDrawBatch* CreateAAFill(GrColor color, - const SkMatrix& viewMatrix, - const SkMatrix& localMatrix, - const SkRect& rect, - const SkRect& devRect) { +inline GrDrawOp* CreateAAFill(GrColor color, + const SkMatrix& viewMatrix, + const SkMatrix& localMatrix, + const SkRect& rect, + const SkRect& devRect) { return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRect); } -inline GrDrawBatch* CreateNonAAStroke(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec& strokeRec, - bool snapToPixelCenters) { +inline GrDrawOp* CreateNonAAStroke(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec& strokeRec, + bool snapToPixelCenters) { return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeRec, snapToPixelCenters); } -inline GrDrawBatch* CreateAAStroke(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& rect, - const SkStrokeRec& stroke) { +inline GrDrawOp* CreateAAStroke(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& rect, + const SkStrokeRec& stroke) { return GrAAStrokeRectBatch::Create(color, viewMatrix, rect, stroke); } // First rect is outer; second rect is inner -GrDrawBatch* CreateAAFillNestedRects(GrColor, - const SkMatrix& viewMatrix, - const SkRect rects[2]); +GrDrawOp* CreateAAFillNestedRects(GrColor, const SkMatrix& viewMatrix, const SkRect rects[2]); }; diff --git a/src/gpu/batches/GrRegionBatch.cpp b/src/gpu/batches/GrRegionBatch.cpp index e1eaf2802e..d7bef06a68 100644 --- a/src/gpu/batches/GrRegionBatch.cpp +++ b/src/gpu/batches/GrRegionBatch.cpp @@ -160,9 +160,7 @@ private: namespace GrRegionBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRegion& region) { +GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region) { return new RegionBatch(color, viewMatrix, region); } diff --git a/src/gpu/batches/GrRegionBatch.h b/src/gpu/batches/GrRegionBatch.h index d928d0a9cd..b7417e519d 100644 --- a/src/gpu/batches/GrRegionBatch.h +++ b/src/gpu/batches/GrRegionBatch.h @@ -10,15 +10,13 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class SkMatrix; class SkRegion; namespace GrRegionBatch { -GrDrawBatch* Create(GrColor color, - const SkMatrix& viewMatrix, - const SkRegion& region); +GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region); }; diff --git a/src/gpu/batches/GrShadowRRectBatch.cpp b/src/gpu/batches/GrShadowRRectBatch.cpp index 6ae6e62dc1..ba5c629536 100755 --- a/src/gpu/batches/GrShadowRRectBatch.cpp +++ b/src/gpu/batches/GrShadowRRectBatch.cpp @@ -63,8 +63,8 @@ class ShadowCircleBatch : public GrVertexBatch { public: DEFINE_OP_CLASS_ID - static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, SkPoint center, - SkScalar radius, SkScalar blurRadius, const GrStyle& style) { + static GrDrawOp* Create(GrColor color, const SkMatrix& viewMatrix, SkPoint center, + SkScalar radius, SkScalar blurRadius, const GrStyle& style) { SkASSERT(viewMatrix.isSimilarity()); const SkStrokeRec& stroke = style.strokeRec(); if (style.hasPathEffect()) { @@ -833,12 +833,12 @@ private: /////////////////////////////////////////////////////////////////////////////// -static GrDrawBatch* create_shadow_circle_batch(GrColor color, - const SkMatrix& viewMatrix, - const SkRect& oval, - SkScalar blurRadius, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps) { +static GrDrawOp* create_shadow_circle_batch(GrColor color, + const SkMatrix& viewMatrix, + const SkRect& oval, + SkScalar blurRadius, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps) { // we can only draw circles SkScalar width = oval.width(); SkASSERT(SkScalarNearlyEqual(width, oval.height()) && viewMatrix.isSimilarity()); @@ -847,11 +847,11 @@ static GrDrawBatch* create_shadow_circle_batch(GrColor color, blurRadius, GrStyle(stroke, nullptr)); } -static GrDrawBatch* create_shadow_rrect_batch(GrColor color, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - SkScalar blurRadius, - const SkStrokeRec& stroke) { +static GrDrawOp* create_shadow_rrect_batch(GrColor color, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + SkScalar blurRadius, + const SkStrokeRec& stroke) { SkASSERT(viewMatrix.rectStaysRect()); SkASSERT(rrect.isSimple()); SkASSERT(!rrect.isOval()); @@ -908,12 +908,12 @@ static GrDrawBatch* create_shadow_rrect_batch(GrColor color, blurRadius, scaledStroke.fX, isStrokeOnly); } -GrDrawBatch* CreateShadowRRectBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - const SkScalar blurRadius, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps) { +GrDrawOp* CreateShadowRRectBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + const SkScalar blurRadius, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps) { if (rrect.isOval()) { return create_shadow_circle_batch(color, viewMatrix, rrect.getBounds(), blurRadius, stroke, shaderCaps); @@ -946,8 +946,8 @@ DRAW_BATCH_TEST_DEFINE(ShadowCircleBatch) { SkScalar radius = circle.width() / 2.f; SkStrokeRec stroke = GrTest::TestStrokeRec(random); SkScalar blurRadius = random->nextSScalar1() * 72.f; - GrDrawBatch* batch = ShadowCircleBatch::Create(color, viewMatrix, center, radius, - blurRadius, GrStyle(stroke, nullptr)); + GrDrawOp* batch = ShadowCircleBatch::Create(color, viewMatrix, center, radius, + blurRadius, GrStyle(stroke, nullptr)); if (batch) { return batch; } diff --git a/src/gpu/batches/GrShadowRRectBatch.h b/src/gpu/batches/GrShadowRRectBatch.h index 617af3840a..3727e05198 100755 --- a/src/gpu/batches/GrShadowRRectBatch.h +++ b/src/gpu/batches/GrShadowRRectBatch.h @@ -10,17 +10,17 @@ #include "GrColor.h" -class GrDrawBatch; +class GrDrawOp; class GrShaderCaps; class SkMatrix; class SkRRect; class SkStrokeRec; -GrDrawBatch* CreateShadowRRectBatch(GrColor, - const SkMatrix& viewMatrix, - const SkRRect& rrect, - const SkScalar blurRadius, - const SkStrokeRec& stroke, - const GrShaderCaps* shaderCaps); +GrDrawOp* CreateShadowRRectBatch(GrColor, + const SkMatrix& viewMatrix, + const SkRRect& rrect, + const SkScalar blurRadius, + const SkStrokeRec& stroke, + const GrShaderCaps* shaderCaps); #endif diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index d660ab952d..c12f299f34 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -120,7 +120,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { } const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix; - sk_sp<GrDrawBatch> coverBatch( + sk_sp<GrDrawOp> coverBatch( GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), viewM, bounds, nullptr, &invert)); @@ -160,8 +160,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { 0xffff>() ); - sk_sp<GrDrawBatch> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), - path.get())); + sk_sp<GrDrawOp> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), + path.get())); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias()); pipelineBuilder.setUserStencil(&kCoverPass); diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp index 46dd2f751e..eaa0b8436a 100644 --- a/src/gpu/batches/GrTessellatingPathRenderer.cpp +++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp @@ -164,11 +164,11 @@ class TessellatingPathBatch : public GrVertexBatch { public: DEFINE_OP_CLASS_ID - static GrDrawBatch* Create(const GrColor& color, - const GrShape& shape, - const SkMatrix& viewMatrix, - SkIRect devClipBounds, - bool antiAlias) { + static GrDrawOp* Create(const GrColor& color, + const GrShape& shape, + const SkMatrix& viewMatrix, + SkIRect devClipBounds, + bool antiAlias) { return new TessellatingPathBatch(color, shape, viewMatrix, devClipBounds, antiAlias); } @@ -364,11 +364,11 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { args.fClip->getConservativeBounds(args.fRenderTargetContext->worstCaseWidth(), args.fRenderTargetContext->worstCaseHeight(), &clipBoundsI); - sk_sp<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->getColor(), - *args.fShape, - *args.fViewMatrix, - clipBoundsI, - args.fAntiAlias)); + sk_sp<GrDrawOp> batch(TessellatingPathBatch::Create(args.fPaint->getColor(), + *args.fShape, + *args.fViewMatrix, + clipBoundsI, + args.fAntiAlias)); GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fRenderTargetContext->mustUseHWAA(*args.fPaint)); diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp index 14403bfe46..37bdcacc49 100644 --- a/src/gpu/batches/GrVertexBatch.cpp +++ b/src/gpu/batches/GrVertexBatch.cpp @@ -11,7 +11,7 @@ GrVertexBatch::GrVertexBatch(uint32_t classID) : INHERITED(classID) - , fBaseDrawToken(GrBatchDrawToken::AlreadyFlushedToken()) { + , fBaseDrawToken(GrDrawOpUploadToken::AlreadyFlushedToken()) { } void GrVertexBatch::onPrepare(GrBatchFlushState* state) { @@ -70,7 +70,7 @@ void GrVertexBatch::onDraw(GrBatchFlushState* state, const SkRect& bounds) { SkASSERT(fQueuedDraws.empty() || fBaseDrawToken == state->nextTokenToFlush()); for (int currDrawIdx = 0; currDrawIdx < fQueuedDraws.count(); ++currDrawIdx) { - GrBatchDrawToken drawToken = state->nextTokenToFlush(); + GrDrawOpUploadToken drawToken = state->nextTokenToFlush(); while (currUploadIdx < fInlineUploads.count() && fInlineUploads[currUploadIdx].fUploadBeforeToken == drawToken) { state->commandBuffer()->inlineUpload(state, fInlineUploads[currUploadIdx++].fUpload); @@ -104,7 +104,7 @@ void GrVertexBatch::Target::draw(const GrGeometryProcessor* gp, const GrMesh& me } } GrVertexBatch::QueuedDraw& draw = this->vertexBatch()->fQueuedDraws.push_back(); - GrBatchDrawToken token = this->state()->issueDrawToken(); + GrDrawOpUploadToken token = this->state()->issueDrawToken(); draw.fGeometryProcessor.reset(gp); draw.fMeshCnt = 1; if (batch->fQueuedDraws.count() == 1) { diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h index 1159e5ed2a..f5945e2c20 100644 --- a/src/gpu/batches/GrVertexBatch.h +++ b/src/gpu/batches/GrVertexBatch.h @@ -8,7 +8,7 @@ #ifndef GrVertexBatch_DEFINED #define GrVertexBatch_DEFINED -#include "GrDrawBatch.h" +#include "GrDrawOp.h" #include "GrGeometryProcessor.h" #include "GrMesh.h" #include "GrPendingProgramElement.h" @@ -20,7 +20,7 @@ class GrBatchFlushState; /** * Base class for vertex-based GrBatches. */ -class GrVertexBatch : public GrDrawBatch { +class GrVertexBatch : public GrDrawOp { public: class Target; @@ -80,12 +80,12 @@ private: // All draws in all the vertex batches have implicit tokens based on the order they are // enqueued globally across all batches. This is the offset of the first entry in fQueuedDraws. // fQueuedDraws[i]'s token is fBaseDrawToken + i. - GrBatchDrawToken fBaseDrawToken; + GrDrawOpUploadToken fBaseDrawToken; SkSTArray<4, GrMesh> fMeshes; SkSTArray<4, QueuedDraw, true> fQueuedDraws; - typedef GrDrawBatch INHERITED; + typedef GrDrawOp INHERITED; }; #endif diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 43a28ecc05..f3a6323c1a 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -253,8 +253,8 @@ public: GrColor fColor; }; - static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, AAMode aaMode, - bool fullDash) { + static GrDrawOp* Create(const Geometry& geometry, SkPaint::Cap cap, AAMode aaMode, + bool fullDash) { return new DashBatch(geometry, cap, aaMode, fullDash); } @@ -707,11 +707,11 @@ private: typedef GrVertexBatch INHERITED; }; -GrDrawBatch* GrDashingEffect::CreateDashLineBatch(GrColor color, - const SkMatrix& viewMatrix, - const SkPoint pts[2], - AAMode aaMode, - const GrStyle& style) { +GrDrawOp* GrDashingEffect::CreateDashLineBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkPoint pts[2], + AAMode aaMode, + const GrStyle& style) { SkASSERT(GrDashingEffect::CanDrawDashLine(pts, style, viewMatrix)); const SkScalar* intervals = style.dashIntervals(); SkScalar phase = style.dashPhase(); diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h index b2d0523479..eccdafde3b 100644 --- a/src/gpu/effects/GrDashingEffect.h +++ b/src/gpu/effects/GrDashingEffect.h @@ -13,7 +13,7 @@ #include "SkPathEffect.h" class GrClip; -class GrDrawBatch; +class GrDrawOp; class GrStyle; namespace GrDashingEffect { @@ -24,11 +24,11 @@ namespace GrDashingEffect { }; static const int kAAModeCnt = static_cast<int>(AAMode::kCoverageWithMSAA) + 1; - GrDrawBatch* CreateDashLineBatch(GrColor, - const SkMatrix& viewMatrix, - const SkPoint pts[2], - AAMode, - const GrStyle& style); + GrDrawOp* CreateDashLineBatch(GrColor, + const SkMatrix& viewMatrix, + const SkPoint pts[2], + AAMode, + const GrStyle& style); bool CanDrawDashLine(const SkPoint pts[2], const GrStyle& style, const SkMatrix& viewMatrix); } diff --git a/src/gpu/gl/GrGLGpuCommandBuffer.h b/src/gpu/gl/GrGLGpuCommandBuffer.h index d1e1fe83db..76bff91a88 100644 --- a/src/gpu/gl/GrGLGpuCommandBuffer.h +++ b/src/gpu/gl/GrGLGpuCommandBuffer.h @@ -36,7 +36,7 @@ public: SkASSERT(target == fRenderTarget); } - void inlineUpload(GrBatchFlushState* state, GrDrawBatch::DeferredUploadFn& upload) override { + void inlineUpload(GrBatchFlushState* state, GrDrawOp::DeferredUploadFn& upload) override { state->doUpload(upload); } diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp index a46f24bfd8..fb0d53cac0 100644 --- a/src/gpu/instanced/InstancedRendering.cpp +++ b/src/gpu/instanced/InstancedRendering.cpp @@ -21,24 +21,24 @@ InstancedRendering::InstancedRendering(GrGpu* gpu) fDrawPool(1024, 1024) { } -GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, - GrColor color, bool antialias, - const GrInstancedPipelineInfo& info, bool* useHWAA) { +GrDrawOp* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, + GrColor color, bool antialias, + const GrInstancedPipelineInfo& info, bool* useHWAA) { return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect, antialias, info, useHWAA); } -GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, - GrColor color, const SkRect& localRect, bool antialias, - const GrInstancedPipelineInfo& info, bool* useHWAA) { +GrDrawOp* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, + GrColor color, const SkRect& localRect, bool antialias, + const GrInstancedPipelineInfo& info, bool* useHWAA) { return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, localRect, antialias, info, useHWAA); } -GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, - GrColor color, const SkMatrix& localMatrix, - bool antialias, const GrInstancedPipelineInfo& info, - bool* useHWAA) { +GrDrawOp* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, + GrColor color, const SkMatrix& localMatrix, + bool antialias, const GrInstancedPipelineInfo& info, + bool* useHWAA) { if (localMatrix.hasPerspective()) { return nullptr; // Perspective is not yet supported in the local matrix. } @@ -55,16 +55,16 @@ GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& return nullptr; } -GrDrawBatch* InstancedRendering::recordOval(const SkRect& oval, const SkMatrix& viewMatrix, - GrColor color, bool antialias, - const GrInstancedPipelineInfo& info, bool* useHWAA) { +GrDrawOp* InstancedRendering::recordOval(const SkRect& oval, const SkMatrix& viewMatrix, + GrColor color, bool antialias, + const GrInstancedPipelineInfo& info, bool* useHWAA) { return this->recordShape(ShapeType::kOval, oval, viewMatrix, color, oval, antialias, info, useHWAA); } -GrDrawBatch* InstancedRendering::recordRRect(const SkRRect& rrect, const SkMatrix& viewMatrix, - GrColor color, bool antialias, - const GrInstancedPipelineInfo& info, bool* useHWAA) { +GrDrawOp* InstancedRendering::recordRRect(const SkRRect& rrect, const SkMatrix& viewMatrix, + GrColor color, bool antialias, + const GrInstancedPipelineInfo& info, bool* useHWAA) { if (Batch* batch = this->recordShape(GetRRectShapeType(rrect), rrect.rect(), viewMatrix, color, rrect.rect(), antialias, info, useHWAA)) { batch->appendRRectParams(rrect); @@ -73,10 +73,10 @@ GrDrawBatch* InstancedRendering::recordRRect(const SkRRect& rrect, const SkMatri return nullptr; } -GrDrawBatch* InstancedRendering::recordDRRect(const SkRRect& outer, const SkRRect& inner, - const SkMatrix& viewMatrix, GrColor color, - bool antialias, const GrInstancedPipelineInfo& info, - bool* useHWAA) { +GrDrawOp* InstancedRendering::recordDRRect(const SkRRect& outer, const SkRRect& inner, + const SkMatrix& viewMatrix, GrColor color, + bool antialias, const GrInstancedPipelineInfo& info, + bool* useHWAA) { if (inner.getType() > SkRRect::kSimple_Type) { return nullptr; // Complex inner round rects are not yet supported. } diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h index c94ca8aec7..d5cb3096ef 100644 --- a/src/gpu/instanced/InstancedRendering.h +++ b/src/gpu/instanced/InstancedRendering.h @@ -11,7 +11,7 @@ #include "GrGpu.h" #include "GrMemoryPool.h" #include "SkTInternalLList.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "instanced/InstancedRenderingTypes.h" #include "../private/GrInstancedPipelineInfo.h" @@ -45,29 +45,29 @@ public: * this class before attempting to flush batches returned by it. It is invalid to record new * draws between beginFlush() and endFlush(). */ - GrDrawBatch* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, - bool antialias, const GrInstancedPipelineInfo&, - bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, + bool antialias, const GrInstancedPipelineInfo&, + bool* useHWAA); - GrDrawBatch* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, - const SkRect& localRect, bool antialias, - const GrInstancedPipelineInfo&, bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, + const SkRect& localRect, bool antialias, + const GrInstancedPipelineInfo&, bool* useHWAA); - GrDrawBatch* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, - const SkMatrix& localMatrix, bool antialias, - const GrInstancedPipelineInfo&, bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, + const SkMatrix& localMatrix, bool antialias, + const GrInstancedPipelineInfo&, bool* useHWAA); - GrDrawBatch* SK_WARN_UNUSED_RESULT recordOval(const SkRect&, const SkMatrix&, GrColor, - bool antialias, const GrInstancedPipelineInfo&, - bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordOval(const SkRect&, const SkMatrix&, GrColor, + bool antialias, const GrInstancedPipelineInfo&, + bool* useHWAA); - GrDrawBatch* SK_WARN_UNUSED_RESULT recordRRect(const SkRRect&, const SkMatrix&, GrColor, - bool antialias, const GrInstancedPipelineInfo&, - bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordRRect(const SkRRect&, const SkMatrix&, GrColor, + bool antialias, const GrInstancedPipelineInfo&, + bool* useHWAA); - GrDrawBatch* SK_WARN_UNUSED_RESULT recordDRRect(const SkRRect& outer, const SkRRect& inner, - const SkMatrix&, GrColor, bool antialias, - const GrInstancedPipelineInfo&, bool* useHWAA); + GrDrawOp* SK_WARN_UNUSED_RESULT recordDRRect(const SkRRect& outer, const SkRRect& inner, + const SkMatrix&, GrColor, bool antialias, + const GrInstancedPipelineInfo&, bool* useHWAA); /** * Compiles all recorded draws into GPU buffers and allows the client to begin flushing the @@ -93,7 +93,7 @@ public: void resetGpuResources(ResetType); protected: - class Batch : public GrDrawBatch { + class Batch : public GrDrawOp { public: SK_DECLARE_INTERNAL_LLIST_INTERFACE(Batch); @@ -156,7 +156,7 @@ protected: Draw* fHeadDraw; Draw* fTailDraw; - typedef GrDrawBatch INHERITED; + typedef GrDrawOp INHERITED; friend class InstancedRendering; }; diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index a160cb593e..b1e4f92357 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -254,8 +254,7 @@ bool GrAtlasTextBlob::mustRegenerate(const SkPaint& paint, return false; } -inline GrDrawBatch* GrAtlasTextBlob::createBatch( - const Run::SubRunInfo& info, +inline GrDrawOp* GrAtlasTextBlob::createBatch(const Run::SubRunInfo& info, int glyphCount, int run, int subRun, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, @@ -318,12 +317,12 @@ void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrPaint& grPain GrColor color = grPaint.getColor(); - sk_sp<GrDrawBatch> batch(this->createBatch(info, glyphCount, run, - subRun, viewMatrix, x, y, color, - skPaint, props, - distanceAdjustTable, - rtc->isGammaCorrect(), - cache)); + sk_sp<GrDrawOp> batch(this->createBatch(info, glyphCount, run, + subRun, viewMatrix, x, y, color, + skPaint, props, + distanceAdjustTable, + rtc->isGammaCorrect(), + cache)); GrPipelineBuilder pipelineBuilder(grPaint, rtc->mustUseHWAA(grPaint)); @@ -460,13 +459,12 @@ void GrAtlasTextBlob::flushThrowaway(GrContext* context, this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds); } -GrDrawBatch* GrAtlasTextBlob::test_createBatch( - int glyphCount, int run, int subRun, - const SkMatrix& viewMatrix, SkScalar x, SkScalar y, - GrColor color, - const SkPaint& skPaint, const SkSurfaceProps& props, - const GrDistanceFieldAdjustTable* distanceAdjustTable, - GrBatchFontCache* cache) { +GrDrawOp* GrAtlasTextBlob::test_createBatch(int glyphCount, int run, int subRun, + const SkMatrix& viewMatrix, SkScalar x, SkScalar y, + GrColor color, + const SkPaint& skPaint, const SkSurfaceProps& props, + const GrDistanceFieldAdjustTable* distanceAdjustTable, + GrBatchFontCache* cache) { const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun]; return this->createBatch(info, glyphCount, run, subRun, viewMatrix, x, y, color, skPaint, props, distanceAdjustTable, false, cache); diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index 1bbe38ece8..1801e25210 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -264,7 +264,7 @@ public: * SkAutoGlyphCache is passed to multiple calls of regenInBatch then it can save the cost of * multiple detach/attach operations of SkGlyphCache. */ - void regenInBatch(GrDrawBatch::Target* target, GrBatchFontCache* fontCache, + void regenInBatch(GrDrawOp::Target* target, GrBatchFontCache* fontCache, GrBlobRegenHelper *helper, int run, int subRun, SkAutoGlyphCache*, size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, void** vertices, size_t* byteCount, int* glyphCount); @@ -279,11 +279,11 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////// // Internal test methods - GrDrawBatch* test_createBatch(int glyphCount, int run, int subRun, - const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, - const SkPaint& skPaint, const SkSurfaceProps& props, - const GrDistanceFieldAdjustTable* distanceAdjustTable, - GrBatchFontCache* cache); + GrDrawOp* test_createBatch(int glyphCount, int run, int subRun, + const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, + const SkPaint& skPaint, const SkSurfaceProps& props, + const GrDistanceFieldAdjustTable* distanceAdjustTable, + GrBatchFontCache* cache); private: GrAtlasTextBlob() @@ -496,7 +496,7 @@ private: }; template <bool regenPos, bool regenCol, bool regenTexCoords, bool regenGlyphs> - void regenInBatch(GrDrawBatch::Target* target, + void regenInBatch(GrDrawOp::Target* target, GrBatchFontCache* fontCache, GrBlobRegenHelper* helper, Run* run, Run::SubRunInfo* info, @@ -505,14 +505,14 @@ private: GrColor color, SkScalar transX, SkScalar transY) const; - inline GrDrawBatch* createBatch(const Run::SubRunInfo& info, - int glyphCount, int run, int subRun, - const SkMatrix& viewMatrix, SkScalar x, SkScalar y, - GrColor color, - const SkPaint& skPaint, const SkSurfaceProps& props, - const GrDistanceFieldAdjustTable* distanceAdjustTable, - bool useGammaCorrectDistanceTable, - GrBatchFontCache* cache); + inline GrDrawOp* createBatch(const Run::SubRunInfo& info, + int glyphCount, int run, int subRun, + const SkMatrix& viewMatrix, SkScalar x, SkScalar y, + GrColor color, + const SkPaint& skPaint, const SkSurfaceProps& props, + const GrDistanceFieldAdjustTable* distanceAdjustTable, + bool useGammaCorrectDistanceTable, + GrBatchFontCache* cache); struct BigGlyph { BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, bool treatAsBMP) diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp index f0ccfc66df..238489d254 100644 --- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp +++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp @@ -138,7 +138,7 @@ inline void regen_vertices(intptr_t vertex, const GrGlyph* glyph, size_t vertexS } template <bool regenPos, bool regenCol, bool regenTexCoords, bool regenGlyphs> -void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target, +void GrAtlasTextBlob::regenInBatch(GrDrawOp::Target* target, GrBatchFontCache* fontCache, GrBlobRegenHelper *helper, Run* run, @@ -246,7 +246,7 @@ enum RegenMask { #define REGEN_ARGS target, fontCache, helper, &run, &info, lazyCache, \ *glyphCount, vertexStride, color, transX, transY -void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target, +void GrAtlasTextBlob::regenInBatch(GrDrawOp::Target* target, GrBatchFontCache* fontCache, GrBlobRegenHelper *helper, int runIndex, int subRunIndex, SkAutoGlyphCache* lazyCache, diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 61af211a59..d0e5a6cb84 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -17,7 +17,7 @@ #include "GrBatchTest.h" #endif -class GrDrawBatch; +class GrDrawOp; class GrRenderTargetContext; class GrPipelineBuilder; class GrTextBlobCache; diff --git a/src/gpu/text/GrBatchFontCache.cpp b/src/gpu/text/GrBatchFontCache.cpp index baed514e38..baf56a4322 100644 --- a/src/gpu/text/GrBatchFontCache.cpp +++ b/src/gpu/text/GrBatchFontCache.cpp @@ -341,7 +341,7 @@ void GrBatchTextStrike::removeID(GrBatchAtlas::AtlasID id) { } } -bool GrBatchTextStrike::addGlyphToAtlas(GrDrawBatch::Target* target, +bool GrBatchTextStrike::addGlyphToAtlas(GrDrawOp::Target* target, GrGlyph* glyph, SkGlyphCache* cache, GrMaskFormat expectedMaskFormat) { diff --git a/src/gpu/text/GrBatchFontCache.h b/src/gpu/text/GrBatchFontCache.h index 552e10fb1a..b5cfaf2cff 100644 --- a/src/gpu/text/GrBatchFontCache.h +++ b/src/gpu/text/GrBatchFontCache.h @@ -64,7 +64,7 @@ public: // happen. // TODO we can handle some of these cases if we really want to, but the long term solution is to // get the actual glyph image itself when we get the glyph metrics. - bool addGlyphToAtlas(GrDrawBatch::Target*, GrGlyph*, SkGlyphCache*, + bool addGlyphToAtlas(GrDrawOp::Target*, GrGlyph*, SkGlyphCache*, GrMaskFormat expectedMaskFormat); // testing @@ -149,21 +149,21 @@ public: // For convenience, this function will also set the use token for the current glyph if required // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGeneration void addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater, - GrGlyph* glyph, GrBatchDrawToken token) { + GrGlyph* glyph, GrDrawOpUploadToken token) { SkASSERT(glyph); updater->add(glyph->fID); this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); } void setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, - GrBatchDrawToken token, + GrDrawOpUploadToken token, GrMaskFormat format) { this->getAtlas(format)->setLastUseTokenBulk(updater, token); } // add to texture atlas that matches this format bool addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::AtlasID* id, - GrDrawBatch::Target* target, + GrDrawOp::Target* target, GrMaskFormat format, int width, int height, const void* image, SkIPoint16* loc) { fPreserveStrike = strike; diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index 2022e456e6..23fdea2030 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -634,7 +634,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height()); - sk_sp<GrDrawBatch> batch( + sk_sp<GrDrawOp> batch( GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x, fTextInverseRatio * y, grPaint.getColor(), GrPathRendering::kWinding_FillType, glyphs.get(), diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp index 7725e8e11d..4dd042b7f6 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp +++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp @@ -401,7 +401,7 @@ void GrVkGpuCommandBuffer::addAdditionalCommandBuffer() { } void GrVkGpuCommandBuffer::inlineUpload(GrBatchFlushState* state, - GrDrawBatch::DeferredUploadFn& upload) { + GrDrawOp::DeferredUploadFn& upload) { if (!fCommandBufferInfos[fCurrentCmdBuffer].fIsEmpty) { this->addAdditionalCommandBuffer(); } diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.h b/src/gpu/vk/GrVkGpuCommandBuffer.h index 9c6f03d24d..76c756e130 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.h +++ b/src/gpu/vk/GrVkGpuCommandBuffer.h @@ -33,7 +33,7 @@ public: void discard(GrRenderTarget*) override; - void inlineUpload(GrBatchFlushState* state, GrDrawBatch::DeferredUploadFn& upload) override; + void inlineUpload(GrBatchFlushState* state, GrDrawOp::DeferredUploadFn& upload) override; private: // Performs lazy initialization on the first operation seen by the command buffer. @@ -64,12 +64,12 @@ private: void addAdditionalCommandBuffer(); struct InlineUploadInfo { - InlineUploadInfo(GrBatchFlushState* state, const GrDrawBatch::DeferredUploadFn& upload) + InlineUploadInfo(GrBatchFlushState* state, const GrDrawOp::DeferredUploadFn& upload) : fFlushState(state) , fUpload(upload) {} GrBatchFlushState* fFlushState; - GrDrawBatch::DeferredUploadFn fUpload; + GrDrawOp::DeferredUploadFn fUpload; }; struct CommandBufferInfo { diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 07daa8fea5..cf4095a30b 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -26,7 +26,7 @@ #include "SkRandom.h" #include "Test.h" -#include "batches/GrDrawBatch.h" +#include "batches/GrDrawOp.h" #include "effects/GrConfigConversionEffect.h" #include "effects/GrPorterDuffXferProcessor.h" @@ -330,7 +330,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { GrPaint grPaint; - sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); + sk_sp<GrDrawOp> batch(GrRandomDrawBatch(&random, context)); SkASSERT(batch); GrProcessorTestData ptd(&random, context, context->caps(), @@ -361,7 +361,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { for (int i = 0; i < fpFactoryCnt; ++i) { // Since FP factories internally randomize, call each 10 times. for (int j = 0; j < 10; ++j) { - sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); + sk_sp<GrDrawOp> batch(GrRandomDrawBatch(&random, context)); SkASSERT(batch); GrProcessorTestData ptd(&random, context, context->caps(), renderTargetContext.get(), dummyTextures); diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 68234e6304..00c0bfffad 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -123,7 +123,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0); #endif - sk_sp<GrDrawBatch> batch; + sk_sp<GrDrawOp> batch; GrPaint grPaint; // This one should succeed. batch.reset(new Batch(attribCnt)); diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index b977f70c57..2a2eea5438 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -244,7 +244,7 @@ void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT #define RETURN_IF_ABANDONED if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; } void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint, - GrDrawBatch* batch, + GrDrawOp* batch, const GrUserStencilSettings* uss, bool snapToCenters) { ASSERT_SINGLE_OWNER |