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

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

Issue 1132323003: Revert of Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode); 191 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode);
192 192
193 // Setup GrGeometryProcessor 193 // Setup GrGeometryProcessor
194 GrBatchAtlas* atlas = fAtlas; 194 GrBatchAtlas* atlas = fAtlas;
195 SkAutoTUnref<GrGeometryProcessor> dfProcessor( 195 SkAutoTUnref<GrGeometryProcessor> dfProcessor(
196 GrDistanceFieldPathGeoProc::Create(this->color(), 196 GrDistanceFieldPathGeoProc::Create(this->color(),
197 this->viewMatrix(), 197 this->viewMatrix(),
198 atlas->getTexture(), 198 atlas->getTexture(),
199 params, 199 params,
200 flags, 200 flags));
201 this->usesLocalCoords()));
202 201
203 batchTarget->initDraw(dfProcessor, pipeline); 202 this->initDraw(batchTarget, dfProcessor, pipeline);
204 203
205 FlushInfo flushInfo; 204 FlushInfo flushInfo;
206 205
207 // allocate vertices 206 // allocate vertices
208 size_t vertexStride = dfProcessor->getVertexStride(); 207 size_t vertexStride = dfProcessor->getVertexStride();
209 SkASSERT(vertexStride == 2 * sizeof(SkPoint)); 208 SkASSERT(vertexStride == 2 * sizeof(SkPoint));
210 209
211 const GrVertexBuffer* vertexBuffer; 210 const GrVertexBuffer* vertexBuffer;
212 void* vertices = batchTarget->makeVertSpace(vertexStride, 211 void* vertices = batchTarget->makeVertSpace(vertexStride,
213 kVerticesPerQuad * instanceC ount, 212 kVerticesPerQuad * instanceC ount,
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 bmp.width(), bmp.height(), bmp.ro wBytes()); 407 bmp.width(), bmp.height(), bmp.ro wBytes());
409 } 408 }
410 409
411 // add to atlas 410 // add to atlas
412 SkIPoint16 atlasLocation; 411 SkIPoint16 atlasLocation;
413 GrBatchAtlas::AtlasID id; 412 GrBatchAtlas::AtlasID id;
414 bool success = atlas->addToAtlas(&id, batchTarget, width, height, dfStor age.get(), 413 bool success = atlas->addToAtlas(&id, batchTarget, width, height, dfStor age.get(),
415 &atlasLocation); 414 &atlasLocation);
416 if (!success) { 415 if (!success) {
417 this->flush(batchTarget, flushInfo); 416 this->flush(batchTarget, flushInfo);
418 batchTarget->initDraw(dfProcessor, pipeline); 417 this->initDraw(batchTarget, dfProcessor, pipeline);
419 418
420 SkDEBUGCODE(success =) atlas->addToAtlas(&id, batchTarget, width, he ight, 419 SkDEBUGCODE(success =) atlas->addToAtlas(&id, batchTarget, width, he ight,
421 dfStorage.get(), &atlasLoca tion); 420 dfStorage.get(), &atlasLoca tion);
422 SkASSERT(success); 421 SkASSERT(success);
423 422
424 } 423 }
425 424
426 // add to cache 425 // add to cache
427 pathData->fKey.fGenID = path.getGenerationID(); 426 pathData->fKey.fGenID = path.getGenerationID();
428 pathData->fKey.fDimension = dimension; 427 pathData->fKey.fDimension = dimension;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 484
486 // vertex texture coords 485 // vertex texture coords
487 SkPoint* textureCoords = positions + 1; 486 SkPoint* textureCoords = positions + 1;
488 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normaliz eFixedX(tx)), 487 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normaliz eFixedX(tx)),
489 SkFixedToFloat(texture->texturePriv().normaliz eFixedY(ty)), 488 SkFixedToFloat(texture->texturePriv().normaliz eFixedY(ty)),
490 SkFixedToFloat(texture->texturePriv().normaliz eFixedX(tx + tw)), 489 SkFixedToFloat(texture->texturePriv().normaliz eFixedX(tx + tw)),
491 SkFixedToFloat(texture->texturePriv().normaliz eFixedY(ty + th)), 490 SkFixedToFloat(texture->texturePriv().normaliz eFixedY(ty + th)),
492 vertexStride); 491 vertexStride);
493 } 492 }
494 493
494 void initDraw(GrBatchTarget* batchTarget,
495 const GrGeometryProcessor* dfProcessor,
496 const GrPipeline* pipeline) {
497 batchTarget->initDraw(dfProcessor, pipeline);
498
499 // TODO remove this when batch is everywhere
500 GrPipelineInfo init;
501 init.fColorIgnored = fBatch.fColorIgnored;
502 init.fOverrideColor = GrColor_ILLEGAL;
503 init.fCoverageIgnored = fBatch.fCoverageIgnored;
504 init.fUsesLocalCoords = this->usesLocalCoords();
505 dfProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init);
506 }
507
495 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { 508 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) {
496 GrVertices vertices; 509 GrVertices vertices;
497 int maxInstancesPerDraw = flushInfo->fIndexBuffer->maxQuads(); 510 int maxInstancesPerDraw = flushInfo->fIndexBuffer->maxQuads();
498 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf fer, 511 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf fer,
499 flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad, 512 flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
500 kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw); 513 kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
501 batchTarget->draw(vertices); 514 batchTarget->draw(vertices);
502 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl ush; 515 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl ush;
503 flushInfo->fInstancesToFlush = 0; 516 flushInfo->fInstancesToFlush = 0;
504 } 517 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 geometry.fPath = GrTest::TestPath(random); 671 geometry.fPath = GrTest::TestPath(random);
659 geometry.fAntiAlias = random->nextBool(); 672 geometry.fAntiAlias = random->nextBool();
660 673
661 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 674 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
662 gTestStruct.fAtlas, 675 gTestStruct.fAtlas,
663 &gTestStruct.fPathCache, 676 &gTestStruct.fPathCache,
664 &gTestStruct.fPathList); 677 &gTestStruct.fPathList);
665 } 678 }
666 679
667 #endif 680 #endif
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