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

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

Issue 1256843003: Set preallocated TextBatch geometries to 4 rather than 32 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | 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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 currVertex += byteCount; 1766 currVertex += byteCount;
1767 } 1767 }
1768 // Make sure to attach the last cache if applicable 1768 // Make sure to attach the last cache if applicable
1769 if (cache) { 1769 if (cache) {
1770 SkGlyphCache::AttachCache(cache); 1770 SkGlyphCache::AttachCache(cache);
1771 } 1771 }
1772 this->flush(batchTarget, &flushInfo); 1772 this->flush(batchTarget, &flushInfo);
1773 } 1773 }
1774 1774
1775 // The minimum number of Geometry we will try to allocate. 1775 // The minimum number of Geometry we will try to allocate.
1776 static const int kMinAllocated = 32; 1776 static const int kMinAllocated = 4;
1777 1777
1778 // Total number of Geometry this Batch owns 1778 // Total number of Geometry this Batch owns
1779 int instanceCount() const { return fInstanceCount; } 1779 int instanceCount() const { return fInstanceCount; }
1780 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; } 1780 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; }
1781 1781
1782 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which 1782 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which
1783 // is used to seed the batch with its initial geometry. After seeding, the client should call 1783 // is used to seed the batch with its initial geometry. After seeding, the client should call
1784 // init() so the Batch can initialize itself 1784 // init() so the Batch can initialize itself
1785 Geometry& geometry() { return fGeoData[0]; } 1785 Geometry& geometry() { return fGeoData[0]; }
1786 void init() { 1786 void init() {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2291 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2292 static_cast<size_t>(textLen), 0, 0, noClip)); 2292 static_cast<size_t>(textLen), 0, 0, noClip));
2293 2293
2294 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2294 SkScalar transX = static_cast<SkScalar>(random->nextU());
2295 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2295 SkScalar transY = static_cast<SkScalar>(random->nextU());
2296 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; 2296 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ;
2297 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2297 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2298 } 2298 }
2299 2299
2300 #endif 2300 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698