epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 10 | #include "GrTexture.h" |
| 11 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 12 | #include "GrContext.h" |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 13 | #include "GrDrawTargetCaps.h" |
bsalomon@google.com | 05ef510 | 2011-05-02 21:14:59 +0000 | [diff] [blame] | 14 | #include "GrGpu.h" |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 15 | #include "GrRenderTarget.h" |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 16 | #include "GrResourceCache.h" |
bsalomon@google.com | 8295dc1 | 2011-05-02 12:53:34 +0000 | [diff] [blame] | 17 | |
bsalomon@google.com | 686bcb8 | 2013-04-09 15:04:12 +0000 | [diff] [blame] | 18 | GrTexture::~GrTexture() { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 19 | if (fRenderTarget.get()) { |
bsalomon@google.com | 686bcb8 | 2013-04-09 15:04:12 +0000 | [diff] [blame] | 20 | fRenderTarget.get()->owningTextureDestroyed(); |
| 21 | } |
| 22 | } |
| 23 | |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 24 | /** |
| 25 | * This method allows us to interrupt the normal deletion process and place |
| 26 | * textures back in the texture cache when their ref count goes to zero. |
| 27 | */ |
| 28 | void GrTexture::internal_dispose() const { |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 29 | if (this->impl()->isSetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit) && |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 30 | this->INHERITED::getContext()) { |
| 31 | GrTexture* nonConstThis = const_cast<GrTexture *>(this); |
| 32 | this->ref(); // restore ref count to initial setting |
| 33 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 34 | nonConstThis->impl()->resetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit); |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 35 | nonConstThis->INHERITED::getContext()->addExistingTextureToCache(nonConstThis); |
| 36 | |
| 37 | // Note: "this" texture might be freed inside addExistingTextureToCache |
| 38 | // if it is purged. |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | this->INHERITED::internal_dispose(); |
| 43 | } |
| 44 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 45 | void GrTextureImpl::dirtyMipMaps(bool mipMapsDirty) { |
commit-bot@chromium.org | 11c6b39 | 2014-05-05 19:09:13 +0000 | [diff] [blame] | 46 | if (mipMapsDirty) { |
| 47 | if (kValid_MipMapsStatus == fMipMapsStatus) { |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 48 | fMipMapsStatus = kAllocated_MipMapsStatus; |
commit-bot@chromium.org | 11c6b39 | 2014-05-05 19:09:13 +0000 | [diff] [blame] | 49 | } |
| 50 | } else { |
| 51 | const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus; |
| 52 | fMipMapsStatus = kValid_MipMapsStatus; |
| 53 | if (sizeChanged) { |
| 54 | // This must not be called until after changing fMipMapsStatus. |
| 55 | this->didChangeGpuMemorySize(); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | size_t GrTexture::gpuMemorySize() const { |
bsalomon | d4cb922 | 2014-08-11 14:19:09 -0700 | [diff] [blame] | 61 | size_t textureSize; |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 62 | |
| 63 | if (GrPixelConfigIsCompressed(fDesc.fConfig)) { |
krajcevski | 7ef2162 | 2014-07-16 15:21:13 -0700 | [diff] [blame] | 64 | textureSize = GrCompressedFormatDataSize(fDesc.fConfig, fDesc.fWidth, fDesc.fHeight); |
bsalomon | d4cb922 | 2014-08-11 14:19:09 -0700 | [diff] [blame] | 65 | } else { |
| 66 | textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fDesc.fConfig); |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 67 | } |
| 68 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 69 | if (this->impl()->hasMipMaps()) { |
commit-bot@chromium.org | 11c6b39 | 2014-05-05 19:09:13 +0000 | [diff] [blame] | 70 | // We don't have to worry about the mipmaps being a different size than |
| 71 | // we'd expect because we never change fDesc.fWidth/fHeight. |
| 72 | textureSize *= 2; |
| 73 | } |
| 74 | return textureSize; |
| 75 | } |
| 76 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 77 | bool GrTexture::readPixels(int left, int top, int width, int height, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 78 | GrPixelConfig config, void* buffer, |
bsalomon@google.com | 0342a85 | 2012-08-20 19:22:38 +0000 | [diff] [blame] | 79 | size_t rowBytes, uint32_t pixelOpsFlags) { |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 80 | // go through context so that all necessary flushing occurs |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 81 | GrContext* context = this->getContext(); |
| 82 | if (NULL == context) { |
| 83 | return false; |
| 84 | } |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 85 | return context->readTexturePixels(this, |
bsalomon@google.com | 0342a85 | 2012-08-20 19:22:38 +0000 | [diff] [blame] | 86 | left, top, width, height, |
| 87 | config, buffer, rowBytes, |
| 88 | pixelOpsFlags); |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void GrTexture::writePixels(int left, int top, int width, int height, |
| 92 | GrPixelConfig config, const void* buffer, |
bsalomon@google.com | 0342a85 | 2012-08-20 19:22:38 +0000 | [diff] [blame] | 93 | size_t rowBytes, uint32_t pixelOpsFlags) { |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 94 | // go through context so that all necessary flushing occurs |
| 95 | GrContext* context = this->getContext(); |
| 96 | if (NULL == context) { |
| 97 | return; |
| 98 | } |
| 99 | context->writeTexturePixels(this, |
bsalomon@google.com | 0342a85 | 2012-08-20 19:22:38 +0000 | [diff] [blame] | 100 | left, top, width, height, |
| 101 | config, buffer, rowBytes, |
| 102 | pixelOpsFlags); |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 103 | } |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 104 | |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 105 | void GrTexture::abandonReleaseCommon() { |
| 106 | // In debug builds the resource cache tracks removed/exclusive textures and has an unref'ed ptr. |
| 107 | // After abandon() or release() the resource cache will be unreachable (getContext() == NULL). |
| 108 | // So we readd the texture to the cache here so that it is removed from the exclusive list and |
| 109 | // there is no longer an unref'ed ptr to the texture in the cache. |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 110 | if (this->impl()->isSetFlag((GrTextureFlags)GrTextureImpl::kReturnToCache_FlagBit)) { |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 111 | SkASSERT(!this->wasDestroyed()); |
| 112 | this->ref(); // restores the ref the resource cache gave up when it marked this exclusive. |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 113 | this->impl()->resetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit); |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 114 | this->getContext()->addExistingTextureToCache(this); |
| 115 | } |
| 116 | } |
| 117 | |
robertphillips@google.com | 15c0fea | 2012-06-22 12:41:43 +0000 | [diff] [blame] | 118 | void GrTexture::onRelease() { |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 119 | this->abandonReleaseCommon(); |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 120 | SkASSERT(!this->impl()->isSetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit)); |
robertphillips@google.com | d364554 | 2012-09-05 18:37:39 +0000 | [diff] [blame] | 121 | INHERITED::onRelease(); |
robertphillips@google.com | 15c0fea | 2012-06-22 12:41:43 +0000 | [diff] [blame] | 122 | } |
| 123 | |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 124 | void GrTexture::onAbandon() { |
robertphillips | dbe6074 | 2014-09-30 06:54:17 -0700 | [diff] [blame] | 125 | this->abandonReleaseCommon(); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 126 | if (fRenderTarget.get()) { |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 127 | fRenderTarget->abandon(); |
| 128 | } |
robertphillips@google.com | d364554 | 2012-09-05 18:37:39 +0000 | [diff] [blame] | 129 | INHERITED::onAbandon(); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 130 | } |
| 131 | |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 132 | void GrTexture::validateDesc() const { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 133 | if (this->asRenderTarget()) { |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 134 | // This texture has a render target |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 135 | SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrTextureFlagBit)); |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 136 | |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 137 | if (this->asRenderTarget()->getStencilBuffer()) { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 138 | SkASSERT(0 != (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 139 | } else { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 140 | SkASSERT(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 141 | } |
| 142 | |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 143 | SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numSamples()); |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 144 | } else { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 145 | SkASSERT(0 == (fDesc.fFlags & kRenderTarget_GrTextureFlagBit)); |
| 146 | SkASSERT(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); |
| 147 | SkASSERT(0 == fDesc.fSampleCnt); |
robertphillips@google.com | 3271628 | 2012-06-04 12:48:45 +0000 | [diff] [blame] | 148 | } |
| 149 | } |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 150 | |
commit-bot@chromium.org | e49157f | 2014-05-09 20:46:48 +0000 | [diff] [blame] | 151 | ////////////////////////////////////////////////////////////////////////////// |
| 152 | |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 153 | // These flags need to fit in a GrResourceKey::ResourceFlags so they can be folded into the texture |
robertphillips@google.com | 46a8600 | 2012-08-08 10:42:44 +0000 | [diff] [blame] | 154 | // key |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 155 | enum TextureFlags { |
| 156 | /** |
| 157 | * The kStretchToPOT bit is set when the texture is NPOT and is being repeated but the |
| 158 | * hardware doesn't support that feature. |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 159 | */ |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 160 | kStretchToPOT_TextureFlag = 0x1, |
| 161 | /** |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 162 | * The kBilerp bit can only be set when the kStretchToPOT flag is set and indicates whether the |
| 163 | * stretched texture should be bilerped. |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 164 | */ |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 165 | kBilerp_TextureFlag = 0x2, |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | namespace { |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 169 | GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu, |
| 170 | const GrTextureParams* params, |
| 171 | const GrTextureDesc& desc) { |
| 172 | GrResourceKey::ResourceFlags flags = 0; |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 173 | bool tiled = params && params->isTiled(); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 174 | if (tiled && !gpu->caps()->npotTextureTileSupport()) { |
tfarina | f9dae78 | 2014-06-06 06:35:28 -0700 | [diff] [blame] | 175 | if (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight)) { |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 176 | flags |= kStretchToPOT_TextureFlag; |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 177 | switch(params->filterMode()) { |
| 178 | case GrTextureParams::kNone_FilterMode: |
| 179 | break; |
| 180 | case GrTextureParams::kBilerp_FilterMode: |
| 181 | case GrTextureParams::kMipMap_FilterMode: |
| 182 | flags |= kBilerp_TextureFlag; |
| 183 | break; |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 184 | } |
| 185 | } |
| 186 | } |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 187 | return flags; |
| 188 | } |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 189 | |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 190 | GrResourceKey::ResourceType texture_resource_type() { |
| 191 | static const GrResourceKey::ResourceType gType = GrResourceKey::GenerateResourceType(); |
| 192 | return gType; |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 193 | } |
senorblanco@chromium.org | 709906b | 2013-02-07 00:35:25 +0000 | [diff] [blame] | 194 | |
| 195 | // FIXME: This should be refactored with the code in gl/GrGpuGL.cpp. |
| 196 | GrSurfaceOrigin resolve_origin(const GrTextureDesc& desc) { |
| 197 | // By default, GrRenderTargets are GL's normal orientation so that they |
| 198 | // can be drawn to by the outside world without the client having |
| 199 | // to render upside down. |
| 200 | bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrTextureFlagBit); |
| 201 | if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
| 202 | return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin; |
| 203 | } else { |
| 204 | return desc.fOrigin; |
| 205 | } |
| 206 | } |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 207 | } |
| 208 | |
commit-bot@chromium.org | e49157f | 2014-05-09 20:46:48 +0000 | [diff] [blame] | 209 | ////////////////////////////////////////////////////////////////////////////// |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 210 | GrTextureImpl::GrTextureImpl(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) |
bsalomon | 744998e | 2014-08-28 09:54:34 -0700 | [diff] [blame] | 211 | : INHERITED(gpu, isWrapped, desc) |
| 212 | , fMipMapsStatus(kNotAllocated_MipMapsStatus) { |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 213 | this->setScratchKey(ComputeScratchKey(desc)); |
bsalomon | 744998e | 2014-08-28 09:54:34 -0700 | [diff] [blame] | 214 | } |
commit-bot@chromium.org | e49157f | 2014-05-09 20:46:48 +0000 | [diff] [blame] | 215 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 216 | GrResourceKey GrTextureImpl::ComputeKey(const GrGpu* gpu, |
bsalomon@google.com | b867099 | 2012-07-25 21:27:09 +0000 | [diff] [blame] | 217 | const GrTextureParams* params, |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 218 | const GrTextureDesc& desc, |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 219 | const GrCacheID& cacheID) { |
| 220 | GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc); |
| 221 | return GrResourceKey(cacheID, texture_resource_type(), flags); |
| 222 | } |
robertphillips@google.com | 46a8600 | 2012-08-08 10:42:44 +0000 | [diff] [blame] | 223 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 224 | GrResourceKey GrTextureImpl::ComputeScratchKey(const GrTextureDesc& desc) { |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 225 | GrCacheID::Key idKey; |
| 226 | // Instead of a client-provided key of the texture contents we create a key from the |
| 227 | // descriptor. |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 228 | GR_STATIC_ASSERT(sizeof(idKey) >= 16); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 229 | SkASSERT(desc.fHeight < (1 << 16)); |
| 230 | SkASSERT(desc.fWidth < (1 << 16)); |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 231 | idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16); |
| 232 | idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16; |
| 233 | idKey.fData32[2] = desc.fFlags; |
senorblanco@chromium.org | 709906b | 2013-02-07 00:35:25 +0000 | [diff] [blame] | 234 | idKey.fData32[3] = resolve_origin(desc); // Only needs 2 bits actually |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 235 | static const int kPadSize = sizeof(idKey) - 16; |
| 236 | GR_STATIC_ASSERT(kPadSize >= 0); |
| 237 | memset(idKey.fData8 + 16, 0, kPadSize); |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 238 | |
| 239 | GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey); |
| 240 | return GrResourceKey(cacheID, texture_resource_type(), 0); |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 241 | } |
| 242 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 243 | bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) { |
bsalomon@google.com | 0797c2c | 2012-12-20 15:13:01 +0000 | [diff] [blame] | 244 | return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 245 | } |
| 246 | |
robertphillips | b06e5a2 | 2014-09-30 06:58:20 -0700 | [diff] [blame^] | 247 | bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) { |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 248 | return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
robertphillips@google.com | a1e5795 | 2012-06-04 20:05:28 +0000 | [diff] [blame] | 249 | } |