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

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

Issue 2250403003: Add alpha type to texture producer (Closed) Base URL: https://skia.googlesource.com/skia.git@image-alpha-type
Patch Set: Created 4 years, 4 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool coordsLimitedToConstraintRect, 66 bool coordsLimitedToConstraintRect,
67 const GrTextureParams::FilterMode* filterOrN ullForBicubic, 67 const GrTextureParams::FilterMode* filterOrN ullForBicubic,
68 SkColorSpace* dstColorSpace, 68 SkColorSpace* dstColorSpace,
69 SkSourceGammaTreatment) = 0; 69 SkSourceGammaTreatment) = 0;
70 70
71 virtual ~GrTextureProducer() {} 71 virtual ~GrTextureProducer() {}
72 72
73 int width() const { return fWidth; } 73 int width() const { return fWidth; }
74 int height() const { return fHeight; } 74 int height() const { return fHeight; }
75 bool isAlphaOnly() const { return fIsAlphaOnly; } 75 bool isAlphaOnly() const { return fIsAlphaOnly; }
76 virtual SkAlphaType alphaType() const = 0;
76 virtual SkColorSpace* getColorSpace() = 0; 77 virtual SkColorSpace* getColorSpace() = 0;
77 78
78 protected: 79 protected:
79 GrTextureProducer(int width, int height, bool isAlphaOnly) 80 GrTextureProducer(int width, int height, bool isAlphaOnly)
80 : fWidth(width) 81 : fWidth(width)
81 , fHeight(height) 82 , fHeight(height)
82 , fIsAlphaOnly(isAlphaOnly) {} 83 , fIsAlphaOnly(isAlphaOnly) {}
83 84
84 /** Helper for creating a key for a copy from an original key. */ 85 /** Helper for creating a key for a copy from an original key. */
85 static void MakeCopyKeyFromOrigKey(const GrUniqueKey& origKey, 86 static void MakeCopyKeyFromOrigKey(const GrUniqueKey& origKey,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const SkMatrix& textureMatrix, 138 const SkMatrix& textureMatrix,
138 const SkRect& constraintRect, 139 const SkRect& constraintRect,
139 FilterConstraint, 140 FilterConstraint,
140 bool coordsLimitedToConstraintRect, 141 bool coordsLimitedToConstraintRect,
141 const GrTextureParams::FilterMode* filterOrNullF orBicubic, 142 const GrTextureParams::FilterMode* filterOrNullF orBicubic,
142 SkColorSpace* dstColorSpace, 143 SkColorSpace* dstColorSpace,
143 SkSourceGammaTreatment) override; 144 SkSourceGammaTreatment) override;
144 145
145 // We do not ref the texture nor the colorspace, so the caller must keep the m in scope while 146 // 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 // this Adjuster is alive.
147 GrTextureAdjuster(GrTexture*, const SkIRect& area, uint32_t uniqueID, SkColo rSpace*); 148 GrTextureAdjuster(GrTexture*, SkAlphaType, const SkIRect& area, uint32_t uni queID,
149 SkColorSpace*);
148 150
149 protected: 151 protected:
152 SkAlphaType alphaType() const override { return fAlphaType; }
150 SkColorSpace* getColorSpace() override; 153 SkColorSpace* getColorSpace() override;
151 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; 154 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
152 void didCacheCopy(const GrUniqueKey& copyKey) override; 155 void didCacheCopy(const GrUniqueKey& copyKey) override;
153 156
154 GrTexture* originalTexture() const { return fOriginal; } 157 GrTexture* originalTexture() const { return fOriginal; }
155 158
156 /** Returns the content area or null for the whole original texture */ 159 /** Returns the content area or null for the whole original texture */
157 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); } 160 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); }
158 161
159 private: 162 private:
160 SkTLazy<SkIRect> fContentArea; 163 SkTLazy<SkIRect> fContentArea;
161 GrTexture* fOriginal; 164 GrTexture* fOriginal;
165 SkAlphaType fAlphaType;
162 SkColorSpace* fColorSpace; 166 SkColorSpace* fColorSpace;
163 uint32_t fUniqueID; 167 uint32_t fUniqueID;
164 168
165 GrTexture* refCopy(const CopyParams &copyParams); 169 GrTexture* refCopy(const CopyParams &copyParams);
166 170
167 typedef GrTextureProducer INHERITED; 171 typedef GrTextureProducer INHERITED;
168 }; 172 };
169 173
170 /** 174 /**
171 * Base class for sources that start out as something other than a texture (enco ded image, 175 * Base class for sources that start out as something other than a texture (enco ded image,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 217
214 GrContext* context() const { return fContext; } 218 GrContext* context() const { return fContext; }
215 219
216 private: 220 private:
217 GrContext* fContext; 221 GrContext* fContext;
218 222
219 typedef GrTextureProducer INHERITED; 223 typedef GrTextureProducer INHERITED;
220 }; 224 };
221 225
222 #endif 226 #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