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

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

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused inheriteds to satisfy clang Created 5 years, 2 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/effects/gradients/SkTwoPointConicalGradient.cpp ('k') | src/gpu/GrBlurUtils.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 "GrBatchFontCache.h" 9 #include "GrBatchFontCache.h"
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 11 matching lines...) Expand all
22 22
23 #include "SkAutoKern.h" 23 #include "SkAutoKern.h"
24 #include "SkColorPriv.h" 24 #include "SkColorPriv.h"
25 #include "SkColorFilter.h" 25 #include "SkColorFilter.h"
26 #include "SkDistanceFieldGen.h" 26 #include "SkDistanceFieldGen.h"
27 #include "SkDraw.h" 27 #include "SkDraw.h"
28 #include "SkDrawFilter.h" 28 #include "SkDrawFilter.h"
29 #include "SkDrawProcs.h" 29 #include "SkDrawProcs.h"
30 #include "SkGlyphCache.h" 30 #include "SkGlyphCache.h"
31 #include "SkGpuDevice.h" 31 #include "SkGpuDevice.h"
32 #include "SkGr.h" 32 #include "SkGrPriv.h"
33 #include "SkPath.h" 33 #include "SkPath.h"
34 #include "SkRTConf.h" 34 #include "SkRTConf.h"
35 #include "SkStrokeRec.h" 35 #include "SkStrokeRec.h"
36 #include "SkTextBlob.h" 36 #include "SkTextBlob.h"
37 #include "SkTextMapStateProc.h" 37 #include "SkTextMapStateProc.h"
38 38
39 #include "batches/GrVertexBatch.h" 39 #include "batches/GrVertexBatch.h"
40 40
41 #include "effects/GrBitmapTextGeoProc.h" 41 #include "effects/GrBitmapTextGeoProc.h"
42 #include "effects/GrDistanceFieldGeoProc.h" 42 #include "effects/GrDistanceFieldGeoProc.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 SkIRect clipRect; 383 SkIRect clipRect;
384 clip.getConservativeBounds(rt->width(), rt->height(), &clipRect); 384 clip.getConservativeBounds(rt->width(), rt->height(), &clipRect);
385 385
386 SkScalar transX = 0.f; 386 SkScalar transX = 0.f;
387 SkScalar transY = 0.f; 387 SkScalar transY = 0.f;
388 388
389 // Though for the time being runs in the textblob can override the paint, th ey only touch font 389 // Though for the time being runs in the textblob can override the paint, th ey only touch font
390 // info. 390 // info.
391 GrPaint grPaint; 391 GrPaint grPaint;
392 if (!SkPaint2GrPaint(fContext, skPaint, viewMatrix, true, &grPaint)) { 392 if (!SkPaintToGrPaint(fContext, skPaint, viewMatrix, &grPaint)) {
393 return; 393 return;
394 } 394 }
395 395
396 if (cacheBlob) { 396 if (cacheBlob) {
397 if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, grPaint.ge tColor(), blurRec, 397 if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, grPaint.ge tColor(), blurRec,
398 viewMatrix, x, y)) { 398 viewMatrix, x, y)) {
399 // We have to remake the blob because changes may invalidate our mas ks. 399 // We have to remake the blob because changes may invalidate our mas ks.
400 // TODO we could probably get away reuse most of the time if the poi nter is unique, 400 // TODO we could probably get away reuse most of the time if the poi nter is unique,
401 // but we'd have to clear the subrun information 401 // but we'd have to clear the subrun information
402 fCache->remove(cacheBlob); 402 fCache->remove(cacheBlob);
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 // Setup dummy SkPaint / GrPaint 2258 // Setup dummy SkPaint / GrPaint
2259 GrColor color = GrRandomColor(random); 2259 GrColor color = GrRandomColor(random);
2260 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); 2260 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
2261 SkPaint skPaint; 2261 SkPaint skPaint;
2262 skPaint.setColor(color); 2262 skPaint.setColor(color);
2263 skPaint.setLCDRenderText(random->nextBool()); 2263 skPaint.setLCDRenderText(random->nextBool());
2264 skPaint.setAntiAlias(skPaint.isLCDRenderText() ? true : random->nextBool()); 2264 skPaint.setAntiAlias(skPaint.isLCDRenderText() ? true : random->nextBool());
2265 skPaint.setSubpixelText(random->nextBool()); 2265 skPaint.setSubpixelText(random->nextBool());
2266 2266
2267 GrPaint grPaint; 2267 GrPaint grPaint;
2268 if (!SkPaint2GrPaint(context, skPaint, viewMatrix, true, &grPaint)) { 2268 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, &grPaint)) {
2269 SkFAIL("couldn't convert paint\n"); 2269 SkFAIL("couldn't convert paint\n");
2270 } 2270 }
2271 2271
2272 const char* text = "The quick brown fox jumps over the lazy dog."; 2272 const char* text = "The quick brown fox jumps over the lazy dog.";
2273 int textLen = (int)strlen(text); 2273 int textLen = (int)strlen(text);
2274 2274
2275 // Setup clip 2275 // Setup clip
2276 GrClip clip; 2276 GrClip clip;
2277 SkIRect noClip = SkIRect::MakeLargest(); 2277 SkIRect noClip = SkIRect::MakeLargest();
2278 2278
2279 // right now we don't handle textblobs, nor do we handle drawPosText. Since we only 2279 // right now we don't handle textblobs, nor do we handle drawPosText. Since we only
2280 // intend to test the batch with this unit test, that is okay. 2280 // intend to test the batch with this unit test, that is okay.
2281 SkAutoTUnref<GrAtlasTextBlob> blob( 2281 SkAutoTUnref<GrAtlasTextBlob> blob(
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/effects/gradients/SkTwoPointConicalGradient.cpp ('k') | src/gpu/GrBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698