| 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 "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 return; | 1395 return; |
| 1396 } | 1396 } |
| 1397 } | 1397 } |
| 1398 GrBitmapTextureMaker maker(fContext, bitmap); | 1398 GrBitmapTextureMaker maker(fContext, bitmap); |
| 1399 this->drawTextureProducer(&maker, src, dst, constraint, *draw.fMatrix, fClip
, paint); | 1399 this->drawTextureProducer(&maker, src, dst, constraint, *draw.fMatrix, fClip
, paint); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 sk_sp<SkSpecialImage> SkGpuDevice::asSpecial() { | 1402 sk_sp<SkSpecialImage> SkGpuDevice::asSpecial() { |
| 1403 sk_sp<GrTexture> texture(this->accessDrawContext()->asTexture()); | 1403 sk_sp<GrTexture> texture(this->accessDrawContext()->asTexture()); |
| 1404 if (!texture) { | 1404 if (!texture) { |
| 1405 return nullptr; | 1405 // When the device doesn't have a texture, we create a temporary texture
. |
| 1406 // TODO: we should actually only copy the portion of the source needed t
o apply the image |
| 1407 // filter |
| 1408 texture.reset(fContext->textureProvider()->createTexture(this->accessDra
wContext()->desc(), |
| 1409 SkBudgeted::kYe
s)); |
| 1410 if (!texture) { |
| 1411 return nullptr; |
| 1412 } |
| 1413 |
| 1414 if (!fContext->copySurface(this->accessDrawContext()->accessRenderTarget
(), |
| 1415 texture.get())) { |
| 1416 return nullptr; |
| 1417 } |
| 1406 } | 1418 } |
| 1407 | 1419 |
| 1408 const SkImageInfo ii = this->imageInfo(); | 1420 const SkImageInfo ii = this->imageInfo(); |
| 1409 const SkIRect srcRect = SkIRect::MakeWH(ii.width(), ii.height()); | 1421 const SkIRect srcRect = SkIRect::MakeWH(ii.width(), ii.height()); |
| 1410 | 1422 |
| 1411 return SkSpecialImage::MakeFromGpu(srcRect, | 1423 return SkSpecialImage::MakeFromGpu(srcRect, |
| 1412 kNeedNewImageUniqueID_SpecialImage, | 1424 kNeedNewImageUniqueID_SpecialImage, |
| 1413 std::move(texture), | 1425 std::move(texture), |
| 1414 &this->surfaceProps()); | 1426 &this->surfaceProps()); |
| 1415 } | 1427 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 } | 1860 } |
| 1849 | 1861 |
| 1850 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1862 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
| 1851 ASSERT_SINGLE_OWNER | 1863 ASSERT_SINGLE_OWNER |
| 1852 // We always return a transient cache, so it is freed after each | 1864 // We always return a transient cache, so it is freed after each |
| 1853 // filter traversal. | 1865 // filter traversal. |
| 1854 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1866 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
| 1855 } | 1867 } |
| 1856 | 1868 |
| 1857 #endif | 1869 #endif |
| OLD | NEW |