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 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
8 | 8 |
9 #include "GrBatch.h" | 9 #include "GrBatch.h" |
10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | 48 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
49 | 49 |
50 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof
(SkIPoint16); | 50 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof
(SkIPoint16); |
51 | 51 |
52 static const int kMinDFFontSize = 18; | 52 static const int kMinDFFontSize = 18; |
53 static const int kSmallDFFontSize = 32; | 53 static const int kSmallDFFontSize = 32; |
54 static const int kSmallDFFontLimit = 32; | 54 static const int kSmallDFFontLimit = 32; |
55 static const int kMediumDFFontSize = 72; | 55 static const int kMediumDFFontSize = 72; |
56 static const int kMediumDFFontLimit = 72; | 56 static const int kMediumDFFontLimit = 72; |
57 static const int kLargeDFFontSize = 162; | 57 static const int kLargeDFFontSize = 162; |
58 #ifdef SK_BUILD_FOR_ANDROID | |
59 static const int kLargeDFFontLimit = 2 * 192; | |
60 #else | |
61 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize; | 58 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize; |
62 #endif | |
63 | 59 |
64 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;) | 60 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;) |
65 static const int kDistanceAdjustLumShift = 5; | 61 static const int kDistanceAdjustLumShift = 5; |
66 | 62 |
67 static const int kVerticesPerGlyph = 4; | 63 static const int kVerticesPerGlyph = 4; |
68 static const int kIndicesPerGlyph = 6; | 64 static const int kIndicesPerGlyph = 6; |
69 | 65 |
70 static size_t get_vertex_stride(GrMaskFormat maskFormat) { | 66 static size_t get_vertex_stride(GrMaskFormat maskFormat) { |
71 switch (maskFormat) { | 67 switch (maskFormat) { |
72 case kA8_GrMaskFormat: | 68 case kA8_GrMaskFormat: |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 if (info.fDrawAsDistanceFields) { | 2089 if (info.fDrawAsDistanceFields) { |
2094 SkColor filteredColor; | 2090 SkColor filteredColor; |
2095 SkColorFilter* colorFilter = skPaint.getColorFilter(); | 2091 SkColorFilter* colorFilter = skPaint.getColorFilter(); |
2096 if (colorFilter) { | 2092 if (colorFilter) { |
2097 filteredColor = colorFilter->filterColor(skPaint.getColor()); | 2093 filteredColor = colorFilter->filterColor(skPaint.getColor()); |
2098 } else { | 2094 } else { |
2099 filteredColor = skPaint.getColor(); | 2095 filteredColor = skPaint.getColor(); |
2100 } | 2096 } |
2101 bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry()); | 2097 bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry()); |
2102 float gamma = fDeviceProperties.gamma(); | 2098 float gamma = fDeviceProperties.gamma(); |
2103 #ifdef DEBUG_SHOW_DF_TEXT | |
2104 // force all DF text to show up in red | |
2105 filteredColor = 0xff0000ff; | |
2106 subrunColor = GrColorPackRGBA(0xff, 0x00, 0x00, 0xff); | |
2107 #endif | |
2108 batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFo
ntCache(), | 2099 batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFo
ntCache(), |
2109 fDistanceAdjustTable, filteredColor, | 2100 fDistanceAdjustTable, filteredColor, |
2110 info.fUseLCDText, useBGR, | 2101 info.fUseLCDText, useBGR, |
2111 gamma); | 2102 gamma); |
2112 } else { | 2103 } else { |
2113 batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFo
ntCache()); | 2104 batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFo
ntCache()); |
2114 } | 2105 } |
2115 BitmapTextBatch::Geometry& geometry = batch->geometry(); | 2106 BitmapTextBatch::Geometry& geometry = batch->geometry(); |
2116 geometry.fBlob = SkRef(cacheBlob); | 2107 geometry.fBlob = SkRef(cacheBlob); |
2117 geometry.fRun = run; | 2108 geometry.fRun = run; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2272 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
2282 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2273 static_cast<size_t>(textLen), 0, 0,
noClip)); |
2283 | 2274 |
2284 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2275 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
2285 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2276 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
2286 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; | 2277 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; |
2287 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2278 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
2288 } | 2279 } |
2289 | 2280 |
2290 #endif | 2281 #endif |
OLD | NEW |