Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 * the SkCanvas::SrcRectConstraint used for subrect draws. | 76 * the SkCanvas::SrcRectConstraint used for subrect draws. |
| 77 */ | 77 */ |
| 78 class GrTextureAdjuster : public GrTextureProducer { | 78 class GrTextureAdjuster : public GrTextureProducer { |
| 79 public: | 79 public: |
| 80 /** Makes the subset of the texture safe to use with the given texture param eters. | 80 /** Makes the subset of the texture safe to use with the given texture param eters. |
| 81 outOffset will be the top-left corner of the subset if a copy is not mad e. Otherwise, | 81 outOffset will be the top-left corner of the subset if a copy is not mad e. Otherwise, |
| 82 the copy will be tight to the contents and outOffset will be (0, 0). If the copy's size | 82 the copy will be tight to the contents and outOffset will be (0, 0). If the copy's size |
| 83 does not match subset's dimensions then the contents are scaled to fit t he copy.*/ | 83 does not match subset's dimensions then the contents are scaled to fit t he copy.*/ |
| 84 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkIPoint* outOffs et); | 84 GrTexture* refTextureSafeForParams(const GrTextureParams&, SkIPoint* outOffs et); |
| 85 | 85 |
| 86 enum FilterConstraint { | |
| 87 kYes_FilterConstraint, | |
| 88 kNo_FilterConstraint, | |
| 89 }; | |
| 90 | |
| 91 /** | |
| 92 * Helper for creating a fragment processor to sample the texture with a giv en filtering mode. | |
| 93 * It attempts to avoids making a copy of the texture and avoid using a text ure domain unless | |
| 94 * necessary. | |
| 95 * | |
| 96 * @param textureMatrix Matrix to transform local coords by to compute | |
| 97 * texture coords. | |
| 98 * @param constraintRect Subrect of content area to be ren dered. Must be | |
| 99 * clipped to the content area alrea dy. | |
|
robertphillips
2015/11/05 20:13:24
filterConstraint ?
Could use a less cryptic explan
bsalomon
2015/11/06 15:24:26
It has a
| |
| 100 * @param constraintMode Do all texture reads | |
| 101 * @param coordsLimitedToConstraintRect Is it known that textureMatrix*lo calCoords is bound | |
| 102 * by the portion of the texture ind icated by | |
| 103 * constraintRect (without considera tion of filter | |
| 104 * width, just the raw coords). | |
|
robertphillips
2015/11/05 20:13:24
// An in/out param that is ...
// On input it ...
bsalomon
2015/11/06 15:24:26
It's not in/out. Made a real comment.
| |
| 105 * @param filterOrNullForBicubic Exactly what it sounds like. | |
| 106 **/ | |
| 107 const GrFragmentProcessor* createFragmentProcessor( | |
| 108 const SkMatrix& textureMatrix, | |
| 109 const SkRect& constraintRect, | |
| 110 FilterConstraint filterConstraint, | |
| 111 bool coordsLimitedToConstraintRect, | |
| 112 const GrTextureParams::FilterMode* filterOrNullForBicubic); | |
| 113 | |
| 114 GrTexture* originalTexture() { return fOriginal; } | |
| 115 | |
| 86 protected: | 116 protected: |
| 87 /** The whole texture is content. */ | 117 /** The whole texture is content. */ |
| 88 explicit GrTextureAdjuster(GrTexture* original): fOriginal(original) {} | 118 explicit GrTextureAdjuster(GrTexture* original): fOriginal(original) {} |
| 89 | 119 |
| 90 GrTextureAdjuster(GrTexture* original, const SkIRect& contentArea); | 120 GrTextureAdjuster(GrTexture* original, const SkIRect& contentArea); |
| 91 | 121 |
| 92 GrTexture* originalTexture() { return fOriginal; } | |
| 93 | |
| 94 /** Returns the content area or null for the whole original texture */ | 122 /** Returns the content area or null for the whole original texture */ |
| 95 const SkIRect* contentArea() { return fContentArea.getMaybeNull(); } | 123 const SkIRect* contentArea() { return fContentArea.getMaybeNull(); } |
| 96 | 124 |
| 97 private: | 125 private: |
| 98 SkTLazy<SkIRect> fContentArea; | 126 SkTLazy<SkIRect> fContentArea; |
| 99 GrTexture* fOriginal; | 127 GrTexture* fOriginal; |
| 100 | 128 |
| 101 typedef GrTextureProducer INHERITED; | 129 typedef GrTextureProducer INHERITED; |
| 102 }; | 130 }; |
| 103 | 131 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&); | 175 virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&); |
| 148 | 176 |
| 149 private: | 177 private: |
| 150 const int fWidth; | 178 const int fWidth; |
| 151 const int fHeight; | 179 const int fHeight; |
| 152 | 180 |
| 153 typedef GrTextureProducer INHERITED; | 181 typedef GrTextureProducer INHERITED; |
| 154 }; | 182 }; |
| 155 | 183 |
| 156 #endif | 184 #endif |
| OLD | NEW |