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

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

Issue 650273003: Change GrTextContext fallbacks to be a linked list chain. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix include Created 6 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/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrContext.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBitmapTextContext.h" 8 #include "GrBitmapTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 fCurrTexture = NULL; 59 fCurrTexture = NULL;
60 fCurrVertex = 0; 60 fCurrVertex = 0;
61 fEffectTextureUniqueID = SK_InvalidUniqueID; 61 fEffectTextureUniqueID = SK_InvalidUniqueID;
62 62
63 fVertices = NULL; 63 fVertices = NULL;
64 fMaxVertices = 0; 64 fMaxVertices = 0;
65 65
66 fVertexBounds.setLargestInverted(); 66 fVertexBounds.setLargestInverted();
67 } 67 }
68 68
69 GrBitmapTextContext* GrBitmapTextContext::Create(GrContext* context,
70 const SkDeviceProperties& props ) {
71 return SkNEW_ARGS(GrBitmapTextContext, (context, props));
72 }
73
69 GrBitmapTextContext::~GrBitmapTextContext() { 74 GrBitmapTextContext::~GrBitmapTextContext() {
70 this->flush(); 75 this->flush();
71 } 76 }
72 77
73 bool GrBitmapTextContext::canDraw(const SkPaint& paint) { 78 bool GrBitmapTextContext::canDraw(const SkPaint& paint) {
74 return !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix()); 79 return !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
75 } 80 }
76 81
77 inline void GrBitmapTextContext::init(const GrPaint& paint, const SkPaint& skPai nt) { 82 inline void GrBitmapTextContext::init(const GrPaint& paint, const SkPaint& skPai nt) {
78 GrTextContext::init(paint, skPaint); 83 GrTextContext::init(paint, skPaint);
79 84
80 fStrike = NULL; 85 fStrike = NULL;
81 86
82 fCurrTexture = NULL; 87 fCurrTexture = NULL;
83 fCurrVertex = 0; 88 fCurrVertex = 0;
84 89
85 fVertices = NULL; 90 fVertices = NULL;
86 fMaxVertices = 0; 91 fMaxVertices = 0;
87 } 92 }
88 93
89 void GrBitmapTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint, 94 void GrBitmapTextContext::onDrawText(const GrPaint& paint, const SkPaint& skPain t,
90 const char text[], size_t byteLength, 95 const char text[], size_t byteLength,
91 SkScalar x, SkScalar y) { 96 SkScalar x, SkScalar y) {
92 SkASSERT(byteLength == 0 || text != NULL); 97 SkASSERT(byteLength == 0 || text != NULL);
93 98
94 // nothing to draw 99 // nothing to draw
95 if (text == NULL || byteLength == 0 /*|| fRC->isEmpty()*/) { 100 if (text == NULL || byteLength == 0 /*|| fRC->isEmpty()*/) {
96 return; 101 return;
97 } 102 }
98 103
99 this->init(paint, skPaint); 104 this->init(paint, skPaint);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 fontScaler); 175 fontScaler);
171 } 176 }
172 177
173 fx += glyph.fAdvanceX; 178 fx += glyph.fAdvanceX;
174 fy += glyph.fAdvanceY; 179 fy += glyph.fAdvanceY;
175 } 180 }
176 181
177 this->finish(); 182 this->finish();
178 } 183 }
179 184
180 void GrBitmapTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPai nt, 185 void GrBitmapTextContext::onDrawPosText(const GrPaint& paint, const SkPaint& skP aint,
181 const char text[], size_t byteLength, 186 const char text[], size_t byteLength,
182 const SkScalar pos[], int scalarsPerPositi on, 187 const SkScalar pos[], int scalarsPerPositi on,
183 const SkPoint& offset) { 188 const SkPoint& offset) {
184 SkASSERT(byteLength == 0 || text != NULL); 189 SkASSERT(byteLength == 0 || text != NULL);
185 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); 190 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
186 191
187 // nothing to draw 192 // nothing to draw
188 if (text == NULL || byteLength == 0/* || fRC->isEmpty()*/) { 193 if (text == NULL || byteLength == 0/* || fRC->isEmpty()*/) {
189 return; 194 return;
190 } 195 }
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 SkSafeSetNull(fCurrTexture); 608 SkSafeSetNull(fCurrTexture);
604 } 609 }
605 } 610 }
606 611
607 inline void GrBitmapTextContext::finish() { 612 inline void GrBitmapTextContext::finish() {
608 this->flush(); 613 this->flush();
609 614
610 GrTextContext::finish(); 615 GrTextContext::finish();
611 } 616 }
612 617
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698