| 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 "GrBatchFontCache.h" | 8 #include "GrBatchFontCache.h" |
| 9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 int numPlotsX, int numPlotsY) { | 21 int numPlotsX, int numPlotsY) { |
| 22 GrSurfaceDesc desc; | 22 GrSurfaceDesc desc; |
| 23 desc.fFlags = kNone_GrSurfaceFlags; | 23 desc.fFlags = kNone_GrSurfaceFlags; |
| 24 desc.fWidth = textureWidth; | 24 desc.fWidth = textureWidth; |
| 25 desc.fHeight = textureHeight; | 25 desc.fHeight = textureHeight; |
| 26 desc.fConfig = config; | 26 desc.fConfig = config; |
| 27 | 27 |
| 28 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to | 28 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to |
| 29 // guarantee we do not recieve a texture with pending IO | 29 // guarantee we do not recieve a texture with pending IO |
| 30 GrTexture* texture = context->textureProvider()->refScratchTexture( | 30 GrTexture* texture = context->textureProvider()->refScratchTexture( |
| 31 desc, GrTextureProvider::kApprox_ScratchTexMatch, true); | 31 desc, GrTextureProvider::kApprox_ScratchMatch, true); |
| 32 if (!texture) { | 32 if (!texture) { |
| 33 return NULL; | 33 return NULL; |
| 34 } | 34 } |
| 35 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY)); | 35 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool GrBatchFontCache::initAtlas(GrMaskFormat format) { | 38 bool GrBatchFontCache::initAtlas(GrMaskFormat format) { |
| 39 int index = MaskFormatToAtlasIndex(format); | 39 int index = MaskFormatToAtlasIndex(format); |
| 40 if (!fAtlases[index]) { | 40 if (!fAtlases[index]) { |
| 41 GrPixelConfig config = this->getPixelConfig(format); | 41 GrPixelConfig config = this->getPixelConfig(format); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g
lyph->fMaskFormat, | 235 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g
lyph->fMaskFormat, |
| 236 glyph->width(), glyph->height(), | 236 glyph->width(), glyph->height(), |
| 237 storage.get(), &glyph->fAtlasLoca
tion); | 237 storage.get(), &glyph->fAtlasLoca
tion); |
| 238 if (success) { | 238 if (success) { |
| 239 fAtlasedGlyphs++; | 239 fAtlasedGlyphs++; |
| 240 } | 240 } |
| 241 return success; | 241 return success; |
| 242 } | 242 } |
| OLD | NEW |