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

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

Issue 1227153003: Remove setFromPaint from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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 | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrDrawContext.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 * 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 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 const SkPaint& skPaint, 2160 const SkPaint& skPaint,
2161 const GrPaint& grPaint, 2161 const GrPaint& grPaint,
2162 SkDrawFilter* drawFilter, 2162 SkDrawFilter* drawFilter,
2163 const GrClip& clip, 2163 const GrClip& clip,
2164 const SkMatrix& viewMatrix, 2164 const SkMatrix& viewMatrix,
2165 const SkIRect& clipBounds, 2165 const SkIRect& clipBounds,
2166 SkScalar x, SkScalar y, 2166 SkScalar x, SkScalar y,
2167 SkScalar transX, SkScalar transY) { 2167 SkScalar transX, SkScalar transY) {
2168 // We loop through the runs of the blob, flushing each. If any run is too l arge, then we flush 2168 // We loop through the runs of the blob, flushing each. If any run is too l arge, then we flush
2169 // it as paths 2169 // it as paths
2170 GrPipelineBuilder pipelineBuilder; 2170 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
2171 pipelineBuilder.setFromPaint(grPaint, rt, clip);
2172 2171
2173 GrColor color = grPaint.getColor(); 2172 GrColor color = grPaint.getColor();
2174 2173
2175 SkTextBlob::RunIterator it(blob); 2174 SkTextBlob::RunIterator it(blob);
2176 for (int run = 0; !it.done(); it.next(), run++) { 2175 for (int run = 0; !it.done(); it.next(), run++) {
2177 if (cacheBlob->fRuns[run].fDrawAsPaths) { 2176 if (cacheBlob->fRuns[run].fDrawAsPaths) {
2178 this->flushRunAsPaths(rt, it, clip, skPaint, 2177 this->flushRunAsPaths(rt, it, clip, skPaint,
2179 drawFilter, viewMatrix, clipBounds, x, y); 2178 drawFilter, viewMatrix, clipBounds, x, y);
2180 continue; 2179 continue;
2181 } 2180 }
2182 cacheBlob->fRuns[run].fVertexBounds.offset(transX, transY); 2181 cacheBlob->fRuns[run].fVertexBounds.offset(transX, transY);
2183 this->flushRun(&pipelineBuilder, cacheBlob, run, color, 2182 this->flushRun(&pipelineBuilder, cacheBlob, run, color,
2184 transX, transY, skPaint); 2183 transX, transY, skPaint);
2185 } 2184 }
2186 2185
2187 // Now flush big glyphs 2186 // Now flush big glyphs
2188 this->flushBigGlyphs(cacheBlob, rt, clip, skPaint, transX, transY, clipBound s); 2187 this->flushBigGlyphs(cacheBlob, rt, clip, skPaint, transX, transY, clipBound s);
2189 } 2188 }
2190 2189
2191 void GrAtlasTextContext::flush(BitmapTextBlob* cacheBlob, 2190 void GrAtlasTextContext::flush(BitmapTextBlob* cacheBlob,
2192 GrRenderTarget* rt, 2191 GrRenderTarget* rt,
2193 const SkPaint& skPaint, 2192 const SkPaint& skPaint,
2194 const GrPaint& grPaint, 2193 const GrPaint& grPaint,
2195 const GrClip& clip, 2194 const GrClip& clip,
2196 const SkIRect& clipBounds) { 2195 const SkIRect& clipBounds) {
2197 GrPipelineBuilder pipelineBuilder; 2196 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
2198 pipelineBuilder.setFromPaint(grPaint, rt, clip);
2199 2197
2200 GrColor color = grPaint.getColor(); 2198 GrColor color = grPaint.getColor();
2201 for (int run = 0; run < cacheBlob->fRunCount; run++) { 2199 for (int run = 0; run < cacheBlob->fRunCount; run++) {
2202 this->flushRun(&pipelineBuilder, cacheBlob, run, color, 0, 0, skPaint); 2200 this->flushRun(&pipelineBuilder, cacheBlob, run, color, 0, 0, skPaint);
2203 } 2201 }
2204 2202
2205 // Now flush big glyphs 2203 // Now flush big glyphs
2206 this->flushBigGlyphs(cacheBlob, rt, clip, skPaint, 0, 0, clipBounds); 2204 this->flushBigGlyphs(cacheBlob, rt, clip, skPaint, 0, 0, clipBounds);
2207 } 2205 }
2208 2206
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2264 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2267 static_cast<size_t>(textLen), 0, 0, noClip)); 2265 static_cast<size_t>(textLen), 0, 0, noClip));
2268 2266
2269 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2267 SkScalar transX = static_cast<SkScalar>(random->nextU());
2270 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2268 SkScalar transY = static_cast<SkScalar>(random->nextU());
2271 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0]; 2269 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0];
2272 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2270 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2273 } 2271 }
2274 2272
2275 #endif 2273 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698