| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrDrawAtlasBatch_DEFINED | 8 #ifndef GrDrawAtlasBatch_DEFINED |
| 9 #define GrDrawAtlasBatch_DEFINED | 9 #define GrDrawAtlasBatch_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMat
rix, | 24 static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMat
rix, |
| 25 int spriteCount, const SkRSXform* xforms, const S
kRect* rects, | 25 int spriteCount, const SkRSXform* xforms, const S
kRect* rects, |
| 26 const SkColor* colors) { | 26 const SkColor* colors) { |
| 27 return new GrDrawAtlasBatch(geometry, viewMatrix, spriteCount, xforms, r
ects, colors); | 27 return new GrDrawAtlasBatch(geometry, viewMatrix, spriteCount, xforms, r
ects, colors); |
| 28 } | 28 } |
| 29 | 29 |
| 30 const char* name() const override { return "DrawAtlasBatch"; } | 30 const char* name() const override { return "DrawAtlasBatch"; } |
| 31 | 31 |
| 32 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 32 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 33 GrInitInvariantOutput* coverage, |
| 34 GrBatchToXPOverrides* overrides) const ove
rride { |
| 33 // When this is called on a batch, there is only one geometry bundle | 35 // When this is called on a batch, there is only one geometry bundle |
| 34 if (this->hasColors()) { | 36 if (this->hasColors()) { |
| 35 out->setUnknownFourComponents(); | 37 color->setUnknownFourComponents(); |
| 36 } else { | 38 } else { |
| 37 out->setKnownFourComponents(fGeoData[0].fColor); | 39 color->setKnownFourComponents(fGeoData[0].fColor); |
| 38 } | 40 } |
| 39 } | 41 coverage->setKnownSingleComponent(0xff); |
| 40 | 42 overrides->fUsePLSDstRead = false; |
| 41 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | |
| 42 out->setKnownSingleComponent(0xff); | |
| 43 } | 43 } |
| 44 | 44 |
| 45 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 45 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void onPrepareDraws(Target*) override; | 48 void onPrepareDraws(Target*) override; |
| 49 | 49 |
| 50 void initBatchTracker(const GrPipelineOptimizations&) override; | 50 void initBatchTracker(const GrXPOverridesForBatch&) override; |
| 51 | 51 |
| 52 GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix, int s
priteCount, | 52 GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix, int s
priteCount, |
| 53 const SkRSXform* xforms, const SkRect* rects, const SkColor
* colors); | 53 const SkRSXform* xforms, const SkRect* rects, const SkColor
* colors); |
| 54 | 54 |
| 55 GrColor color() const { return fColor; } | 55 GrColor color() const { return fColor; } |
| 56 bool colorIgnored() const { return fColorIgnored; } | 56 bool colorIgnored() const { return fColorIgnored; } |
| 57 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 57 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 58 bool hasColors() const { return fHasColors; } | 58 bool hasColors() const { return fHasColors; } |
| 59 int quadCount() const { return fQuadCount; } | 59 int quadCount() const { return fQuadCount; } |
| 60 bool coverageIgnored() const { return fCoverageIgnored; } | 60 bool coverageIgnored() const { return fCoverageIgnored; } |
| 61 | 61 |
| 62 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; | 62 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; |
| 63 SkSTArray<1, Geometry, true> fGeoData; | 63 SkSTArray<1, Geometry, true> fGeoData; |
| 64 | 64 |
| 65 SkMatrix fViewMatrix; | 65 SkMatrix fViewMatrix; |
| 66 GrColor fColor; | 66 GrColor fColor; |
| 67 int fQuadCount; | 67 int fQuadCount; |
| 68 bool fColorIgnored; | 68 bool fColorIgnored; |
| 69 bool fCoverageIgnored; | 69 bool fCoverageIgnored; |
| 70 bool fHasColors; | 70 bool fHasColors; |
| 71 | 71 |
| 72 typedef GrVertexBatch INHERITED; | 72 typedef GrVertexBatch INHERITED; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif | 75 #endif |
| OLD | NEW |