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

Side by Side Diff: src/gpu/GrTextureParamsAdjuster.h

Issue 2037413002: Add SkSourceGammaTreatment enum so we know how to create mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix DM compilation 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/gpu/GrImageIDTextureAdjuster.cpp ('k') | src/gpu/GrTextureParamsAdjuster.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 #ifndef GrTextureMaker_DEFINED 8 #ifndef GrTextureMaker_DEFINED
9 #define GrTextureMaker_DEFINED 9 #define GrTextureMaker_DEFINED
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const 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) = 0; 67 const GrTextureParams::FilterMode* filterOrN ullForBicubic,
68 SkSourceGammaTreatment) = 0;
68 69
69 virtual ~GrTextureProducer() {} 70 virtual ~GrTextureProducer() {}
70 71
71 int width() const { return fWidth; } 72 int width() const { return fWidth; }
72 int height() const { return fHeight; } 73 int height() const { return fHeight; }
73 bool isAlphaOnly() const { return fIsAlphaOnly; } 74 bool isAlphaOnly() const { return fIsAlphaOnly; }
74 75
75 protected: 76 protected:
76 GrTextureProducer(int width, int height, bool isAlphaOnly) 77 GrTextureProducer(int width, int height, bool isAlphaOnly)
77 : fWidth(width) 78 : fWidth(width)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 * The intent is not to use content area for subrect rendering. Rather, the pixe ls outside the 121 * The intent is not to use content area for subrect rendering. Rather, the pixe ls outside the
121 * content area have undefined values and shouldn't be read *regardless* of filt ering mode or 122 * content area have undefined values and shouldn't be read *regardless* of filt ering mode or
122 * the SkCanvas::SrcRectConstraint used for subrect draws. 123 * the SkCanvas::SrcRectConstraint used for subrect draws.
123 */ 124 */
124 class GrTextureAdjuster : public GrTextureProducer { 125 class GrTextureAdjuster : public GrTextureProducer {
125 public: 126 public:
126 /** 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.
127 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,
128 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
129 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.*/
130 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkIPoint* outOffs et); 131 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkSourceGammaTrea tment,
132 SkIPoint* outOffset);
131 133
132 const GrFragmentProcessor* createFragmentProcessor( 134 const GrFragmentProcessor* createFragmentProcessor(
133 const SkMatrix& textureMatrix, 135 const SkMatrix& textureMatrix,
134 const SkRect& constraintRect, 136 const SkRect& constraintRect,
135 FilterConstraint, 137 FilterConstraint,
136 bool coordsLimitedToConstraintRect, 138 bool coordsLimitedToConstraintRect,
137 const GrTextureParams::FilterMode* filterOrNullF orBicubic) override; 139 const GrTextureParams::FilterMode* filterOrNullF orBicubic,
140 SkSourceGammaTreatment) override;
138 141
139 protected: 142 protected:
140 /** The whole texture is content. */ 143 /** The whole texture is content. */
141 explicit GrTextureAdjuster(GrTexture* original, bool isAlphaOnly) 144 explicit GrTextureAdjuster(GrTexture* original, bool isAlphaOnly)
142 : INHERITED(original->width(), original->height(), isAlphaOnly) 145 : INHERITED(original->width(), original->height(), isAlphaOnly)
143 , fOriginal(original) {} 146 , fOriginal(original) {}
144 147
145 GrTextureAdjuster(GrTexture* original, const SkIRect& contentArea, bool isAl phaOnly); 148 GrTextureAdjuster(GrTexture* original, const SkIRect& contentArea, bool isAl phaOnly);
146 149
147 GrTexture* originalTexture() const { return fOriginal; } 150 GrTexture* originalTexture() const { return fOriginal; }
(...skipping 12 matching lines...) Expand all
160 163
161 /** 164 /**
162 * 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,
163 * picture, ...). 166 * picture, ...).
164 */ 167 */
165 class GrTextureMaker : public GrTextureProducer { 168 class GrTextureMaker : public GrTextureProducer {
166 public: 169 public:
167 /** 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
168 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
169 the texture. */ 172 the texture. */
170 GrTexture* refTextureForParams(const GrTextureParams&); 173 GrTexture* refTextureForParams(const GrTextureParams&, SkSourceGammaTreatmen t);
171 174
172 const GrFragmentProcessor* createFragmentProcessor( 175 const GrFragmentProcessor* createFragmentProcessor(
173 const SkMatrix& textureMatrix, 176 const SkMatrix& textureMatrix,
174 const SkRect& constraintRect, 177 const SkRect& constraintRect,
175 FilterConstraint filterConstraint, 178 FilterConstraint filterConstraint,
176 bool coordsLimitedToConstraintRect, 179 bool coordsLimitedToConstraintRect,
177 const GrTextureParams::FilterMode* filterOrNullF orBicubic) override; 180 const GrTextureParams::FilterMode* filterOrNullF orBicubic,
181 SkSourceGammaTreatment) override;
178 182
179 protected: 183 protected:
180 GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly) 184 GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly)
181 : INHERITED(width, height, isAlphaOnly) 185 : INHERITED(width, height, isAlphaOnly)
182 , fContext(context) {} 186 , fContext(context) {}
183 187
184 /** 188 /**
185 * Return the maker's "original" texture. It is the responsibility of the m aker to handle any 189 * Return the maker's "original" texture. It is the responsibility of the m aker to handle any
186 * caching of the original if desired. 190 * caching of the original if desired.
187 */ 191 */
188 virtual GrTexture* refOriginalTexture(bool willBeMipped) = 0; 192 virtual GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatm ent) = 0;
189 193
190 /** 194 /**
191 * Return a new (uncached) texture that is the stretch of the maker's origi nal. 195 * Return a new (uncached) texture that is the stretch of the maker's origi nal.
192 * 196 *
193 * The base-class handles general logic for this, and only needs access to the following 197 * The base-class handles general logic for this, and only needs access to the following
194 * method: 198 * method:
195 * - refOriginalTexture() 199 * - refOriginalTexture()
196 * 200 *
197 * Subclass may override this if they can handle creating the texture more directly than 201 * Subclass may override this if they can handle creating the texture more directly than
198 * by copying. 202 * by copying.
199 */ 203 */
200 virtual GrTexture* generateTextureForParams(const CopyParams&, bool willBeMi pped); 204 virtual GrTexture* generateTextureForParams(const CopyParams&, bool willBeMi pped,
205 SkSourceGammaTreatment);
201 206
202 GrContext* context() const { return fContext; } 207 GrContext* context() const { return fContext; }
203 208
204 private: 209 private:
205 GrContext* fContext; 210 GrContext* fContext;
206 211
207 typedef GrTextureProducer INHERITED; 212 typedef GrTextureProducer INHERITED;
208 }; 213 };
209 214
210 #endif 215 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.cpp ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698