| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #include "SkGr.h" | 8 #include "SkGr.h" |
| 9 | 9 |
| 10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 stretch->fHeight = GrNextPow2(height); | 109 stretch->fHeight = GrNextPow2(height); |
| 110 } else if (width < ctx->caps()->minTextureSize() || | 110 } else if (width < ctx->caps()->minTextureSize() || |
| 111 height < ctx->caps()->minTextureSize()) { | 111 height < ctx->caps()->minTextureSize()) { |
| 112 // The small texture issues appear to be with tiling. Hence it seems ok
to scale them | 112 // The small texture issues appear to be with tiling. Hence it seems ok
to scale them |
| 113 // up using the GPU. If issues persist we may need to CPU-stretch. | 113 // up using the GPU. If issues persist we may need to CPU-stretch. |
| 114 doStretch = true; | 114 doStretch = true; |
| 115 stretch->fWidth = SkTMax(width, ctx->caps()->minTextureSize()); | 115 stretch->fWidth = SkTMax(width, ctx->caps()->minTextureSize()); |
| 116 stretch->fHeight = SkTMax(height, ctx->caps()->minTextureSize()); | 116 stretch->fHeight = SkTMax(height, ctx->caps()->minTextureSize()); |
| 117 } | 117 } |
| 118 if (doStretch) { | 118 if (doStretch) { |
| 119 switch(params->filterMode()) { | 119 if (params) { |
| 120 case GrTextureParams::kNone_FilterMode: | 120 switch(params->filterMode()) { |
| 121 stretch->fType = Stretch::kNearest_Type; | 121 case GrTextureParams::kNone_FilterMode: |
| 122 break; | 122 stretch->fType = Stretch::kNearest_Type; |
| 123 case GrTextureParams::kBilerp_FilterMode: | 123 break; |
| 124 case GrTextureParams::kMipMap_FilterMode: | 124 case GrTextureParams::kBilerp_FilterMode: |
| 125 stretch->fType = Stretch::kBilerp_Type; | 125 case GrTextureParams::kMipMap_FilterMode: |
| 126 break; | 126 stretch->fType = Stretch::kBilerp_Type; |
| 127 break; |
| 128 } |
| 129 } else { |
| 130 stretch->fType = Stretch::kBilerp_Type; |
| 127 } | 131 } |
| 128 } else { | 132 } else { |
| 129 stretch->fWidth = -1; | 133 stretch->fWidth = -1; |
| 130 stretch->fHeight = -1; | 134 stretch->fHeight = -1; |
| 131 stretch->fType = Stretch::kNone_Type; | 135 stretch->fType = Stretch::kNone_Type; |
| 132 } | 136 } |
| 133 } | 137 } |
| 134 | 138 |
| 135 static bool make_stretched_key(const GrUniqueKey& origKey, const Stretch& stretc
h, | 139 static bool make_stretched_key(const GrUniqueKey& origKey, const Stretch& stretc
h, |
| 136 GrUniqueKey* stretchedKey) { | 140 GrUniqueKey* stretchedKey) { |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 } | 798 } |
| 795 return SkImageInfo::Make(w, h, ct, at); | 799 return SkImageInfo::Make(w, h, ct, at); |
| 796 } | 800 } |
| 797 | 801 |
| 798 | 802 |
| 799 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 803 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
| 800 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 804 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
| 801 dst->setInfo(info); | 805 dst->setInfo(info); |
| 802 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 806 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
| 803 } | 807 } |
| OLD | NEW |