| 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 GrAtlasTextBatch_DEFINED | 8 #ifndef GrAtlasTextBatch_DEFINED |
| 9 #define GrAtlasTextBatch_DEFINED | 9 #define GrAtlasTextBatch_DEFINED |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 protected: | 94 protected: |
| 95 void computePipelineOptimizations(GrInitInvariantOutput* color, | 95 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 96 GrInitInvariantOutput* coverage, | 96 GrInitInvariantOutput* coverage, |
| 97 GrBatchToXPOverrides* overrides) const ove
rride; | 97 GrBatchToXPOverrides* overrides) const ove
rride; |
| 98 | 98 |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; | 101 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; |
| 102 | 102 |
| 103 struct FlushInfo { | 103 struct FlushInfo { |
| 104 SkAutoTUnref<const GrBuffer> fVertexBuffer; | 104 SkAutoTUnref<const GrBuffer> fVertexBuffer; |
| 105 SkAutoTUnref<const GrBuffer> fIndexBuffer; | 105 SkAutoTUnref<const GrBuffer> fIndexBuffer; |
| 106 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 106 sk_sp<GrGeometryProcessor> fGeometryProcessor; |
| 107 int fGlyphsToFlush; | 107 int fGlyphsToFlush; |
| 108 int fVertexOffset; | 108 int fVertexOffset; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 void onPrepareDraws(Target* target) const override; | 111 void onPrepareDraws(Target* target) const override; |
| 112 | 112 |
| 113 GrAtlasTextBatch() : INHERITED(ClassID()) {} // initialized in factory funct
ions. | 113 GrAtlasTextBatch() : INHERITED(ClassID()) {} // initialized in factory funct
ions. |
| 114 | 114 |
| 115 ~GrAtlasTextBatch() { | 115 ~GrAtlasTextBatch() { |
| 116 for (int i = 0; i < fGeoCount; i++) { | 116 for (int i = 0; i < fGeoCount; i++) { |
| 117 fGeoData[i].fBlob->unref(); | 117 fGeoData[i].fBlob->unref(); |
| 118 } | 118 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 GrColor color() const { return fBatch.fColor; } | 147 GrColor color() const { return fBatch.fColor; } |
| 148 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 148 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
| 149 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 149 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
| 150 int numGlyphs() const { return fBatch.fNumGlyphs; } | 150 int numGlyphs() const { return fBatch.fNumGlyphs; } |
| 151 | 151 |
| 152 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; | 152 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; |
| 153 | 153 |
| 154 // TODO just use class params | 154 // TODO just use class params |
| 155 // TODO trying to figure out why lcd is so whack | 155 // TODO trying to figure out why lcd is so whack |
| 156 GrGeometryProcessor* setupDfProcessor(const SkMatrix& viewMatrix, SkColor fi
lteredColor, | 156 sk_sp<GrGeometryProcessor> setupDfProcessor(const SkMatrix& viewMatrix, SkCo
lor filteredColor, |
| 157 GrColor color, GrTexture* texture) con
st; | 157 GrColor color, GrTexture* textur
e) const; |
| 158 | 158 |
| 159 struct BatchTracker { | 159 struct BatchTracker { |
| 160 GrColor fColor; | 160 GrColor fColor; |
| 161 bool fUsesLocalCoords; | 161 bool fUsesLocalCoords; |
| 162 bool fColorIgnored; | 162 bool fColorIgnored; |
| 163 bool fCoverageIgnored; | 163 bool fCoverageIgnored; |
| 164 int fNumGlyphs; | 164 int fNumGlyphs; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 BatchTracker fBatch; | 167 BatchTracker fBatch; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 fFlushInfo->fGlyphsToFlush += glyphCount; | 210 fFlushInfo->fGlyphsToFlush += glyphCount; |
| 211 } | 211 } |
| 212 | 212 |
| 213 private: | 213 private: |
| 214 const GrAtlasTextBatch* fBatch; | 214 const GrAtlasTextBatch* fBatch; |
| 215 GrVertexBatch::Target* fTarget; | 215 GrVertexBatch::Target* fTarget; |
| 216 GrAtlasTextBatch::FlushInfo* fFlushInfo; | 216 GrAtlasTextBatch::FlushInfo* fFlushInfo; |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 #endif | 219 #endif |
| OLD | NEW |