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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * as defined by width()/height(). | 52 * as defined by width()/height(). |
53 * @param filterConstriant Indicates whether filtering is li
mited to | 53 * @param filterConstriant Indicates whether filtering is li
mited to |
54 * constraintRect. | 54 * constraintRect. |
55 * @param coordsLimitedToConstraintRect Is it known that textureMatrix*lo
calCoords is bound | 55 * @param coordsLimitedToConstraintRect Is it known that textureMatrix*lo
calCoords is bound |
56 * by the portion of the texture ind
icated by | 56 * by the portion of the texture ind
icated by |
57 * constraintRect (without considera
tion of filter | 57 * constraintRect (without considera
tion of filter |
58 * width, just the raw coords). | 58 * width, just the raw coords). |
59 * @param filterOrNullForBicubic If non-null indicates the filter
mode. If null means | 59 * @param filterOrNullForBicubic If non-null indicates the filter
mode. If null means |
60 * use bicubic filtering. | 60 * use bicubic filtering. |
61 **/ | 61 **/ |
62 virtual const GrFragmentProcessor* createFragmentProcessor( | 62 virtual sk_sp<GrFragmentProcessor> createFragmentProcessor( |
63 const SkMatrix& textureMatrix, | 63 const SkMatrix& textureMatrix, |
64 const SkRect& constraintRect, | 64 const SkRect& constraintRect, |
65 FilterConstraint filterConstraint, | 65 FilterConstraint filterConstraint, |
66 bool coordsLimitedToConstraintRect, | 66 bool coordsLimitedToConstraintRect, |
67 const GrTextureParams::FilterMode* filterOrN
ullForBicubic, | 67 const GrTextureParams::FilterMode* filterOrN
ullForBicubic, |
68 SkSourceGammaTreatment) = 0; | 68 SkSourceGammaTreatment) = 0; |
69 | 69 |
70 virtual ~GrTextureProducer() {} | 70 virtual ~GrTextureProducer() {} |
71 | 71 |
72 int width() const { return fWidth; } | 72 int width() const { return fWidth; } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 */ | 124 */ |
125 class GrTextureAdjuster : public GrTextureProducer { | 125 class GrTextureAdjuster : public GrTextureProducer { |
126 public: | 126 public: |
127 /** Makes the subset of the texture safe to use with the given texture param
eters. | 127 /** Makes the subset of the texture safe to use with the given texture param
eters. |
128 outOffset will be the top-left corner of the subset if a copy is not mad
e. Otherwise, | 128 outOffset will be the top-left corner of the subset if a copy is not mad
e. Otherwise, |
129 the copy will be tight to the contents and outOffset will be (0, 0). If
the copy's size | 129 the copy will be tight to the contents and outOffset will be (0, 0). If
the copy's size |
130 does not match subset's dimensions then the contents are scaled to fit t
he copy.*/ | 130 does not match subset's dimensions then the contents are scaled to fit t
he copy.*/ |
131 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkSourceGammaTrea
tment, | 131 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkSourceGammaTrea
tment, |
132 SkIPoint* outOffset); | 132 SkIPoint* outOffset); |
133 | 133 |
134 const GrFragmentProcessor* createFragmentProcessor( | 134 sk_sp<GrFragmentProcessor> createFragmentProcessor( |
135 const SkMatrix& textureMatrix, | 135 const SkMatrix& textureMatrix, |
136 const SkRect& constraintRect, | 136 const SkRect& constraintRect, |
137 FilterConstraint, | 137 FilterConstraint, |
138 bool coordsLimitedToConstraintRect, | 138 bool coordsLimitedToConstraintRect, |
139 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, | 139 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, |
140 SkSourceGammaTreatment) override; | 140 SkSourceGammaTreatment) override; |
141 | 141 |
142 protected: | 142 protected: |
143 /** The whole texture is content. */ | 143 /** The whole texture is content. */ |
144 explicit GrTextureAdjuster(GrTexture* original, bool isAlphaOnly) | 144 explicit GrTextureAdjuster(GrTexture* original, bool isAlphaOnly) |
(...skipping 20 matching lines...) Expand all Loading... |
165 * Base class for sources that start out as something other than a texture (enco
ded image, | 165 * Base class for sources that start out as something other than a texture (enco
ded image, |
166 * picture, ...). | 166 * picture, ...). |
167 */ | 167 */ |
168 class GrTextureMaker : public GrTextureProducer { | 168 class GrTextureMaker : public GrTextureProducer { |
169 public: | 169 public: |
170 /** Returns a texture that is safe for use with the params. If the size of t
he returned texture | 170 /** Returns a texture that is safe for use with the params. If the size of t
he returned texture |
171 does not match width()/height() then the contents of the original must b
e scaled to fit | 171 does not match width()/height() then the contents of the original must b
e scaled to fit |
172 the texture. */ | 172 the texture. */ |
173 GrTexture* refTextureForParams(const GrTextureParams&, SkSourceGammaTreatmen
t); | 173 GrTexture* refTextureForParams(const GrTextureParams&, SkSourceGammaTreatmen
t); |
174 | 174 |
175 const GrFragmentProcessor* createFragmentProcessor( | 175 sk_sp<GrFragmentProcessor> createFragmentProcessor( |
176 const SkMatrix& textureMatrix, | 176 const SkMatrix& textureMatrix, |
177 const SkRect& constraintRect, | 177 const SkRect& constraintRect, |
178 FilterConstraint filterConstraint, | 178 FilterConstraint filterConstraint, |
179 bool coordsLimitedToConstraintRect, | 179 bool coordsLimitedToConstraintRect, |
180 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, | 180 const GrTextureParams::FilterMode* filterOrNullF
orBicubic, |
181 SkSourceGammaTreatment) override; | 181 SkSourceGammaTreatment) override; |
182 | 182 |
183 protected: | 183 protected: |
184 GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly) | 184 GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly) |
185 : INHERITED(width, height, isAlphaOnly) | 185 : INHERITED(width, height, isAlphaOnly) |
(...skipping 20 matching lines...) Expand all Loading... |
206 | 206 |
207 GrContext* context() const { return fContext; } | 207 GrContext* context() const { return fContext; } |
208 | 208 |
209 private: | 209 private: |
210 GrContext* fContext; | 210 GrContext* fContext; |
211 | 211 |
212 typedef GrTextureProducer INHERITED; | 212 typedef GrTextureProducer INHERITED; |
213 }; | 213 }; |
214 | 214 |
215 #endif | 215 #endif |
OLD | NEW |