| 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 |
| 11 #include "GrTextureParams.h" | 11 #include "GrTextureParams.h" |
| 12 #include "GrResourceKey.h" | 12 #include "GrResourceKey.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "SkFunction.h" | |
| 15 #include "SkTLazy.h" | 14 #include "SkTLazy.h" |
| 16 | 15 |
| 17 class GrContext; | 16 class GrContext; |
| 18 class GrTextureParams; | 17 class GrTextureParams; |
| 19 class GrUniqueKey; | 18 class GrUniqueKey; |
| 20 class SkBitmap; | 19 class SkBitmap; |
| 21 | 20 |
| 22 /** | 21 /** |
| 23 * Different GPUs and API extensions have different requirements with respect to
what texture | 22 * Different GPUs and API extensions have different requirements with respect to
what texture |
| 24 * sampling parameters may be used with textures of various types. This class fa
cilitates making | 23 * sampling parameters may be used with textures of various types. This class fa
cilitates making |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 /** | 100 /** |
| 102 * Helper for creating a fragment processor to sample the texture with a giv
en filtering mode. | 101 * Helper for creating a fragment processor to sample the texture with a giv
en filtering mode. |
| 103 * It attempts to avoids making a copy of the texture and avoid using a text
ure domain unless | 102 * It attempts to avoids making a copy of the texture and avoid using a text
ure domain unless |
| 104 * necessary. | 103 * necessary. |
| 105 * | 104 * |
| 106 * @param textureMatrix Matrix to apply to local coordina
tes to compute | 105 * @param textureMatrix Matrix to apply to local coordina
tes to compute |
| 107 * texel coordinates. The post-trans
formed coordinates | 106 * texel coordinates. The post-trans
formed coordinates |
| 108 * should be in texels (relative to
this->width() and | 107 * should be in texels (relative to
this->width() and |
| 109 * this->height()) and not be normal
ized. | 108 * this->height()) and not be normal
ized. |
| 110 * @param constraintRect Subrect of content area to be ren
dered. The | 109 * @param constraintRect Subrect of content area to be ren
dered. The |
| 111 * constraint rect is relative to th
e content area. | 110 * constraint rect is relative to th
e content area. |
| 112 * @param filterConstriant Indicates whether filtering is li
mited to | 111 * @param filterConstriant Indicates whether filtering is li
mited to |
| 113 * constraintRect. | 112 * constraintRect. |
| 114 * @param coordsLimitedToConstraintRect Is it known that textureMatrix*lo
calCoords is bound | 113 * @param coordsLimitedToConstraintRect Is it known that textureMatrix*lo
calCoords is bound |
| 115 * by the portion of the texture ind
icated by | 114 * by the portion of the texture ind
icated by |
| 116 * constraintRect (without considera
tion of filter | 115 * constraintRect (without considera
tion of filter |
| 117 * width, just the raw coords). | 116 * width, just the raw coords). |
| 118 * @param filterOrNullForBicubic If non-null indicates the filter
mode. If null means | 117 * @param filterOrNullForBicubic If non-null indicates the filter
mode. If null means |
| 119 * use bicubic filtering. | 118 * use bicubic filtering. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 138 /** Returns the content area or null for the whole original texture */ | 137 /** Returns the content area or null for the whole original texture */ |
| 139 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); } | 138 const SkIRect* contentAreaOrNull() { return fContentArea.getMaybeNull(); } |
| 140 | 139 |
| 141 private: | 140 private: |
| 142 SkTLazy<SkIRect> fContentArea; | 141 SkTLazy<SkIRect> fContentArea; |
| 143 GrTexture* fOriginal; | 142 GrTexture* fOriginal; |
| 144 | 143 |
| 145 typedef GrTextureProducer INHERITED; | 144 typedef GrTextureProducer INHERITED; |
| 146 }; | 145 }; |
| 147 | 146 |
| 148 /** | 147 /** |
| 149 * Base class for sources that start out as something other than a texture (enco
ded image, | 148 * Base class for sources that start out as something other than a texture (enco
ded image, |
| 150 * picture, ...). | 149 * picture, ...). |
| 151 */ | 150 */ |
| 152 class GrTextureMaker : public GrTextureProducer { | 151 class GrTextureMaker : public GrTextureProducer { |
| 153 public: | 152 public: |
| 154 /** Returns a texture that is safe for use with the params. If the size of t
he returned texture | 153 /** Returns a texture that is safe for use with the params. If the size of t
he returned texture |
| 155 does not match width()/height() then the contents of the original must b
e scaled to fit | 154 does not match width()/height() then the contents of the original must b
e scaled to fit |
| 156 the texture. */ | 155 the texture. */ |
| 157 GrTexture* refTextureForParams(GrContext*, const GrTextureParams&); | 156 GrTexture* refTextureForParams(GrContext*, const GrTextureParams&); |
| 158 | 157 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 184 * Subclass may override this if they can handle creating the texture more
directly than | 183 * Subclass may override this if they can handle creating the texture more
directly than |
| 185 * by copying. | 184 * by copying. |
| 186 */ | 185 */ |
| 187 virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&); | 186 virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&); |
| 188 | 187 |
| 189 private: | 188 private: |
| 190 typedef GrTextureProducer INHERITED; | 189 typedef GrTextureProducer INHERITED; |
| 191 }; | 190 }; |
| 192 | 191 |
| 193 #endif | 192 #endif |
| OLD | NEW |