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

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 2332213007: Bundle common arguments to GrGradientEffect creation (Closed)
Patch Set: Fix non-GPU compile errors Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index eccc21ac6e4cbdb68452e70d19cfe47c4f4f2d5e..14e67842b337b3addb15f45e51630fae65541c52 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1332,10 +1332,8 @@ void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBui
/////////////////////////////////////////////////////////////////////
-GrGradientEffect::GrGradientEffect(GrContext* ctx,
- const SkGradientShaderBase& shader,
- const SkMatrix& matrix,
- SkShader::TileMode tileMode) {
+GrGradientEffect::GrGradientEffect(const CreateArgs& args) {
+ const SkGradientShaderBase& shader(*args.fShader);
fIsOpaque = shader.isOpaque();
@@ -1354,7 +1352,7 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
}
#if GR_GL_USE_ACCURATE_HARD_STOP_GRADIENTS
- fTileMode = tileMode;
+ fTileMode = args.fTileMode;
#endif
switch (fColorType) {
@@ -1374,7 +1372,7 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
fPremulType = kAfterInterp_PremulType;
}
- fCoordTransform.reset(kCoordSet, matrix);
+ fCoordTransform.reset(kCoordSet, *args.fMatrix);
break;
case kTexture_ColorType:
@@ -1389,8 +1387,8 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
desc.fWidth = bitmap.width();
desc.fHeight = 32;
desc.fRowHeight = bitmap.height();
- desc.fContext = ctx;
- desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *ctx->caps());
+ desc.fContext = args.fContext;
+ desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *args.fContext->caps());
fAtlas = GrTextureStripAtlas::GetAtlas(desc);
SkASSERT(fAtlas);
@@ -1398,21 +1396,22 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
// y-clamp.
GrTextureParams params;
params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
- params.setTileModeX(tileMode);
+ params.setTileModeX(args.fTileMode);
fRow = fAtlas->lockRow(bitmap);
if (-1 != fRow) {
fYCoord = fAtlas->getYOffset(fRow)+SK_ScalarHalf*fAtlas->getNormalizedTexelHeight();
- fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), params.filterMode());
+ fCoordTransform.reset(kCoordSet, *args.fMatrix, fAtlas->getTexture(),
+ params.filterMode());
fTextureAccess.reset(fAtlas->getTexture(), params);
} else {
SkAutoTUnref<GrTexture> texture(
- GrRefCachedBitmapTexture(ctx, bitmap, params,
+ GrRefCachedBitmapTexture(args.fContext, bitmap, params,
SkSourceGammaTreatment::kRespect));
if (!texture) {
return;
}
- fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode());
+ fCoordTransform.reset(kCoordSet, *args.fMatrix, texture, params.filterMode());
fTextureAccess.reset(texture, params);
fYCoord = SK_ScalarHalf;
}
« no previous file with comments | « no previous file | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698