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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 "coord"); 1083 "coord");
1084 fsBuilder->codeAppend(";\n"); 1084 fsBuilder->codeAppend(";\n");
1085 } 1085 }
1086 } 1086 }
1087 1087
1088 ///////////////////////////////////////////////////////////////////// 1088 /////////////////////////////////////////////////////////////////////
1089 1089
1090 GrGradientEffect::GrGradientEffect(GrContext* ctx, 1090 GrGradientEffect::GrGradientEffect(GrContext* ctx,
1091 const SkGradientShaderBase& shader, 1091 const SkGradientShaderBase& shader,
1092 const SkMatrix& matrix, 1092 const SkMatrix& matrix,
1093 SkShader::TileMode tileMode) { 1093 SkShader::TileMode tileMode, GrRenderTarget* dst) {
1094 1094
1095 fIsOpaque = shader.isOpaque(); 1095 fIsOpaque = shader.isOpaque();
1096 1096
1097 fColorType = shader.getGpuColorType(&fColors[0]); 1097 fColorType = shader.getGpuColorType(&fColors[0]);
1098 1098
1099 // The two and three color specializations do not currently support tiling. 1099 // The two and three color specializations do not currently support tiling.
1100 if (SkGradientShaderBase::kTwo_GpuColorType == fColorType || 1100 if (SkGradientShaderBase::kTwo_GpuColorType == fColorType ||
1101 SkGradientShaderBase::kThree_GpuColorType == fColorType) { 1101 SkGradientShaderBase::kThree_GpuColorType == fColorType) {
1102 fRow = -1; 1102 fRow = -1;
1103 1103
(...skipping 20 matching lines...) Expand all
1124 1124
1125 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp. 1125 // We always filter the gradient table. Each table is one row of a textu re, always y-clamp.
1126 GrTextureParams params; 1126 GrTextureParams params;
1127 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); 1127 params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
1128 params.setTileModeX(tileMode); 1128 params.setTileModeX(tileMode);
1129 1129
1130 fRow = fAtlas->lockRow(bitmap); 1130 fRow = fAtlas->lockRow(bitmap);
1131 if (-1 != fRow) { 1131 if (-1 != fRow) {
1132 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm alizedTexelHeight(); 1132 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm alizedTexelHeight();
1133 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param s.filterMode()); 1133 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param s.filterMode());
1134 fTextureAccess.reset(fAtlas->getTexture(), params); 1134 fTextureAccess.reset(fAtlas->getTexture(), params, dst);
1135 } else { 1135 } else {
1136 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap , params)); 1136 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap , params));
1137 if (!texture) { 1137 if (!texture) {
1138 return; 1138 return;
1139 } 1139 }
1140 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode( )); 1140 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode( ));
1141 fTextureAccess.reset(texture, params); 1141 fTextureAccess.reset(texture, params, dst);
1142 fYCoord = SK_ScalarHalf; 1142 fYCoord = SK_ScalarHalf;
1143 } 1143 }
1144 this->addTextureAccess(&fTextureAccess); 1144 this->addTextureAccess(&fTextureAccess);
1145 } 1145 }
1146 this->addCoordTransform(&fCoordTransform); 1146 this->addCoordTransform(&fCoordTransform);
1147 } 1147 }
1148 1148
1149 GrGradientEffect::~GrGradientEffect() { 1149 GrGradientEffect::~GrGradientEffect() {
1150 if (this->useAtlas()) { 1150 if (this->useAtlas()) {
1151 fAtlas->unlockRow(fRow); 1151 fAtlas->unlockRow(fRow);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 (*stops)[i] = stop; 1207 (*stops)[i] = stop;
1208 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1208 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1209 } 1209 }
1210 } 1210 }
1211 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1211 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1212 1212
1213 return outColors; 1213 return outColors;
1214 } 1214 }
1215 1215
1216 #endif 1216 #endif
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698