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

Side by Side Diff: src/image/SkImageShader.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/image/SkImageShader.h ('k') | src/image/SkImage_Gpu.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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProvider.h" 9 #include "SkBitmapProvider.h"
10 #include "SkImage_Base.h" 10 #include "SkImage_Base.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 #if SK_SUPPORT_GPU 77 #if SK_SUPPORT_GPU
78 78
79 #include "GrTextureAccess.h" 79 #include "GrTextureAccess.h"
80 #include "SkGr.h" 80 #include "SkGr.h"
81 #include "SkGrPriv.h" 81 #include "SkGrPriv.h"
82 #include "effects/GrSimpleTextureEffect.h" 82 #include "effects/GrSimpleTextureEffect.h"
83 #include "effects/GrBicubicEffect.h" 83 #include "effects/GrBicubicEffect.h"
84 #include "effects/GrSimpleTextureEffect.h" 84 #include "effects/GrSimpleTextureEffect.h"
85 85
86 const GrFragmentProcessor* SkImageShader::asFragmentProcessor( 86 sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
87 GrContext* context, 87 GrContext* context,
88 const SkMatrix& viewM, 88 const SkMatrix& viewM,
89 const SkMatrix* localMatrix , 89 const SkMatrix* localMatrix ,
90 SkFilterQuality filterQuali ty, 90 SkFilterQuality filterQuali ty,
91 SkSourceGammaTreatment gamm aTreatment) const { 91 SkSourceGammaTreatment gamm aTreatment) const {
92 SkMatrix matrix; 92 SkMatrix matrix;
93 matrix.setIDiv(fImage->width(), fImage->height()); 93 matrix.setIDiv(fImage->width(), fImage->height());
94 94
95 SkMatrix lmInverse; 95 SkMatrix lmInverse;
96 if (!this->getLocalMatrix().invert(&lmInverse)) { 96 if (!this->getLocalMatrix().invert(&lmInverse)) {
(...skipping 16 matching lines...) Expand all
113 // are provided by the caller. 113 // are provided by the caller.
114 bool doBicubic; 114 bool doBicubic;
115 GrTextureParams::FilterMode textureFilterMode = 115 GrTextureParams::FilterMode textureFilterMode =
116 GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix() , &doBicubic); 116 GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix() , &doBicubic);
117 GrTextureParams params(tm, textureFilterMode); 117 GrTextureParams params(tm, textureFilterMode);
118 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, params, gammaTreatment)); 118 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, params, gammaTreatment));
119 if (!texture) { 119 if (!texture) {
120 return nullptr; 120 return nullptr;
121 } 121 }
122 122
123 SkAutoTUnref<const GrFragmentProcessor> inner; 123 sk_sp<GrFragmentProcessor> inner;
124 if (doBicubic) { 124 if (doBicubic) {
125 inner.reset(GrBicubicEffect::Create(texture, matrix, tm)); 125 inner = GrBicubicEffect::Make(texture, matrix, tm);
126 } else { 126 } else {
127 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); 127 inner = GrSimpleTextureEffect::Make(texture, matrix, params);
128 } 128 }
129 129
130 if (GrPixelConfigIsAlphaOnly(texture->config())) { 130 if (GrPixelConfigIsAlphaOnly(texture->config())) {
131 return SkRef(inner.get()); 131 return inner;
132 } 132 }
133 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 133 return sk_sp<GrFragmentProcessor>(GrFragmentProcessor::MulOutputByInputAlpha (std::move(inner)));
134 } 134 }
135 135
136 #endif 136 #endif
OLDNEW
« no previous file with comments | « src/image/SkImageShader.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698