OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 9 |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 srcRect = SkIRect::MakeWH(texture->width(), texture->height()); | 69 srcRect = SkIRect::MakeWH(texture->width(), texture->height()); |
70 } else { | 70 } else { |
71 SkASSERT(SkIRect::MakeWH(texture->width(), texture->height()).contains(*
subset)); | 71 SkASSERT(SkIRect::MakeWH(texture->width(), texture->height()).contains(*
subset)); |
72 // Create a new texture that is the size of subset. | 72 // Create a new texture that is the size of subset. |
73 desc.fWidth = subset->width(); | 73 desc.fWidth = subset->width(); |
74 desc.fHeight = subset->height(); | 74 desc.fHeight = subset->height(); |
75 srcRect = *subset; | 75 srcRect = *subset; |
76 } | 76 } |
77 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 77 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
78 desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType, dstPT); | 78 desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType, dstPT); |
79 desc.fTextureStorageAllocator = texture->desc().fTextureStorageAllocator; | |
80 | 79 |
81 GrTexture* dst = context->textureProvider()->createTexture(desc, false, null
ptr, 0); | 80 GrTexture* dst = context->textureProvider()->createTexture(desc, false, null
ptr, 0); |
82 if (nullptr == dst) { | 81 if (nullptr == dst) { |
83 return nullptr; | 82 return nullptr; |
84 } | 83 } |
85 | 84 |
86 // Blink is relying on the above copy being sent to GL immediately in the ca
se when the source | 85 // Blink is relying on the above copy being sent to GL immediately in the ca
se when the source |
87 // is a WebGL canvas backing store. We could have a TODO to remove this flus
h flag, but we have | 86 // is a WebGL canvas backing store. We could have a TODO to remove this flus
h flag, but we have |
88 // a larger TODO to remove SkGrPixelRef entirely. | 87 // a larger TODO to remove SkGrPixelRef entirely. |
89 context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make
(0,0), | 88 context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make
(0,0), |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 cachedBitmap.setImmutable(); | 204 cachedBitmap.setImmutable(); |
206 //Add to the cache | 205 //Add to the cache |
207 SkBitmapCache::Add(this, bounds, cachedBitmap); | 206 SkBitmapCache::Add(this, bounds, cachedBitmap); |
208 | 207 |
209 dst->swap(cachedBitmap); | 208 dst->swap(cachedBitmap); |
210 } | 209 } |
211 | 210 |
212 return true; | 211 return true; |
213 | 212 |
214 } | 213 } |
OLD | NEW |