OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 #include "GrTextureAccess.h" | 79 #include "GrTextureAccess.h" |
80 #include "SkGr.h" | 80 #include "SkGr.h" |
81 #include "effects/GrSimpleTextureEffect.h" | 81 #include "effects/GrSimpleTextureEffect.h" |
82 #include "effects/GrBicubicEffect.h" | 82 #include "effects/GrBicubicEffect.h" |
83 #include "effects/GrSimpleTextureEffect.h" | 83 #include "effects/GrSimpleTextureEffect.h" |
84 | 84 |
85 const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context
, | 85 const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context
, |
86 const SkMatrix& vi
ewM, | 86 const SkMatrix& vi
ewM, |
87 const SkMatrix* lo
calMatrix, | 87 const SkMatrix* lo
calMatrix, |
88 SkFilterQuality fi
lterQuality, | 88 SkFilterQuality fi
lterQuality) const { |
89 GrProcessorDataMan
ager* mgr) const { | |
90 SkMatrix matrix; | 89 SkMatrix matrix; |
91 matrix.setIDiv(fImage->width(), fImage->height()); | 90 matrix.setIDiv(fImage->width(), fImage->height()); |
92 | 91 |
93 SkMatrix lmInverse; | 92 SkMatrix lmInverse; |
94 if (!this->getLocalMatrix().invert(&lmInverse)) { | 93 if (!this->getLocalMatrix().invert(&lmInverse)) { |
95 return nullptr; | 94 return nullptr; |
96 } | 95 } |
97 if (localMatrix) { | 96 if (localMatrix) { |
98 SkMatrix inv; | 97 SkMatrix inv; |
99 if (!localMatrix->invert(&inv)) { | 98 if (!localMatrix->invert(&inv)) { |
(...skipping 23 matching lines...) Expand all Loading... |
123 usageType = kTiled_Filtered_SkImageUsageType; | 122 usageType = kTiled_Filtered_SkImageUsageType; |
124 } | 123 } |
125 | 124 |
126 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, usageTy
pe)); | 125 SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, usageTy
pe)); |
127 if (!texture) { | 126 if (!texture) { |
128 return nullptr; | 127 return nullptr; |
129 } | 128 } |
130 | 129 |
131 SkAutoTUnref<GrFragmentProcessor> inner; | 130 SkAutoTUnref<GrFragmentProcessor> inner; |
132 if (doBicubic) { | 131 if (doBicubic) { |
133 inner.reset(GrBicubicEffect::Create(mgr, texture, matrix, tm)); | 132 inner.reset(GrBicubicEffect::Create(texture, matrix, tm)); |
134 } else { | 133 } else { |
135 inner.reset(GrSimpleTextureEffect::Create(mgr, texture, matrix, params))
; | 134 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); |
136 } | 135 } |
137 | 136 |
138 if (GrPixelConfigIsAlphaOnly(texture->config())) { | 137 if (GrPixelConfigIsAlphaOnly(texture->config())) { |
139 return SkRef(inner.get()); | 138 return SkRef(inner.get()); |
140 } | 139 } |
141 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 140 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
142 } | 141 } |
143 | 142 |
144 #endif | 143 #endif |
OLD | NEW |