diff options
author | joshualitt <joshualitt@chromium.org> | 2015-08-19 06:54:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 06:54:08 -0700 |
commit | ae41b3834301444cf27b8aa729b8ad36666bdc08 (patch) | |
tree | 9e516e7aa00b8f3ad554eb367729754233d62172 /src/gpu/batches/GrAAFillRectBatch.cpp | |
parent | 6458b6f0a8e8b1e16ec1640d17fe28ab05c8a95b (diff) |
fill rect batch refactor into separate batches
BUG=skia:
Review URL: https://codereview.chromium.org/1295773003
Diffstat (limited to 'src/gpu/batches/GrAAFillRectBatch.cpp')
-rw-r--r-- | src/gpu/batches/GrAAFillRectBatch.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp index 8760896604..2554db6146 100644 --- a/src/gpu/batches/GrAAFillRectBatch.cpp +++ b/src/gpu/batches/GrAAFillRectBatch.cpp @@ -187,9 +187,14 @@ public: static const int kVertsPerInstance = kVertsPerAAFillRect; static const int kIndicesPerInstance = kIndicesPerAAFillRect; - inline static const GrIndexBuffer* GetIndexBuffer(GrResourceProvider* rp) { + static const GrIndexBuffer* GetIndexBuffer(GrResourceProvider* rp) { return get_index_buffer(rp); } + + template <class Geometry> + static void SetBounds(const Geometry& geo, SkRect* outBounds) { + *outBounds = geo.fDevRect; + } }; class AAFillRectBatchNoLocalMatrixImp : public AAFillRectBatchBase { @@ -201,18 +206,18 @@ public: GrColor fColor; }; - inline static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; } + static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; } - inline static bool CanCombine(const Geometry& mine, const Geometry& theirs, - const GrPipelineOptimizations& opts) { + static bool CanCombine(const Geometry& mine, const Geometry& theirs, + const GrPipelineOptimizations& opts) { // We apply the viewmatrix to the rect points on the cpu. However, if the pipeline uses // local coords then we won't be able to batch. We could actually upload the viewmatrix // using vertex attributes in these cases, but haven't investigated that return !opts.readsLocalCoords() || mine.fViewMatrix.cheapEqualTo(theirs.fViewMatrix); } - inline static const GrGeometryProcessor* CreateGP(const Geometry& geo, - const GrPipelineOptimizations& opts) { + static const GrGeometryProcessor* CreateGP(const Geometry& geo, + const GrPipelineOptimizations& opts) { const GrGeometryProcessor* gp = create_fill_rect_gp(geo.fViewMatrix, opts, GrDefaultGeoProcFactory::LocalCoords::kUsePosition_Type); @@ -224,8 +229,8 @@ public: return gp; } - inline static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, - const GrPipelineOptimizations& opts) { + static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, + const GrPipelineOptimizations& opts) { generate_aa_fill_rect_geometry(vertices, vertexStride, geo.fColor, geo.fViewMatrix, geo.fRect, geo.fDevRect, opts, NULL); @@ -242,15 +247,15 @@ public: GrColor fColor; }; - inline static const char* Name() { return "AAFillRectBatchLocalMatrix"; } + static const char* Name() { return "AAFillRectBatchLocalMatrix"; } - inline static bool CanCombine(const Geometry& mine, const Geometry& theirs, - const GrPipelineOptimizations&) { + static bool CanCombine(const Geometry& mine, const Geometry& theirs, + const GrPipelineOptimizations&) { return true; } - inline static const GrGeometryProcessor* CreateGP(const Geometry& geo, - const GrPipelineOptimizations& opts) { + static const GrGeometryProcessor* CreateGP(const Geometry& geo, + const GrPipelineOptimizations& opts) { const GrGeometryProcessor* gp = create_fill_rect_gp(geo.fViewMatrix, opts, GrDefaultGeoProcFactory::LocalCoords::kHasExplicit_Type); @@ -263,8 +268,8 @@ public: return gp; } - inline static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, - const GrPipelineOptimizations& opts) { + static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, + const GrPipelineOptimizations& opts) { generate_aa_fill_rect_geometry(vertices, vertexStride, geo.fColor, geo.fViewMatrix, geo.fRect, geo.fDevRect, opts, &geo.fLocalMatrix); |