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/GrDrawPathBatch.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/GrDrawPathBatch.h ('k') | src/gpu/batches/GrDrawVerticesBatch.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 "GrDrawPathBatch.h" 8 #include "GrDrawPathBatch.h"
9 9
10 #include "GrRenderTargetPriv.h" 10 #include "GrRenderTargetPriv.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x, 51 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x,
52 SkScalar y, GrColor color, 52 SkScalar y, GrColor color,
53 GrPathRendering::FillType fill, GrPat hRange* range, 53 GrPathRendering::FillType fill, GrPat hRange* range,
54 const InstanceData* instanceData, con st SkRect& bounds) 54 const InstanceData* instanceData, con st SkRect& bounds)
55 : INHERITED(ClassID(), viewMatrix, color, fill) 55 : INHERITED(ClassID(), viewMatrix, color, fill)
56 , fPathRange(range) 56 , fPathRange(range)
57 , fTotalPathCount(instanceData->count()) 57 , fTotalPathCount(instanceData->count())
58 , fScale(scale) { 58 , fScale(scale) {
59 fDraws.addToHead()->set(instanceData, x, y); 59 fDraws.addToHead()->set(instanceData, x, y);
60 fBounds = bounds; 60 this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
61 } 61 }
62 62
63 bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { 63 bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
64 GrDrawPathRangeBatch* that = t->cast<GrDrawPathRangeBatch>(); 64 GrDrawPathRangeBatch* that = t->cast<GrDrawPathRangeBatch>();
65 if (this->fPathRange.get() != that->fPathRange.get() || 65 if (this->fPathRange.get() != that->fPathRange.get() ||
66 this->transformType() != that->transformType() || 66 this->transformType() != that->transformType() ||
67 this->fScale != that->fScale || 67 this->fScale != that->fScale ||
68 this->color() != that->color() || 68 this->color() != that->color() ||
69 !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { 69 !this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
70 return false; 70 return false;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 SkASSERT(!that->overrides().willColorBlendWithDst()); 106 SkASSERT(!that->overrides().willColorBlendWithDst());
107 fTotalPathCount += that->fTotalPathCount; 107 fTotalPathCount += that->fTotalPathCount;
108 while (Draw* head = that->fDraws.head()) { 108 while (Draw* head = that->fDraws.head()) {
109 Draw* draw = fDraws.addToTail(); 109 Draw* draw = fDraws.addToTail();
110 draw->fInstanceData.reset(head->fInstanceData.release()); 110 draw->fInstanceData.reset(head->fInstanceData.release());
111 draw->fX = head->fX; 111 draw->fX = head->fX;
112 draw->fY = head->fY; 112 draw->fY = head->fY;
113 that->fDraws.popHead(); 113 that->fDraws.popHead();
114 } 114 }
115 this->joinBounds(that->fBounds); 115 this->joinBounds(*that);
116 return true; 116 return true;
117 } 117 }
118 118
119 void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) { 119 void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
120 const Draw& head = *fDraws.head(); 120 const Draw& head = *fDraws.head();
121 121
122 SkMatrix drawMatrix(this->viewMatrix()); 122 SkMatrix drawMatrix(this->viewMatrix());
123 drawMatrix.preScale(fScale, fScale); 123 drawMatrix.preScale(fScale, fScale);
124 drawMatrix.preTranslate(head.fX, head.fY); 124 drawMatrix.preTranslate(head.fX, head.fY);
125 125
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 dst[i + 3] = xforms[i + 3]; 212 dst[i + 3] = xforms[i + 3];
213 dst[i + 4] = xforms[i + 4]; 213 dst[i + 4] = xforms[i + 4];
214 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i + 5]; 214 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i + 5];
215 } 215 }
216 break; 216 break;
217 default: 217 default:
218 SkFAIL("Unknown transform type."); 218 SkFAIL("Unknown transform type.");
219 break; 219 break;
220 } 220 }
221 } 221 }
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDrawPathBatch.h ('k') | src/gpu/batches/GrDrawVerticesBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698