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

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

Issue 1159973002: Break GrTextContext's reliance on SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up 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 | « no previous file | src/gpu/GrAtlasTextContext.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 7
8 #ifndef GrAtlasTextContext_DEFINED 8 #ifndef GrAtlasTextContext_DEFINED
9 #define GrAtlasTextContext_DEFINED 9 #define GrAtlasTextContext_DEFINED
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const SkPaint&, const SkMatrix& viewMatrix) override; 45 const SkPaint&, const SkMatrix& viewMatrix) override;
46 46
47 void onDrawText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrPain t&, const SkPaint&, 47 void onDrawText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrPain t&, const SkPaint&,
48 const SkMatrix& viewMatrix, const char text[], size_t byteLe ngth, 48 const SkMatrix& viewMatrix, const char text[], size_t byteLe ngth,
49 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove rride; 49 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove rride;
50 void onDrawPosText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrP aint&, 50 void onDrawPosText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrP aint&,
51 const SkPaint&, const SkMatrix& viewMatrix, 51 const SkPaint&, const SkMatrix& viewMatrix,
52 const char text[], size_t byteLength, 52 const char text[], size_t byteLength,
53 const SkScalar pos[], int scalarsPerPosition, 53 const SkScalar pos[], int scalarsPerPosition,
54 const SkPoint& offset, const SkIRect& regionClipBounds) o verride; 54 const SkPoint& offset, const SkIRect& regionClipBounds) o verride;
55 void drawTextBlob(SkGpuDevice*, GrRenderTarget*, const GrClip&, const SkPain t&, 55 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
56 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 56 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y,
57 SkDrawFilter*, const SkIRect& clipBounds) override; 57 SkDrawFilter*, const SkIRect& clipBounds) override;
58 58
59 /* 59 /*
60 * A BitmapTextBlob contains a fully processed SkTextBlob, suitable for near ly immediate drawing 60 * A BitmapTextBlob contains a fully processed SkTextBlob, suitable for near ly immediate drawing
61 * on the GPU. These are initially created with valid positions and colors, but invalid 61 * on the GPU. These are initially created with valid positions and colors, but invalid
62 * texture coordinates. The BitmapTextBlob itself has a few Blob-wide prope rties, and also 62 * texture coordinates. The BitmapTextBlob itself has a few Blob-wide prope rties, and also
63 * consists of a number of runs. Runs inside a blob are flushed individuall y so they can be 63 * consists of a number of runs. Runs inside a blob are flushed individuall y so they can be
64 * reordered. 64 * reordered.
65 * 65 *
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala r sx, SkScalar sy, 264 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala r sx, SkScalar sy,
265 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk Scalar textRatio, 265 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk Scalar textRatio,
266 const SkMatrix& viewMatrix); 266 const SkMatrix& viewMatrix);
267 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, 267 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph,
268 GrFontScaler* scaler, SkScalar x, SkScalar y); 268 GrFontScaler* scaler, SkScalar x, SkScalar y);
269 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, 269 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*,
270 const SkRect& positions, GrColor color, 270 const SkRect& positions, GrColor color,
271 size_t vertexStride, bool useVertexColor, 271 size_t vertexStride, bool useVertexColor,
272 GrGlyph*); 272 GrGlyph*);
273 273
274 inline void flushRunAsPaths(SkGpuDevice*, GrDrawContext*, GrRenderTarget*, 274 inline void flushRunAsPaths(GrDrawContext*, GrRenderTarget*,
275 const SkTextBlob::RunIterator&, const GrClip& cl ip, 275 const SkTextBlob::RunIterator&, const GrClip& cl ip,
276 const SkPaint&, SkDrawFilter*, 276 const SkPaint&, SkDrawFilter*,
277 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x, 277 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x,
278 SkScalar y); 278 SkScalar y);
279 inline BitmapTextBatch* createBatch(BitmapTextBlob*, const PerSubRunInfo&, 279 inline BitmapTextBatch* createBatch(BitmapTextBlob*, const PerSubRunInfo&,
280 int glyphCount, int run, int subRun, 280 int glyphCount, int run, int subRun,
281 GrColor, SkScalar transX, SkScalar trans Y, 281 GrColor, SkScalar transX, SkScalar trans Y,
282 const SkPaint&); 282 const SkPaint&);
283 inline void flushRun(GrDrawContext*, GrPipelineBuilder*, BitmapTextBlob*, in t run, GrColor, 283 inline void flushRun(GrDrawContext*, GrPipelineBuilder*, BitmapTextBlob*, in t run, GrColor,
284 SkScalar transX, SkScalar transY, const SkPaint&); 284 SkScalar transX, SkScalar transY, const SkPaint&);
285 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrDrawContext*, GrRend erTarget*, 285 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrDrawContext*, GrRend erTarget*,
286 const GrClip& clip, const SkPaint& skPaint, 286 const GrClip& clip, const SkPaint& skPaint,
287 SkScalar transX, SkScalar transY, const SkIRect& clipBounds); 287 SkScalar transX, SkScalar transY, const SkIRect& clipBounds);
288 288
289 // We have to flush SkTextBlobs differently from drawText / drawPosText 289 // We have to flush SkTextBlobs differently from drawText / drawPosText
290 void flush(SkGpuDevice*, GrDrawContext*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget*, 290 void flush(GrDrawContext*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarge t*,
291 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, 291 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&,
292 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x , SkScalar y, 292 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x , SkScalar y,
293 SkScalar transX, SkScalar transY); 293 SkScalar transX, SkScalar transY);
294 void flush(GrDrawContext*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, 294 void flush(GrDrawContext*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
295 const GrPaint&, const GrClip&, const SkIRect& clipBounds); 295 const GrPaint&, const GrClip&, const SkIRect& clipBounds);
296 296
297 // A helper for drawing BitmapText in a run of distance fields 297 // A helper for drawing BitmapText in a run of distance fields
298 inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex, 298 inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex,
299 GrRenderTarget*, const GrClip&, 299 GrRenderTarget*, const GrClip&,
300 const GrPaint&, 300 const GrPaint&,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 SkTDArray<char>* fallbackTxt, 332 SkTDArray<char>* fallbackTxt,
333 SkTDArray<SkScalar>* fallbackPos); 333 SkTDArray<SkScalar>* fallbackPos);
334 334
335 // sets up the descriptor on the blob and returns a detached cache. Client must attach 335 // sets up the descriptor on the blob and returns a detached cache. Client must attach
336 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); 336 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd);
337 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma); 337 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma);
338 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY, 338 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY,
339 const BitmapTextBlob&, const SkPaint&, 339 const BitmapTextBlob&, const SkPaint&,
340 const SkMaskFilter::BlurRec&, 340 const SkMaskFilter::BlurRec&,
341 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); 341 const SkMatrix& viewMatrix, SkScalar x , SkScalar y);
342 void regenerateTextBlob(SkGpuDevice*, BitmapTextBlob* bmp, const SkPaint& sk Paint, GrColor, 342 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor ,
343 const SkMatrix& viewMatrix, 343 const SkMatrix& viewMatrix,
344 const SkTextBlob* blob, SkScalar x, SkScalar y, 344 const SkTextBlob* blob, SkScalar x, SkScalar y,
345 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*, 345 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*,
346 const GrClip&, const GrPaint&); 346 const GrClip&, const GrPaint&);
347 inline static bool HasLCD(const SkTextBlob*); 347 inline static bool HasLCD(const SkTextBlob*);
348 inline void initDistanceFieldPaint(BitmapTextBlob*, SkPaint*, SkScalar* text Ratio, 348 inline void initDistanceFieldPaint(BitmapTextBlob*, SkPaint*, SkScalar* text Ratio,
349 const SkMatrix&); 349 const SkMatrix&);
350 350
351 // Test methods 351 // Test methods
352 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch 352 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 friend class BitmapTextBatch; 391 friend class BitmapTextBatch;
392 392
393 #ifdef GR_TEST_UTILS 393 #ifdef GR_TEST_UTILS
394 BATCH_TEST_FRIEND(TextBlobBatch); 394 BATCH_TEST_FRIEND(TextBlobBatch);
395 #endif 395 #endif
396 396
397 typedef GrTextContext INHERITED; 397 typedef GrTextContext INHERITED;
398 }; 398 };
399 399
400 #endif 400 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698