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

Side by Side Diff: src/effects/gradients/SkGradientShader.cpp

Issue 787873002: Use threshold of 1 texture coord value per pixel w/ nearest neighbor. (Closed) Base URL: https://skia.googlesource.com/skia.git@matrix_prec
Patch Set: update comments Created 6 years 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 | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/GrCoordTransform.cpp » ('j') | 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGradientShaderPriv.h" 8 #include "SkGradientShaderPriv.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 #include "SkRadialGradient.h" 10 #include "SkRadialGradient.h"
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 SkASSERT(fAtlas); 1099 SkASSERT(fAtlas);
1100 1100
1101 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp. 1101 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp.
1102 GrTextureParams params; 1102 GrTextureParams params;
1103 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); 1103 params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
1104 params.setTileModeX(tileMode); 1104 params.setTileModeX(tileMode);
1105 1105
1106 fRow = fAtlas->lockRow(bitmap); 1106 fRow = fAtlas->lockRow(bitmap);
1107 if (-1 != fRow) { 1107 if (-1 != fRow) {
1108 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm alizedTexelHeight(); 1108 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm alizedTexelHeight();
1109 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture()); 1109 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param s.filterMode());
1110 fTextureAccess.reset(fAtlas->getTexture(), params); 1110 fTextureAccess.reset(fAtlas->getTexture(), params);
1111 } else { 1111 } else {
1112 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap , &params)); 1112 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap , &params));
1113 fCoordTransform.reset(kCoordSet, matrix, texture); 1113 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode( ));
1114 fTextureAccess.reset(texture, params); 1114 fTextureAccess.reset(texture, params);
1115 fYCoord = SK_ScalarHalf; 1115 fYCoord = SK_ScalarHalf;
1116 } 1116 }
1117 this->addTextureAccess(&fTextureAccess); 1117 this->addTextureAccess(&fTextureAccess);
1118 } 1118 }
1119 this->addCoordTransform(&fCoordTransform); 1119 this->addCoordTransform(&fCoordTransform);
1120 } 1120 }
1121 1121
1122 GrGradientEffect::~GrGradientEffect() { 1122 GrGradientEffect::~GrGradientEffect() {
1123 if (this->useAtlas()) { 1123 if (this->useAtlas()) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 (*stops)[i] = stop; 1180 (*stops)[i] = stop;
1181 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1181 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1182 } 1182 }
1183 } 1183 }
1184 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1184 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1185 1185
1186 return outColors; 1186 return outColors;
1187 } 1187 }
1188 1188
1189 #endif 1189 #endif
OLDNEW
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/GrCoordTransform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698