OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrDistanceFieldTextureEffect.h" | 8 #include "GrDistanceFieldTextureEffect.h" |
9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
11 #include "GrTexture.h" | 11 #include "GrTexture.h" |
12 #include "SkDistanceFieldGen.h" | 12 #include "SkDistanceFieldGen.h" |
13 #include "gl/GrGLProcessor.h" | 13 #include "gl/GrGLProcessor.h" |
14 #include "gl/GrGLSL.h" | 14 #include "gl/GrGLSL.h" |
15 #include "gl/GrGLTexture.h" | 15 #include "gl/GrGLTexture.h" |
16 #include "gl/GrGLGeometryProcessor.h" | 16 #include "gl/GrGLGeometryProcessor.h" |
17 #include "gl/builders/GrGLProgramBuilder.h" | 17 #include "gl/builders/GrGLProgramBuilder.h" |
18 | 18 |
19 // Assuming a radius of the diagonal of the fragment, hence a factor of sqrt(2)/
2 | 19 // Assuming a radius of the diagonal of the fragment, hence a factor of sqrt(2)/
2 |
20 #define SK_DistanceFieldAAFactor "0.7071" | 20 #define SK_DistanceFieldAAFactor "0.65" |
21 | 21 |
22 struct DistanceFieldBatchTracker { | 22 struct DistanceFieldBatchTracker { |
23 GrGPInput fInputColorType; | 23 GrGPInput fInputColorType; |
24 GrColor fColor; | 24 GrColor fColor; |
25 bool fUsesLocalCoords; | 25 bool fUsesLocalCoords; |
26 }; | 26 }; |
27 | 27 |
28 class GrGLDistanceFieldTextureEffect : public GrGLGeometryProcessor { | 28 class GrGLDistanceFieldTextureEffect : public GrGLGeometryProcessor { |
29 public: | 29 public: |
30 GrGLDistanceFieldTextureEffect(const GrGeometryProcessor&, | 30 GrGLDistanceFieldTextureEffect(const GrGeometryProcessor&, |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 858 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
859 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 859 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
860 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 860 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
861 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), | 861 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), |
862 GrProcessorUnitTest::TestMatr
ix(random), | 862 GrProcessorUnitTest::TestMatr
ix(random), |
863 textures[texIdx], params, | 863 textures[texIdx], params, |
864 textures[texIdx2], params2, | 864 textures[texIdx2], params2, |
865 textColor, | 865 textColor, |
866 flags); | 866 flags); |
867 } | 867 } |
OLD | NEW |