OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrSurfaceFlag); | 111 bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrSurfaceFlag); |
112 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { | 112 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
113 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 113 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
114 } else { | 114 } else { |
115 return desc.fOrigin; | 115 return desc.fOrigin; |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
121 GrTexture::GrTexture(GrGpu* gpu, bool isWrapped, const GrSurfaceDesc& desc) | 121 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) |
122 : INHERITED(gpu, isWrapped, desc) | 122 : INHERITED(gpu, lifeCycle, desc) |
123 , fMipMapsStatus(kNotAllocated_MipMapsStatus) { | 123 , fMipMapsStatus(kNotAllocated_MipMapsStatus) { |
124 | 124 |
125 if (!isWrapped) { | 125 if (kCached_LifeCycle == lifeCycle) { |
126 GrScratchKey key; | 126 GrScratchKey key; |
127 GrTexturePriv::ComputeScratchKey(desc, &key); | 127 GrTexturePriv::ComputeScratchKey(desc, &key); |
128 this->setScratchKey(key); | 128 this->setScratchKey(key); |
129 } | 129 } |
130 // only make sense if alloc size is pow2 | 130 // only make sense if alloc size is pow2 |
131 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); | 131 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); |
132 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); | 132 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); |
133 } | 133 } |
134 | 134 |
135 GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu, | 135 GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu, |
(...skipping 23 matching lines...) Expand all Loading... |
159 builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin
<< 24); | 159 builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin
<< 24); |
160 } | 160 } |
161 | 161 |
162 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { | 162 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { |
163 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); | 163 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
164 } | 164 } |
165 | 165 |
166 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { | 166 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { |
167 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); | 167 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
168 } | 168 } |
OLD | NEW |