| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 79 desc.fTextureStorageAllocator = texture->desc().fTextureStorageAllocator; |
| 80 | 80 |
| 81 GrTexture* dst = context->textureProvider()->createTexture(desc, false, null
ptr, 0); | 81 GrTexture* dst = context->textureProvider()->createTexture(desc, false, null
ptr, 0); |
| 82 if (nullptr == dst) { | 82 if (nullptr == dst) { |
| 83 return nullptr; | 83 return nullptr; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Blink is relying on the above copy being sent to GL immediately in the ca
se when the source | 86 // 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 | 87 // is a WebGL canvas backing store. We could have a TODO to remove this flus
h, but we have |
| 88 // a larger TODO to remove SkGrPixelRef entirely. | 88 // a larger TODO to remove SkGrPixelRef entirely. |
| 89 context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make
(0,0), | 89 context->copySurface(dst, texture, srcRect, SkIPoint::Make(0,0)); |
| 90 GrContext::kFlushWrites_PixelOp); | 90 context->flushSurfaceWrites(dst); |
| 91 | 91 |
| 92 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem
ul_SkAlphaType, | 92 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem
ul_SkAlphaType, |
| 93 dstPT); | 93 dstPT); |
| 94 SkGrPixelRef* pixelRef = new SkGrPixelRef(info, dst); | 94 SkGrPixelRef* pixelRef = new SkGrPixelRef(info, dst); |
| 95 SkSafeUnref(dst); | 95 SkSafeUnref(dst); |
| 96 return pixelRef; | 96 return pixelRef; |
| 97 } | 97 } |
| 98 | 98 |
| 99 /////////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////////// |
| 100 | 100 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 cachedBitmap.setImmutable(); | 205 cachedBitmap.setImmutable(); |
| 206 //Add to the cache | 206 //Add to the cache |
| 207 SkBitmapCache::Add(this, bounds, cachedBitmap); | 207 SkBitmapCache::Add(this, bounds, cachedBitmap); |
| 208 | 208 |
| 209 dst->swap(cachedBitmap); | 209 dst->swap(cachedBitmap); |
| 210 } | 210 } |
| 211 | 211 |
| 212 return true; | 212 return true; |
| 213 | 213 |
| 214 } | 214 } |
| OLD | NEW |