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

Side by Side Diff: src/gpu/batches/GrNinePatch.cpp

Issue 2127673002: Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@AAStrokeRect
Patch Set: update for instanced rendering Created 4 years, 5 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/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "GrNinePatch.h" 8 #include "GrNinePatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 26 matching lines...) Expand all
37 Patch& patch = fPatches.push_back(); 37 Patch& patch = fPatches.push_back();
38 patch.fViewMatrix = viewMatrix; 38 patch.fViewMatrix = viewMatrix;
39 patch.fColor = color; 39 patch.fColor = color;
40 patch.fCenter = center; 40 patch.fCenter = center;
41 patch.fDst = dst; 41 patch.fDst = dst;
42 42
43 fImageWidth = imageWidth; 43 fImageWidth = imageWidth;
44 fImageHeight = imageHeight; 44 fImageHeight = imageHeight;
45 45
46 // setup bounds 46 // setup bounds
47 patch.fViewMatrix.mapRect(&fBounds, patch.fDst); 47 this->setTransformedBounds(patch.fDst, viewMatrix, HasAABloat::kNo, IsZe roArea::kNo);
48 } 48 }
49 49
50 const char* name() const override { return "NonAANinePatchBatch"; } 50 const char* name() const override { return "NonAANinePatchBatch"; }
51 51
52 SkString dumpInfo() const override { 52 SkString dumpInfo() const override {
53 SkString str; 53 SkString str;
54 54
55 for (int i = 0; i < fPatches.count(); ++i) { 55 for (int i = 0; i < fPatches.count(); ++i) {
56 str.appendf("%d: Color: 0x%08x Center [L: %d, T: %d, R: %d, B: %d], " 56 str.appendf("%d: Color: 0x%08x Center [L: %d, T: %d, R: %d, B: %d], "
57 "Dst [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", 57 "Dst [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 SkASSERT(this->fImageWidth == that->fImageWidth && 145 SkASSERT(this->fImageWidth == that->fImageWidth &&
146 this->fImageHeight == that->fImageHeight); 146 this->fImageHeight == that->fImageHeight);
147 147
148 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to 148 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to
149 // not tweaking 149 // not tweaking
150 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) { 150 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) {
151 fOverrides = that->fOverrides; 151 fOverrides = that->fOverrides;
152 } 152 }
153 153
154 fPatches.push_back_n(that->fPatches.count(), that->fPatches.begin()); 154 fPatches.push_back_n(that->fPatches.count(), that->fPatches.begin());
155 this->joinBounds(that->bounds()); 155 this->joinBounds(*that);
156 return true; 156 return true;
157 } 157 }
158 158
159 struct Patch { 159 struct Patch {
160 SkMatrix fViewMatrix; 160 SkMatrix fViewMatrix;
161 SkIRect fCenter; 161 SkIRect fCenter;
162 SkRect fDst; 162 SkRect fDst;
163 GrColor fColor; 163 GrColor fColor;
164 }; 164 };
165 165
166 GrXPOverridesForBatch fOverrides; 166 GrXPOverridesForBatch fOverrides;
167 int fImageWidth; 167 int fImageWidth;
168 int fImageHeight; 168 int fImageHeight;
169 SkSTArray<1, Patch, true> fPatches; 169 SkSTArray<1, Patch, true> fPatches;
170 170
171 typedef GrVertexBatch INHERITED; 171 typedef GrVertexBatch INHERITED;
172 }; 172 };
173 173
174 namespace GrNinePatch { 174 namespace GrNinePatch {
175 GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWid th, int imageHeight, 175 GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWid th, int imageHeight,
176 const SkIRect& center, const SkRect& dst) { 176 const SkIRect& center, const SkRect& dst) {
177 return new GrNonAANinePatchBatch(color, viewMatrix, imageWidth, imageHeight, center, dst); 177 return new GrNonAANinePatchBatch(color, viewMatrix, imageWidth, imageHeight, center, dst);
178 } 178 }
179 }; 179 };
OLDNEW
« no previous file with comments | « src/gpu/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698