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 #ifndef GrTextureMaker_DEFINED | 8 #ifndef GrTextureMaker_DEFINED |
9 #define GrTextureMaker_DEFINED | 9 #define GrTextureMaker_DEFINED |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 sk_sp<GrFragmentProcessor> createFragmentProcessor( | 136 sk_sp<GrFragmentProcessor> createFragmentProcessor( |
137 const SkMatrix& textureMatrix, | 137 const SkMatrix& textureMatrix, |
138 const SkRect& constraintRect, | 138 const SkRect& constraintRect, |
139 FilterConstraint, | 139 FilterConstraint, |
140 bool coordsLimitedToConstraintRect, | 140 bool coordsLimitedToConstraintRect, |
141 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, | 141 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, |
142 SkColorSpace* dstColorSpace, | 142 SkColorSpace* dstColorSpace, |
143 SkSourceGammaTreatment) override; | 143 SkSourceGammaTreatment) override; |
144 | 144 |
| 145 // We do not ref the texture nor the colorspace, so the caller must keep the
m in scope while |
| 146 // this Adjuster is alive. |
| 147 GrTextureAdjuster(GrTexture*, const SkIRect& area, uint32_t uniqueID, SkColo
rSpace*); |
| 148 |
145 protected: | 149 protected: |
146 /** The whole texture is content. */ | 150 SkColorSpace* getColorSpace() override; |
147 explicit GrTextureAdjuster(GrTexture* original, bool isAlphaOnly) | 151 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; |
148 : INHERITED(original->width(), original->height(), isAlphaOnly) | 152 void didCacheCopy(const GrUniqueKey& copyKey) override; |
149 , fOriginal(original) {} | |
150 | |
151 GrTextureAdjuster(GrTexture* original, const SkIRect& contentArea, bool isAl
phaOnly); | |
152 | 153 |
153 GrTexture* originalTexture() const { return fOriginal; } | 154 GrTexture* originalTexture() const { return fOriginal; } |
154 | 155 |
155 /** Returns the content area or null for the whole original texture */ | 156 /** Returns the content area or null for the whole original texture */ |
156 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); } | 157 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); } |
157 | 158 |
158 private: | 159 private: |
159 SkTLazy<SkIRect> fContentArea; | 160 SkTLazy<SkIRect> fContentArea; |
160 GrTexture* fOriginal; | 161 GrTexture* fOriginal; |
| 162 SkColorSpace* fColorSpace; |
| 163 uint32_t fUniqueID; |
161 | 164 |
162 GrTexture* refCopy(const CopyParams ©Params); | 165 GrTexture* refCopy(const CopyParams ©Params); |
163 | 166 |
164 typedef GrTextureProducer INHERITED; | 167 typedef GrTextureProducer INHERITED; |
165 }; | 168 }; |
166 | 169 |
167 /** | 170 /** |
168 * Base class for sources that start out as something other than a texture (enco
ded image, | 171 * Base class for sources that start out as something other than a texture (enco
ded image, |
169 * picture, ...). | 172 * picture, ...). |
170 */ | 173 */ |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 213 |
211 GrContext* context() const { return fContext; } | 214 GrContext* context() const { return fContext; } |
212 | 215 |
213 private: | 216 private: |
214 GrContext* fContext; | 217 GrContext* fContext; |
215 | 218 |
216 typedef GrTextureProducer INHERITED; | 219 typedef GrTextureProducer INHERITED; |
217 }; | 220 }; |
218 | 221 |
219 #endif | 222 #endif |
OLD | NEW |