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

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

Issue 1294553003: Move GrRectBatch to GrBWFillRectBatch and make internal (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 GrRectBatch_DEFINED
9 #define GrRectBatch_DEFINED
10
11 #include "GrBatch.h"
12 #include "GrColor.h"
13
14 class GrBatchTarget;
15 class SkMatrix;
16 struct SkRect;
17
18 class GrRectBatch : public GrBatch {
19 public:
20 struct Geometry {
21 SkMatrix fViewMatrix;
22 SkRect fRect;
23 SkRect fLocalRect;
24 SkMatrix fLocalMatrix;
25 GrColor fColor;
26 bool fHasLocalRect;
27 bool fHasLocalMatrix;
28 };
29
30 static GrBatch* Create(const Geometry& geometry) {
31 return SkNEW_ARGS(GrRectBatch, (geometry));
32 }
33
34 const char* name() const override { return "RectBatch"; }
35
36 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
37 // When this is called on a batch, there is only one geometry bundle
38 out->setKnownFourComponents(fGeoData[0].fColor);
39 }
40
41 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
42 out->setKnownSingleComponent(0xff);
43 }
44
45 void initBatchTracker(const GrPipelineOptimizations&) override;
46
47 void generateGeometry(GrBatchTarget* batchTarget) override;
48
49 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
50
51 private:
52 GrRectBatch(const Geometry& geometry) {
53 this->initClassID<GrRectBatch>();
54 fGeoData.push_back(geometry);
55
56 fBounds = geometry.fRect;
57 geometry.fViewMatrix.mapRect(&fBounds);
58 }
59
60 GrColor color() const { return fBatch.fColor; }
61 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
62 bool colorIgnored() const { return fBatch.fColorIgnored; }
63 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
64 const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
65 bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
66 bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
67 bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
68
69 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override;
70
71 const GrGeometryProcessor* createRectGP();
72
73 struct BatchTracker {
74 GrColor fColor;
75 bool fUsesLocalCoords;
76 bool fColorIgnored;
77 bool fCoverageIgnored;
78 };
79
80 BatchTracker fBatch;
81 SkSTArray<1, Geometry, true> fGeoData;
82 };
83
84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698