| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 SkDebugf("Could not allocate vertices\n"); | 129 SkDebugf("Could not allocate vertices\n"); |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); | 133 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); |
| 134 | 134 |
| 135 // We cache some values to avoid going to the glyphcache for the same fontSc
aler twice | 135 // We cache some values to avoid going to the glyphcache for the same fontSc
aler twice |
| 136 // in a row | 136 // in a row |
| 137 const SkDescriptor* desc = nullptr; | 137 const SkDescriptor* desc = nullptr; |
| 138 SkGlyphCache* cache = nullptr; | 138 SkGlyphCache* cache = nullptr; |
| 139 GrFontScaler* scaler = nullptr; | |
| 140 SkTypeface* typeface = nullptr; | 139 SkTypeface* typeface = nullptr; |
| 141 | 140 |
| 142 GrBlobRegenHelper helper(this, target, &flushInfo); | 141 GrBlobRegenHelper helper(this, target, &flushInfo); |
| 143 | 142 |
| 144 for (int i = 0; i < fGeoCount; i++) { | 143 for (int i = 0; i < fGeoCount; i++) { |
| 145 const Geometry& args = fGeoData[i]; | 144 const Geometry& args = fGeoData[i]; |
| 146 Blob* blob = args.fBlob; | 145 Blob* blob = args.fBlob; |
| 147 size_t byteCount; | 146 size_t byteCount; |
| 148 void* blobVertices; | 147 void* blobVertices; |
| 149 int subRunGlyphCount; | 148 int subRunGlyphCount; |
| 150 blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun,
&cache, | 149 blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun,
&cache, |
| 151 &typeface, &scaler, &desc, vertexStride, args.fViewMa
trix, args.fX, | 150 &typeface, &desc, vertexStride, args.fViewMatrix, arg
s.fX, |
| 152 args.fY, args.fColor, &blobVertices, &byteCount, &sub
RunGlyphCount); | 151 args.fY, args.fColor, &blobVertices, &byteCount, &sub
RunGlyphCount); |
| 153 | 152 |
| 154 // now copy all vertices | 153 // now copy all vertices |
| 155 memcpy(currVertex, blobVertices, byteCount); | 154 memcpy(currVertex, blobVertices, byteCount); |
| 156 | 155 |
| 157 #ifdef SK_DEBUG | 156 #ifdef SK_DEBUG |
| 158 // bounds sanity check | 157 // bounds sanity check |
| 159 SkRect rect; | 158 SkRect rect; |
| 160 rect.setLargestInverted(); | 159 rect.setLargestInverted(); |
| 161 SkPoint* vertex = (SkPoint*) ((char*)blobVertices); | 160 SkPoint* vertex = (SkPoint*) ((char*)blobVertices); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 flags, | 313 flags, |
| 315 this->usesLocalCoords()); | 314 this->usesLocalCoords()); |
| 316 #endif | 315 #endif |
| 317 } | 316 } |
| 318 | 317 |
| 319 } | 318 } |
| 320 | 319 |
| 321 void GrBlobRegenHelper::flush() { | 320 void GrBlobRegenHelper::flush() { |
| 322 fBatch->flush(fTarget, fFlushInfo); | 321 fBatch->flush(fTarget, fFlushInfo); |
| 323 } | 322 } |
| OLD | NEW |