Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Side by Side Diff: src/gpu/effects/GrDistanceFieldTextureEffect.cpp

Issue 195223004: fix build error in chromium (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gl/GrGLEffect.h" 9 #include "gl/GrGLEffect.h"
10 #include "gl/GrGLSL.h" 10 #include "gl/GrGLSL.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const char* textureSizeUniName = NULL; 49 const char* textureSizeUniName = NULL;
50 fTextureSizeUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visib ility, 50 fTextureSizeUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visib ility,
51 kVec2f_GrSLType, "TextureSize", 51 kVec2f_GrSLType, "TextureSize",
52 &textureSizeUniName); 52 &textureSizeUniName);
53 53
54 builder->fsCodeAppend("\tvec4 texColor = "); 54 builder->fsCodeAppend("\tvec4 texColor = ");
55 builder->fsAppendTextureLookup(samplers[0], 55 builder->fsAppendTextureLookup(samplers[0],
56 fsCoordName.c_str(), 56 fsCoordName.c_str(),
57 kVec2f_GrSLType); 57 kVec2f_GrSLType);
58 builder->fsCodeAppend(";\n"); 58 builder->fsCodeAppend(";\n");
59 builder->fsCodeAppend("\tfloat distance = "MULTIPLIER"*(texColor.r - "TH RESHOLD");\n"); 59 builder->fsCodeAppend("\tfloat distance = " MULTIPLIER "*(texColor.r - " THRESHOLD ");\n");
60 60
61 // we adjust for the effect of the transformation on the distance by usi ng 61 // we adjust for the effect of the transformation on the distance by usi ng
62 // the length of the gradient of the texture coordinates. We use st coor dinates 62 // the length of the gradient of the texture coordinates. We use st coor dinates
63 // to ensure we're mapping 1:1 from texel space to pixel space. 63 // to ensure we're mapping 1:1 from texel space to pixel space.
64 builder->fsCodeAppendf("\tvec2 st = %s*%s;\n", fsCoordName.c_str(), text ureSizeUniName); 64 builder->fsCodeAppendf("\tvec2 st = %s*%s;\n", fsCoordName.c_str(), text ureSizeUniName);
65 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n"); 65 builder->fsCodeAppend("\tvec2 Jdx = dFdx(st);\n");
66 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n"); 66 builder->fsCodeAppend("\tvec2 Jdy = dFdy(st);\n");
67 builder->fsCodeAppend("\tvec2 st_grad = normalize(st);\n"); 67 builder->fsCodeAppend("\tvec2 st_grad = normalize(st);\n");
68 builder->fsCodeAppend("\tvec2 grad = vec2(st_grad.x*Jdx.x + st_grad.y*Jd y.x,\n"); 68 builder->fsCodeAppend("\tvec2 grad = vec2(st_grad.x*Jdx.x + st_grad.y*Jd y.x,\n");
69 builder->fsCodeAppend("\t st_grad.x*Jdx.y + st_grad.y*Jd y.y);\n"); 69 builder->fsCodeAppend("\t st_grad.x*Jdx.y + st_grad.y*Jd y.y);\n");
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 SkShader::TileMode tileModes[] = { 146 SkShader::TileMode tileModes[] = {
147 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 147 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
148 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 148 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
149 }; 149 };
150 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 150 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
151 GrTextureParams::kNon e_FilterMode); 151 GrTextureParams::kNon e_FilterMode);
152 SkISize size = SkISize::Make(1024, 2048); 152 SkISize size = SkISize::Make(1024, 2048);
153 153
154 return GrDistanceFieldTextureEffect::Create(textures[texIdx], params, size); 154 return GrDistanceFieldTextureEffect::Create(textures[texIdx], params, size);
155 } 155 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698