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

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

Issue 1011403004: BitmapTextBatch and BitmapTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@dfpr_take_2
Patch Set: fix for segfault Created 5 years, 8 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrBatchAtlas.h » ('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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 pipeline, 286 pipeline,
287 dfProcessor, 287 dfProcessor,
288 positions, 288 positions,
289 vertexStride, 289 vertexStride,
290 this->viewMatrix(), 290 this->viewMatrix(),
291 args.fPath, 291 args.fPath,
292 args.fPathData); 292 args.fPathData);
293 instancesToFlush++; 293 instancesToFlush++;
294 } 294 }
295 295
296 this->flush(batchTarget, dfProcessor, pipeline, &drawInfo, instancesToFl ush, 296 this->flush(batchTarget, &drawInfo, instancesToFlush, maxInstancesPerDra w);
297 maxInstancesPerDraw);
298 } 297 }
299 298
300 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 299 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
301 300
302 private: 301 private:
303 AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMa trix& viewMatrix, 302 AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMa trix& viewMatrix,
304 GrBatchAtlas* atlas, 303 GrBatchAtlas* atlas,
305 PathCache* pathCache, PathDataList* pathList) { 304 PathCache* pathCache, PathDataList* pathList) {
306 this->initClassID<AADistanceFieldPathBatch>(); 305 this->initClassID<AADistanceFieldPathBatch>();
307 fBatch.fColor = color; 306 fBatch.fColor = color;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 (const unsigned char*)bmp.getPixe ls(), 413 (const unsigned char*)bmp.getPixe ls(),
415 bmp.width(), bmp.height(), bmp.ro wBytes()); 414 bmp.width(), bmp.height(), bmp.ro wBytes());
416 } 415 }
417 416
418 // add to atlas 417 // add to atlas
419 SkIPoint16 atlasLocation; 418 SkIPoint16 atlasLocation;
420 GrBatchAtlas::AtlasID id; 419 GrBatchAtlas::AtlasID id;
421 bool success = atlas->addToAtlas(&id, batchTarget, width, height, dfStor age.get(), 420 bool success = atlas->addToAtlas(&id, batchTarget, width, height, dfStor age.get(),
422 &atlasLocation); 421 &atlasLocation);
423 if (!success) { 422 if (!success) {
424 this->flush(batchTarget, dfProcessor, pipeline, drawInfo, *instances ToFlush, 423 this->flush(batchTarget, drawInfo, *instancesToFlush, maxInstancesPe rDraw);
425 maxInstancesPerDraw);
426 this->initDraw(batchTarget, dfProcessor, pipeline); 424 this->initDraw(batchTarget, dfProcessor, pipeline);
427 *instancesToFlush = 0; 425 *instancesToFlush = 0;
428 426
429 SkDEBUGCODE(success =) atlas->addToAtlas(&id, batchTarget, width, he ight, 427 SkDEBUGCODE(success =) atlas->addToAtlas(&id, batchTarget, width, he ight,
430 dfStorage.get(), &atlasLoca tion); 428 dfStorage.get(), &atlasLoca tion);
431 SkASSERT(success); 429 SkASSERT(success);
432 430
433 } 431 }
434 432
435 // add to cache 433 // add to cache
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // TODO remove this when batch is everywhere 507 // TODO remove this when batch is everywhere
510 GrPipelineInfo init; 508 GrPipelineInfo init;
511 init.fColorIgnored = fBatch.fColorIgnored; 509 init.fColorIgnored = fBatch.fColorIgnored;
512 init.fOverrideColor = GrColor_ILLEGAL; 510 init.fOverrideColor = GrColor_ILLEGAL;
513 init.fCoverageIgnored = fBatch.fCoverageIgnored; 511 init.fCoverageIgnored = fBatch.fCoverageIgnored;
514 init.fUsesLocalCoords = this->usesLocalCoords(); 512 init.fUsesLocalCoords = this->usesLocalCoords();
515 dfProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init); 513 dfProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init);
516 } 514 }
517 515
518 void flush(GrBatchTarget* batchTarget, 516 void flush(GrBatchTarget* batchTarget,
519 const GrGeometryProcessor* dfProcessor,
520 const GrPipeline* pipeline,
521 GrDrawTarget::DrawInfo* drawInfo, 517 GrDrawTarget::DrawInfo* drawInfo,
522 int instanceCount, 518 int instanceCount,
523 int maxInstancesPerDraw) { 519 int maxInstancesPerDraw) {
524 while (instanceCount) { 520 while (instanceCount) {
525 drawInfo->setInstanceCount(SkTMin(instanceCount, maxInstancesPerDraw )); 521 drawInfo->setInstanceCount(SkTMin(instanceCount, maxInstancesPerDraw ));
526 drawInfo->setVertexCount(drawInfo->instanceCount() * drawInfo->verti cesPerInstance()); 522 drawInfo->setVertexCount(drawInfo->instanceCount() * drawInfo->verti cesPerInstance());
527 drawInfo->setIndexCount(drawInfo->instanceCount() * drawInfo->indice sPerInstance()); 523 drawInfo->setIndexCount(drawInfo->instanceCount() * drawInfo->indice sPerInstance());
528 524
529 batchTarget->draw(*drawInfo); 525 batchTarget->draw(*drawInfo);
530 526
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color , viewMatrix, 607 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color , viewMatrix,
612 fAtlas, &fPathC ache, &fPathList)); 608 fAtlas, &fPathC ache, &fPathList));
613 609
614 SkRect bounds = path.getBounds(); 610 SkRect bounds = path.getBounds();
615 viewMatrix.mapRect(&bounds); 611 viewMatrix.mapRect(&bounds);
616 target->drawBatch(pipelineBuilder, batch, &bounds); 612 target->drawBatch(pipelineBuilder, batch, &bounds);
617 613
618 return true; 614 return true;
619 } 615 }
620 616
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrBatchAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698