Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: src/gpu/batches/GrDrawAtlasBatch.h

Issue 1274013003: Move GrDrawAtlasBatch to separate file (Closed) Base URL: https://skia.googlesource.com/skia.git@drawAtlas-08-06
Patch Set: Move to batches dir Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrDrawAtlasBatch_DEFINED
9 #define GrDrawAtlasBatch_DEFINED
10
11 #include "GrBatch.h"
12 #include "GrColor.h"
13 #include "GrDefaultGeoProcFactory.h"
14
15 class GrDrawAtlasBatch : public GrBatch {
16 public:
17 struct Geometry {
18 GrColor fColor;
19 SkTDArray<SkPoint> fPositions;
20 SkTDArray<GrColor> fColors;
21 SkTDArray<SkPoint> fLocalCoords;
22 };
23
24 static GrBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
25 const SkPoint* positions, int vertexCount,
26 const GrColor* colors, const SkPoint* localCoords,
27 const SkRect& bounds) {
28 return SkNEW_ARGS(GrDrawAtlasBatch, (geometry, viewMatrix, positions,
29 vertexCount, colors, localCoords, bou nds));
30 }
31
32 const char* name() const override { return "DrawAtlasBatch"; }
33
34 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
35 // When this is called on a batch, there is only one geometry bundle
36 if (this->hasColors()) {
37 out->setUnknownFourComponents();
38 } else {
39 out->setKnownFourComponents(fGeoData[0].fColor);
40 }
41 }
42
43 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
44 out->setKnownSingleComponent(0xff);
45 }
46
47 void initBatchTracker(const GrPipelineInfo& init) override;
48 void generateGeometry(GrBatchTarget* batchTarget) override;
49
50 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
51
52 private:
53 GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix,
54 const SkPoint* positions, int vertexCount,
55 const GrColor* colors, const SkPoint* localCoords, const Sk Rect& bounds);
56
57 GrColor color() const { return fColor; }
58 bool colorIgnored() const { return fColorIgnored; }
59 const SkMatrix& viewMatrix() const { return fViewMatrix; }
60 bool hasColors() const { return fHasColors; }
61 int vertexCount() const { return fVertexCount; }
62 bool coverageIgnored() const { return fCoverageIgnored; }
63
64 bool onCombineIfPossible(GrBatch* t) override;
65 SkSTArray<1, Geometry, true> fGeoData;
66
67 SkMatrix fViewMatrix;
68 GrColor fColor;
69 int fVertexCount;
70 bool fColorIgnored;
71 bool fCoverageIgnored;
72 bool fHasColors;
73 };
74
75 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698