| 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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 bitmap.height() <= fContext->caps()->maxTextureSize()); | 1004 bitmap.height() <= fContext->caps()->maxTextureSize()); |
| 1005 // We should be respecting the max tile size by the time we get here. | 1005 // We should be respecting the max tile size by the time we get here. |
| 1006 SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() && | 1006 SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() && |
| 1007 bitmap.height() <= fContext->caps()->maxTileSize()); | 1007 bitmap.height() <= fContext->caps()->maxTileSize()); |
| 1008 | 1008 |
| 1009 sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap, param
s, | 1009 sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap, param
s, |
| 1010 fDrawContext->sourceGam
maTreatment()); | 1010 fDrawContext->sourceGam
maTreatment()); |
| 1011 if (nullptr == texture) { | 1011 if (nullptr == texture) { |
| 1012 return; | 1012 return; |
| 1013 } | 1013 } |
| 1014 | |
| 1015 sk_sp<GrColorSpaceXform> colorSpaceXform = | 1014 sk_sp<GrColorSpaceXform> colorSpaceXform = |
| 1016 GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace
()); | 1015 GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace
()); |
| 1017 | 1016 |
| 1018 SkScalar iw = 1.f / texture->width(); | 1017 SkScalar iw = 1.f / texture->width(); |
| 1019 SkScalar ih = 1.f / texture->height(); | 1018 SkScalar ih = 1.f / texture->height(); |
| 1020 | 1019 |
| 1021 SkMatrix texMatrix; | 1020 SkMatrix texMatrix; |
| 1022 // Compute a matrix that maps the rect we will draw to the src rect. | 1021 // Compute a matrix that maps the rect we will draw to the src rect. |
| 1023 texMatrix.setRectToRect(dstRect, srcRect, SkMatrix::kStart_ScaleToFit); | 1022 texMatrix.setRectToRect(dstRect, srcRect, SkMatrix::kStart_ScaleToFit); |
| 1024 texMatrix.postScale(iw, ih); | 1023 texMatrix.postScale(iw, ih); |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1796 } |
| 1798 | 1797 |
| 1799 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1798 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
| 1800 ASSERT_SINGLE_OWNER | 1799 ASSERT_SINGLE_OWNER |
| 1801 // We always return a transient cache, so it is freed after each | 1800 // We always return a transient cache, so it is freed after each |
| 1802 // filter traversal. | 1801 // filter traversal. |
| 1803 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1802 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
| 1804 } | 1803 } |
| 1805 | 1804 |
| 1806 #endif | 1805 #endif |
| OLD | NEW |