| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 // 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 |
| 86 // 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 |
| 87 // a larger TODO to remove SkGrPixelRef entirely. | 87 // a larger TODO to remove SkGrPixelRef entirely. |
| 88 context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make
(0,0), | 88 context->copySurface(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make
(0,0), |
| 89 GrContext::kFlushWrites_PixelOp); | 89 GrContext::kFlushWrites_PixelOp); |
| 90 | 90 |
| 91 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem
ul_SkAlphaType, | 91 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem
ul_SkAlphaType, |
| 92 dstPT); | 92 dstPT); |
| 93 SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst)); | 93 SkGrPixelRef* pixelRef = new SkGrPixelRef(info, dst); |
| 94 SkSafeUnref(dst); | 94 SkSafeUnref(dst); |
| 95 return pixelRef; | 95 return pixelRef; |
| 96 } | 96 } |
| 97 | 97 |
| 98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
| 99 | 99 |
| 100 SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface) : INHERI
TED(info) { | 100 SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface) : INHERI
TED(info) { |
| 101 // For surfaces that are both textures and render targets, the texture owns
the | 101 // For surfaces that are both textures and render targets, the texture owns
the |
| 102 // render target but not vice versa. So we ref the texture to keep both aliv
e for | 102 // render target but not vice versa. So we ref the texture to keep both aliv
e for |
| 103 // the lifetime of this pixel ref. | 103 // the lifetime of this pixel ref. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 cachedBitmap.setImmutable(); | 194 cachedBitmap.setImmutable(); |
| 195 //Add to the cache | 195 //Add to the cache |
| 196 SkBitmapCache::Add(this, bounds, cachedBitmap); | 196 SkBitmapCache::Add(this, bounds, cachedBitmap); |
| 197 | 197 |
| 198 dst->swap(cachedBitmap); | 198 dst->swap(cachedBitmap); |
| 199 } | 199 } |
| 200 | 200 |
| 201 return true; | 201 return true; |
| 202 | 202 |
| 203 } | 203 } |
| OLD | NEW |