OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height
(), ct, at); | 191 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height
(), ct, at); |
192 | 192 |
193 GrSurfaceDesc desc; | 193 GrSurfaceDesc desc; |
194 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 194 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
195 desc.fWidth = info.width(); | 195 desc.fWidth = info.width(); |
196 desc.fHeight = info.height(); | 196 desc.fHeight = info.height(); |
197 desc.fConfig = SkImageInfo2GrPixelConfig(info); | 197 desc.fConfig = SkImageInfo2GrPixelConfig(info); |
198 desc.fSampleCnt = sampleCount; | 198 desc.fSampleCnt = sampleCount; |
199 | 199 |
200 SkAutoTUnref<GrTexture> texture; | 200 SkAutoTUnref<GrTexture> texture(context->createTexture(desc, SkToBool(budget
ed), NULL, 0)); |
201 if (SkSurface::kYes_Budgeted == budgeted) { | |
202 texture.reset(context->refScratchTexture(desc, GrContext::kExact_Scratch
TexMatch)); | |
203 } else { | |
204 texture.reset(context->createUncachedTexture(desc, NULL, 0)); | |
205 } | |
206 | |
207 if (!texture) { | 201 if (!texture) { |
208 return NULL; | 202 return NULL; |
209 } | 203 } |
210 | 204 |
211 return SkNEW_ARGS(SkGpuDevice, (texture->asRenderTarget(), props, flags)); | 205 return SkNEW_ARGS(SkGpuDevice, (texture->asRenderTarget(), props, flags)); |
212 } | 206 } |
213 | 207 |
214 SkGpuDevice::~SkGpuDevice() { | 208 SkGpuDevice::~SkGpuDevice() { |
215 if (fDrawProcs) { | 209 if (fDrawProcs) { |
216 delete fDrawProcs; | 210 delete fDrawProcs; |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 #endif | 1904 #endif |
1911 } | 1905 } |
1912 | 1906 |
1913 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1907 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1914 // We always return a transient cache, so it is freed after each | 1908 // We always return a transient cache, so it is freed after each |
1915 // filter traversal. | 1909 // filter traversal. |
1916 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1910 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1917 } | 1911 } |
1918 | 1912 |
1919 #endif | 1913 #endif |
OLD | NEW |