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

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 1121463002: Move bounds to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 7 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/GrDrawTarget.cpp ('k') | src/gpu/GrOvalRenderer.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 2011 Google Inc. 2 * Copyright 2011 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 "GrInOrderDrawBuffer.h" 8 #include "GrInOrderDrawBuffer.h"
9 9
10 #include "GrDefaultGeoProcFactory.h" 10 #include "GrDefaultGeoProcFactory.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 instanceCount -= drawInfo.instanceCount(); 205 instanceCount -= drawInfo.instanceCount();
206 } 206 }
207 } 207 }
208 208
209 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 209 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
210 210
211 private: 211 private:
212 RectBatch(const Geometry& geometry) { 212 RectBatch(const Geometry& geometry) {
213 this->initClassID<RectBatch>(); 213 this->initClassID<RectBatch>();
214 fGeoData.push_back(geometry); 214 fGeoData.push_back(geometry);
215
216 fBounds = geometry.fRect;
217 geometry.fViewMatrix.mapRect(&fBounds);
215 } 218 }
216 219
217 GrColor color() const { return fBatch.fColor; } 220 GrColor color() const { return fBatch.fColor; }
218 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 221 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
219 bool colorIgnored() const { return fBatch.fColorIgnored; } 222 bool colorIgnored() const { return fBatch.fColorIgnored; }
220 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } 223 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
221 const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; } 224 const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
222 bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; } 225 bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
223 bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; } 226 bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
224 227
(...skipping 16 matching lines...) Expand all
241 244
242 if (this->hasLocalMatrix() && !this->localMatrix().cheapEqualTo(that ->localMatrix())) { 245 if (this->hasLocalMatrix() && !this->localMatrix().cheapEqualTo(that ->localMatrix())) {
243 return false; 246 return false;
244 } 247 }
245 } 248 }
246 249
247 if (this->color() != that->color()) { 250 if (this->color() != that->color()) {
248 fBatch.fColor = GrColor_ILLEGAL; 251 fBatch.fColor = GrColor_ILLEGAL;
249 } 252 }
250 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 253 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
254 this->joinBounds(that->bounds());
251 return true; 255 return true;
252 } 256 }
253 257
254 struct BatchTracker { 258 struct BatchTracker {
255 GrColor fColor; 259 GrColor fColor;
256 bool fUsesLocalCoords; 260 bool fUsesLocalCoords;
257 bool fColorIgnored; 261 bool fColorIgnored;
258 bool fCoverageIgnored; 262 bool fCoverageIgnored;
259 }; 263 };
260 264
(...skipping 23 matching lines...) Expand all
284 } 288 }
285 289
286 if (localMatrix) { 290 if (localMatrix) {
287 geometry.fHasLocalMatrix = true; 291 geometry.fHasLocalMatrix = true;
288 geometry.fLocalMatrix = *localMatrix; 292 geometry.fLocalMatrix = *localMatrix;
289 } else { 293 } else {
290 geometry.fHasLocalMatrix = false; 294 geometry.fHasLocalMatrix = false;
291 } 295 }
292 296
293 SkAutoTUnref<GrBatch> batch(RectBatch::Create(geometry)); 297 SkAutoTUnref<GrBatch> batch(RectBatch::Create(geometry));
294 298 this->drawBatch(pipelineBuilder, batch);
295 SkRect bounds = rect;
296 viewMatrix.mapRect(&bounds);
297 this->drawBatch(pipelineBuilder, batch, &bounds);
298 } 299 }
299 300
300 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, 301 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch,
301 const PipelineInfo& pipelineInfo) { 302 const PipelineInfo& pipelineInfo) {
302 GrTargetCommands::Cmd* cmd = fCommands.recordDrawBatch(this, batch, pipeline Info); 303 GrTargetCommands::Cmd* cmd = fCommands.recordDrawBatch(this, batch, pipeline Info);
303 this->recordTraceMarkersIfNecessary(cmd); 304 this->recordTraceMarkersIfNecessary(cmd);
304 } 305 }
305 306
306 void GrInOrderDrawBuffer::onStencilPath(const GrPipelineBuilder& pipelineBuilder , 307 void GrInOrderDrawBuffer::onStencilPath(const GrPipelineBuilder& pipelineBuilder ,
307 const GrPathProcessor* pathProc, 308 const GrPathProcessor* pathProc,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 393 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
393 if (activeTraceMarkers.count() > 0) { 394 if (activeTraceMarkers.count() > 0) {
394 if (cmd->isTraced()) { 395 if (cmd->isTraced()) {
395 fGpuCmdMarkers[cmd->markerID()].addSet(activeTraceMarkers); 396 fGpuCmdMarkers[cmd->markerID()].addSet(activeTraceMarkers);
396 } else { 397 } else {
397 cmd->setMarkerID(fGpuCmdMarkers.count()); 398 cmd->setMarkerID(fGpuCmdMarkers.count());
398 fGpuCmdMarkers.push_back(activeTraceMarkers); 399 fGpuCmdMarkers.push_back(activeTraceMarkers);
399 } 400 }
400 } 401 }
401 } 402 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698