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

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

Issue 1128153005: Add unit tests to text context (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch9
Patch Set: windows warning 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 | « src/gpu/GrTextContext.h ('k') | 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 2010 Google Inc. 2 * Copyright 2010 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 #include "GrTextContext.h" 8 #include "GrTextContext.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 do { 59 do {
60 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { 60 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) {
61 textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, x, y, 61 textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, x, y,
62 clipBounds); 62 clipBounds);
63 return; 63 return;
64 } 64 }
65 textContext = textContext->fFallbackTextContext; 65 textContext = textContext->fFallbackTextContext;
66 } while (textContext); 66 } while (textContext);
67 67
68 // fall back to drawing as a path 68 // fall back to drawing as a path
69 SkASSERT(fGpuDevice);
69 this->drawTextAsPath(skPaint, viewMatrix, text, byteLength, x, y, clipBounds ); 70 this->drawTextAsPath(skPaint, viewMatrix, text, byteLength, x, y, clipBounds );
70 } 71 }
71 72
72 void GrTextContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& paint, 73 void GrTextContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& paint,
73 const SkPaint& skPaint, const SkMatrix& viewMatr ix, 74 const SkPaint& skPaint, const SkMatrix& viewMatr ix,
74 const char text[], size_t byteLength, 75 const char text[], size_t byteLength,
75 const SkScalar pos[], int scalarsPerPosition, 76 const SkScalar pos[], int scalarsPerPosition,
76 const SkPoint& offset, const SkIRect& clipBounds ) { 77 const SkPoint& offset, const SkIRect& clipBounds ) {
77 if (!fContext->getTextTarget()) { 78 if (!fContext->getTextTarget()) {
78 return; 79 return;
79 } 80 }
80 81
81 GrTextContext* textContext = this; 82 GrTextContext* textContext = this;
82 do { 83 do {
83 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { 84 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) {
84 textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, tex t, byteLength, pos, 85 textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, tex t, byteLength, pos,
85 scalarsPerPosition, offset, clipBounds); 86 scalarsPerPosition, offset, clipBounds);
86 return; 87 return;
87 } 88 }
88 textContext = textContext->fFallbackTextContext; 89 textContext = textContext->fFallbackTextContext;
89 } while (textContext); 90 } while (textContext);
90 91
91 // fall back to drawing as a path 92 // fall back to drawing as a path
93 SkASSERT(fGpuDevice);
92 this->drawPosTextAsPath(skPaint, viewMatrix, text, byteLength, pos, scalarsP erPosition, offset, 94 this->drawPosTextAsPath(skPaint, viewMatrix, text, byteLength, pos, scalarsP erPosition, offset,
93 clipBounds); 95 clipBounds);
94 } 96 }
95 97
96 void GrTextContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S kPaint& skPaint, 98 void GrTextContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S kPaint& skPaint,
97 const SkMatrix& viewMatrix, const SkTextBlob* b lob, 99 const SkMatrix& viewMatrix, const SkTextBlob* b lob,
98 SkScalar x, SkScalar y, 100 SkScalar x, SkScalar y,
99 SkDrawFilter* drawFilter, const SkIRect& clipBo unds) { 101 SkDrawFilter* drawFilter, const SkIRect& clipBo unds) {
100 SkPaint runPaint = skPaint; 102 SkPaint runPaint = skPaint;
101 103
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { 251 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
250 scaler = (GrFontScaler*)auxData; 252 scaler = (GrFontScaler*)auxData;
251 } 253 }
252 if (NULL == scaler) { 254 if (NULL == scaler) {
253 scaler = SkNEW_ARGS(GrFontScaler, (cache)); 255 scaler = SkNEW_ARGS(GrFontScaler, (cache));
254 cache->setAuxProc(GlyphCacheAuxProc, scaler); 256 cache->setAuxProc(GlyphCacheAuxProc, scaler);
255 } 257 }
256 258
257 return scaler; 259 return scaler;
258 } 260 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698