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

Side by Side Diff: src/gpu/GrAADistanceFieldPathRenderer.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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 PathCache* pathCache, PathDataList* pathList) { 305 PathCache* pathCache, PathDataList* pathList) {
306 this->initClassID<AADistanceFieldPathBatch>(); 306 this->initClassID<AADistanceFieldPathBatch>();
307 fBatch.fColor = color; 307 fBatch.fColor = color;
308 fBatch.fViewMatrix = viewMatrix; 308 fBatch.fViewMatrix = viewMatrix;
309 fGeoData.push_back(geometry); 309 fGeoData.push_back(geometry);
310 fGeoData.back().fPathData = NULL; 310 fGeoData.back().fPathData = NULL;
311 311
312 fAtlas = atlas; 312 fAtlas = atlas;
313 fPathCache = pathCache; 313 fPathCache = pathCache;
314 fPathList = pathList; 314 fPathList = pathList;
315
316 // Compute bounds
317 fBounds = geometry.fPath.getBounds();
318 viewMatrix.mapRect(&fBounds);
315 } 319 }
316 320
317 bool addPathToAtlas(GrBatchTarget* batchTarget, 321 bool addPathToAtlas(GrBatchTarget* batchTarget,
318 const GrGeometryProcessor* dfProcessor, 322 const GrGeometryProcessor* dfProcessor,
319 const GrPipeline* pipeline, 323 const GrPipeline* pipeline,
320 GrDrawTarget::DrawInfo* drawInfo, 324 GrDrawTarget::DrawInfo* drawInfo,
321 int* instancesToFlush, 325 int* instancesToFlush,
322 int maxInstancesPerDraw, 326 int maxInstancesPerDraw,
323 GrBatchAtlas* atlas, 327 GrBatchAtlas* atlas,
324 PathData* pathData, 328 PathData* pathData,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // maybe upload color via attribute 545 // maybe upload color via attribute
542 if (this->color() != that->color()) { 546 if (this->color() != that->color()) {
543 return false; 547 return false;
544 } 548 }
545 549
546 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { 550 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
547 return false; 551 return false;
548 } 552 }
549 553
550 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 554 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
555 this->joinBounds(that->bounds());
551 return true; 556 return true;
552 } 557 }
553 558
554 struct BatchTracker { 559 struct BatchTracker {
555 GrColor fColor; 560 GrColor fColor;
556 SkMatrix fViewMatrix; 561 SkMatrix fViewMatrix;
557 bool fUsesLocalCoords; 562 bool fUsesLocalCoords;
558 bool fColorIgnored; 563 bool fColorIgnored;
559 bool fCoverageIgnored; 564 bool fCoverageIgnored;
560 }; 565 };
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 fAtlas->registerEvictionCallback(&GrAADistanceFieldPathRenderer::HandleE viction, 605 fAtlas->registerEvictionCallback(&GrAADistanceFieldPathRenderer::HandleE viction,
601 (void*)this); 606 (void*)this);
602 } 607 }
603 608
604 AADistanceFieldPathBatch::Geometry geometry(stroke.getStrokeRec()); 609 AADistanceFieldPathBatch::Geometry geometry(stroke.getStrokeRec());
605 geometry.fPath = path; 610 geometry.fPath = path;
606 geometry.fAntiAlias = antiAlias; 611 geometry.fAntiAlias = antiAlias;
607 612
608 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color , viewMatrix, 613 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color , viewMatrix,
609 fAtlas, &fPathC ache, &fPathList)); 614 fAtlas, &fPathC ache, &fPathList));
610 615 target->drawBatch(pipelineBuilder, batch);
611 SkRect bounds = path.getBounds();
612 viewMatrix.mapRect(&bounds);
613 target->drawBatch(pipelineBuilder, batch, &bounds);
614 616
615 return true; 617 return true;
616 } 618 }
617 619
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698