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

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

Issue 1231923002: Remove init function from GrTextContext.h (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 | « 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 "GrBlurUtils.h" 9 #include "GrBlurUtils.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 14 matching lines...) Expand all
25 : fFallbackTextContext(NULL) 25 : fFallbackTextContext(NULL)
26 , fContext(context) 26 , fContext(context)
27 , fSurfaceProps(surfaceProps) 27 , fSurfaceProps(surfaceProps)
28 , fDrawContext(drawContext) { 28 , fDrawContext(drawContext) {
29 } 29 }
30 30
31 GrTextContext::~GrTextContext() { 31 GrTextContext::~GrTextContext() {
32 SkDELETE(fFallbackTextContext); 32 SkDELETE(fFallbackTextContext);
33 } 33 }
34 34
35 void GrTextContext::init(GrRenderTarget* rt, const GrClip& clip, const GrPaint& grPaint,
36 const SkPaint& skPaint, const SkIRect& regionClipBounds ) {
37 fClip = clip;
38
39 fRenderTarget.reset(SkRef(rt));
40
41 fRegionClipBounds = regionClipBounds;
42 fClip.getConservativeBounds(fRenderTarget->width(), fRenderTarget->height(), &fClipRect);
43
44 fPaint = grPaint;
45 fSkPaint = skPaint;
46 }
47
48 void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint, 35 void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint,
49 const SkPaint& skPaint, const SkMatrix& viewMatrix, 36 const SkPaint& skPaint, const SkMatrix& viewMatrix,
50 const char text[], size_t byteLength, 37 const char text[], size_t byteLength,
51 SkScalar x, SkScalar y, const SkIRect& clipBounds) { 38 SkScalar x, SkScalar y, const SkIRect& clipBounds) {
52 if (fContext->abandoned() || !fDrawContext) { 39 if (fContext->abandoned() || !fDrawContext) {
53 return; 40 return;
54 } 41 }
55 42
56 GrTextContext* textContext = this; 43 GrTextContext* textContext = this;
57 do { 44 do {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 127
141 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ e)) { 128 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ e)) {
142 // A false return from filter() means we should abort the current dr aw. 129 // A false return from filter() means we should abort the current dr aw.
143 runPaint = skPaint; 130 runPaint = skPaint;
144 continue; 131 continue;
145 } 132 }
146 133
147 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); 134 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint));
148 135
149 GrPaint grPaint; 136 GrPaint grPaint;
150 if (!SkPaint2GrPaint(fContext, fRenderTarget, runPaint, viewMatrix, true , &grPaint)) { 137 if (!SkPaint2GrPaint(fContext, rt, runPaint, viewMatrix, true, &grPaint) ) {
151 return; 138 return;
152 } 139 }
153 140
154 switch (it.positioning()) { 141 switch (it.positioning()) {
155 case SkTextBlob::kDefault_Positioning: 142 case SkTextBlob::kDefault_Positioning:
156 this->drawText(rt, clip, grPaint, runPaint, viewMatrix, (const char *)it.glyphs(), 143 this->drawText(rt, clip, grPaint, runPaint, viewMatrix, (const char *)it.glyphs(),
157 textLen, x + offset.x(), y + offset.y(), clipBounds); 144 textLen, x + offset.x(), y + offset.y(), clipBounds);
158 break; 145 break;
159 case SkTextBlob::kHorizontal_Positioning: 146 case SkTextBlob::kHorizontal_Positioning:
160 this->drawPosText(rt, clip, grPaint, runPaint, viewMatrix, (const ch ar*)it.glyphs(), 147 this->drawPosText(rt, clip, grPaint, runPaint, viewMatrix, (const ch ar*)it.glyphs(),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { 273 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
287 scaler = (GrFontScaler*)auxData; 274 scaler = (GrFontScaler*)auxData;
288 } 275 }
289 if (NULL == scaler) { 276 if (NULL == scaler) {
290 scaler = SkNEW_ARGS(GrFontScaler, (cache)); 277 scaler = SkNEW_ARGS(GrFontScaler, (cache));
291 cache->setAuxProc(GlyphCacheAuxProc, scaler); 278 cache->setAuxProc(GlyphCacheAuxProc, scaler);
292 } 279 }
293 280
294 return scaler; 281 return scaler;
295 } 282 }
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