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

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

Issue 1275083002: Don't pass pipeline to GrBatch::generateGeometry() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/GrAARectRenderer.cpp ('k') | src/gpu/GrBatch.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 * 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 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrBatch.h" 9 #include "GrBatch.h"
10 #include "GrBatchFontCache.h" 10 #include "GrBatchFontCache.h"
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 fBatch.fCoverageIgnored = !init.readsCoverage(); 1528 fBatch.fCoverageIgnored = !init.readsCoverage();
1529 } 1529 }
1530 1530
1531 struct FlushInfo { 1531 struct FlushInfo {
1532 SkAutoTUnref<const GrVertexBuffer> fVertexBuffer; 1532 SkAutoTUnref<const GrVertexBuffer> fVertexBuffer;
1533 SkAutoTUnref<const GrIndexBuffer> fIndexBuffer; 1533 SkAutoTUnref<const GrIndexBuffer> fIndexBuffer;
1534 int fGlyphsToFlush; 1534 int fGlyphsToFlush;
1535 int fVertexOffset; 1535 int fVertexOffset;
1536 }; 1536 };
1537 1537
1538 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 1538 void generateGeometry(GrBatchTarget* batchTarget) override {
1539 // if we have RGB, then we won't have any SkShaders so no need to use a localmatrix. 1539 // if we have RGB, then we won't have any SkShaders so no need to use a localmatrix.
1540 // TODO actually only invert if we don't have RGBA 1540 // TODO actually only invert if we don't have RGBA
1541 SkMatrix localMatrix; 1541 SkMatrix localMatrix;
1542 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) { 1542 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) {
1543 SkDebugf("Cannot invert viewmatrix\n"); 1543 SkDebugf("Cannot invert viewmatrix\n");
1544 return; 1544 return;
1545 } 1545 }
1546 1546
1547 GrTexture* texture = fFontCache->getTexture(this->maskFormat()); 1547 GrTexture* texture = fFontCache->getTexture(this->maskFormat());
1548 if (!texture) { 1548 if (!texture) {
(...skipping 19 matching lines...) Expand all
1568 this->usesLocalCoords())); 1568 this->usesLocalCoords()));
1569 } 1569 }
1570 1570
1571 FlushInfo flushInfo; 1571 FlushInfo flushInfo;
1572 flushInfo.fGlyphsToFlush = 0; 1572 flushInfo.fGlyphsToFlush = 0;
1573 size_t vertexStride = gp->getVertexStride(); 1573 size_t vertexStride = gp->getVertexStride();
1574 SkASSERT(vertexStride == (usesDistanceFields ? 1574 SkASSERT(vertexStride == (usesDistanceFields ?
1575 get_vertex_stride_df(maskFormat, isLCD) : 1575 get_vertex_stride_df(maskFormat, isLCD) :
1576 get_vertex_stride(maskFormat))); 1576 get_vertex_stride(maskFormat)));
1577 1577
1578 batchTarget->initDraw(gp, pipeline); 1578 batchTarget->initDraw(gp, this->pipeline());
1579 1579
1580 int glyphCount = this->numGlyphs(); 1580 int glyphCount = this->numGlyphs();
1581 const GrVertexBuffer* vertexBuffer; 1581 const GrVertexBuffer* vertexBuffer;
1582 1582
1583 void* vertices = batchTarget->makeVertSpace(vertexStride, 1583 void* vertices = batchTarget->makeVertSpace(vertexStride,
1584 glyphCount * kVerticesPerGly ph, 1584 glyphCount * kVerticesPerGly ph,
1585 &vertexBuffer, 1585 &vertexBuffer,
1586 &flushInfo.fVertexOffset); 1586 &flushInfo.fVertexOffset);
1587 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer)); 1587 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer));
1588 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd exBuffer()); 1588 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd exBuffer());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 SkASSERT(glyph); 1685 SkASSERT(glyph);
1686 SkASSERT(id == glyph->fPackedID); 1686 SkASSERT(id == glyph->fPackedID);
1687 // We want to be able to assert this but cannot for test ing purposes. 1687 // We want to be able to assert this but cannot for test ing purposes.
1688 // once skbug:4143 has landed we can revist this assert 1688 // once skbug:4143 has landed we can revist this assert
1689 //SkASSERT(glyph->fMaskFormat == this->maskFormat()); 1689 //SkASSERT(glyph->fMaskFormat == this->maskFormat());
1690 1690
1691 if (!fFontCache->hasGlyph(glyph) && 1691 if (!fFontCache->hasGlyph(glyph) &&
1692 !strike->addGlyphToAtlas(batchTarget, glyph, scaler, skGlyph, 1692 !strike->addGlyphToAtlas(batchTarget, glyph, scaler, skGlyph,
1693 maskFormat)) { 1693 maskFormat)) {
1694 this->flush(batchTarget, &flushInfo); 1694 this->flush(batchTarget, &flushInfo);
1695 batchTarget->initDraw(gp, pipeline); 1695 batchTarget->initDraw(gp, this->pipeline());
1696 brokenRun = glyphIdx > 0; 1696 brokenRun = glyphIdx > 0;
1697 1697
1698 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget, 1698 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget,
1699 glyph, 1699 glyph,
1700 scaler, 1700 scaler,
1701 skGlyph, 1701 skGlyph,
1702 maskFormat); 1702 maskFormat);
1703 SkASSERT(success); 1703 SkASSERT(success);
1704 } 1704 }
1705 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT oken, glyph, 1705 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT oken, glyph,
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2282 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2283 static_cast<size_t>(textLen), 0, 0, noClip)); 2283 static_cast<size_t>(textLen), 0, 0, noClip));
2284 2284
2285 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2285 SkScalar transX = static_cast<SkScalar>(random->nextU());
2286 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2286 SkScalar transY = static_cast<SkScalar>(random->nextU());
2287 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; 2287 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ;
2288 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2288 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2289 } 2289 }
2290 2290
2291 #endif 2291 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698