OLD | NEW |
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 #include "GrAtlasTextBatch.h" | 8 #include "GrAtlasTextBatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 140 matching lines...) Loading... |
151 // bounds sanity check | 151 // bounds sanity check |
152 SkRect rect; | 152 SkRect rect; |
153 rect.setLargestInverted(); | 153 rect.setLargestInverted(); |
154 SkPoint* vertex = (SkPoint*) ((char*)blobVertices); | 154 SkPoint* vertex = (SkPoint*) ((char*)blobVertices); |
155 rect.growToInclude(vertex, vertexStride, kVerticesPerGlyph * subRunGlyph
Count); | 155 rect.growToInclude(vertex, vertexStride, kVerticesPerGlyph * subRunGlyph
Count); |
156 | 156 |
157 if (this->usesDistanceFields()) { | 157 if (this->usesDistanceFields()) { |
158 args.fViewMatrix.mapRect(&rect); | 158 args.fViewMatrix.mapRect(&rect); |
159 } | 159 } |
160 // Allow for small numerical error in the bounds. | 160 // Allow for small numerical error in the bounds. |
161 SkRect bounds = fBounds; | 161 SkRect bounds = this->bounds(); |
162 bounds.outset(0.001f, 0.001f); | 162 bounds.outset(0.001f, 0.001f); |
163 SkASSERT(bounds.contains(rect)); | 163 SkASSERT(bounds.contains(rect)); |
164 #endif | 164 #endif |
165 | 165 |
166 currVertex += byteCount; | 166 currVertex += byteCount; |
167 } | 167 } |
168 | 168 |
169 this->flush(target, &flushInfo); | 169 this->flush(target, &flushInfo); |
170 } | 170 } |
171 | 171 |
(...skipping 60 matching lines...) Loading... |
232 // We steal the ref on the blobs from the other TextBatch and set its count
to 0 so that | 232 // We steal the ref on the blobs from the other TextBatch and set its count
to 0 so that |
233 // it doesn't try to unref them. | 233 // it doesn't try to unref them. |
234 #ifdef SK_DEBUG | 234 #ifdef SK_DEBUG |
235 for (int i = 0; i < that->fGeoCount; ++i) { | 235 for (int i = 0; i < that->fGeoCount; ++i) { |
236 that->fGeoData.get()[i].fBlob = (Blob*)0x1; | 236 that->fGeoData.get()[i].fBlob = (Blob*)0x1; |
237 } | 237 } |
238 #endif | 238 #endif |
239 that->fGeoCount = 0; | 239 that->fGeoCount = 0; |
240 fGeoCount = newGeoCount; | 240 fGeoCount = newGeoCount; |
241 | 241 |
242 this->joinBounds(that->bounds()); | 242 this->joinBounds(*that); |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 // TODO just use class params | 246 // TODO just use class params |
247 // TODO trying to figure out why lcd is so whack | 247 // TODO trying to figure out why lcd is so whack |
248 sk_sp<GrGeometryProcessor> GrAtlasTextBatch::setupDfProcessor(const SkMatrix& vi
ewMatrix, | 248 sk_sp<GrGeometryProcessor> GrAtlasTextBatch::setupDfProcessor(const SkMatrix& vi
ewMatrix, |
249 SkColor filteredCo
lor, | 249 SkColor filteredCo
lor, |
250 GrColor color, | 250 GrColor color, |
251 GrTexture* texture
) const { | 251 GrTexture* texture
) const { |
252 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_F
ilterMode); | 252 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_F
ilterMode); |
(...skipping 51 matching lines...) Loading... |
304 flags, | 304 flags, |
305 this->usesLocalCoords()); | 305 this->usesLocalCoords()); |
306 #endif | 306 #endif |
307 } | 307 } |
308 | 308 |
309 } | 309 } |
310 | 310 |
311 void GrBlobRegenHelper::flush() { | 311 void GrBlobRegenHelper::flush() { |
312 fBatch->flush(fTarget, fFlushInfo); | 312 fBatch->flush(fTarget, fFlushInfo); |
313 } | 313 } |
OLD | NEW |