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 "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
11 #include "GrRectanizer.h" | 11 #include "GrRectanizer.h" |
12 #include "GrResourceProvider.h" | 12 #include "GrResourceProvider.h" |
13 #include "GrSurfacePriv.h" | 13 #include "GrSurfacePriv.h" |
14 #include "SkString.h" | 14 #include "SkString.h" |
15 | 15 |
16 #include "SkDistanceFieldGen.h" | 16 #include "SkDistanceFieldGen.h" |
17 | 17 |
18 bool GrBatchFontCache::initAtlas(GrMaskFormat format) { | 18 bool GrBatchFontCache::initAtlas(GrMaskFormat format) { |
19 int index = MaskFormatToAtlasIndex(format); | 19 int index = MaskFormatToAtlasIndex(format); |
20 if (!fAtlases[index]) { | 20 if (!fAtlases[index]) { |
21 GrPixelConfig config = MaskFormatToPixelConfig(format, *fContext->caps()
); | 21 GrPixelConfig config = MaskFormatToPixelConfig(format); |
22 int width = fAtlasConfigs[index].fWidth; | 22 int width = fAtlasConfigs[index].fWidth; |
23 int height = fAtlasConfigs[index].fHeight; | 23 int height = fAtlasConfigs[index].fHeight; |
24 int numPlotsX = fAtlasConfigs[index].numPlotsX(); | 24 int numPlotsX = fAtlasConfigs[index].numPlotsX(); |
25 int numPlotsY = fAtlasConfigs[index].numPlotsY(); | 25 int numPlotsY = fAtlasConfigs[index].numPlotsY(); |
26 | 26 |
27 fAtlases[index] = | 27 fAtlases[index] = |
28 fContext->resourceProvider()->createAtlas(config, width, height, | 28 fContext->resourceProvider()->createAtlas(config, width, height, |
29 numPlotsX, numPlotsY, | 29 numPlotsX, numPlotsY, |
30 &GrBatchFontCache::Han
dleEviction, | 30 &GrBatchFontCache::Han
dleEviction, |
31 (void*)this); | 31 (void*)this); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, | 382 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, |
383 glyph->width(), glyph->height(), | 383 glyph->width(), glyph->height(), |
384 storage.get(), &glyph->fAtlasLoca
tion); | 384 storage.get(), &glyph->fAtlasLoca
tion); |
385 if (success) { | 385 if (success) { |
386 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); | 386 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); |
387 fAtlasedGlyphs++; | 387 fAtlasedGlyphs++; |
388 } | 388 } |
389 return success; | 389 return success; |
390 } | 390 } |
OLD | NEW |