OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkSurface_Gpu.h" | 8 #include "SkSurface_Gpu.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 &this->props()); | 76 &this->props()); |
77 } | 77 } |
78 | 78 |
79 SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) { | 79 SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) { |
80 const SkImageInfo info = fDevice->imageInfo(); | 80 const SkImageInfo info = fDevice->imageInfo(); |
81 const int sampleCount = fDevice->accessRenderTarget()->numColorSamples(); | 81 const int sampleCount = fDevice->accessRenderTarget()->numColorSamples(); |
82 SkImage* image = NULL; | 82 SkImage* image = NULL; |
83 GrTexture* tex = fDevice->accessRenderTarget()->asTexture(); | 83 GrTexture* tex = fDevice->accessRenderTarget()->asTexture(); |
84 if (tex) { | 84 if (tex) { |
85 image = SkNEW_ARGS(SkImage_Gpu, | 85 image = SkNEW_ARGS(SkImage_Gpu, |
86 (info.width(), info.height(), info.alphaType(), | 86 (info.width(), info.height(), kNeedNewImageUniqueID,
info.alphaType(), |
87 tex, sampleCount, budgeted)); | 87 tex, sampleCount, budgeted)); |
88 } | 88 } |
89 if (image) { | 89 if (image) { |
90 as_IB(image)->initWithProps(this->props()); | 90 as_IB(image)->initWithProps(this->props()); |
91 } | 91 } |
92 return image; | 92 return image; |
93 } | 93 } |
94 | 94 |
95 // Create a new render target and, if necessary, copy the contents of the old | 95 // Create a new render target and, if necessary, copy the contents of the old |
96 // render target into it. Note that this flushes the SkGpuDevice but | 96 // render target into it. Note that this flushes the SkGpuDevice but |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, | 168 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, |
169 SkGpuDevice::kUninit_In
itContents)); | 169 SkGpuDevice::kUninit_In
itContents)); |
170 if (!device) { | 170 if (!device) { |
171 return NULL; | 171 return NULL; |
172 } | 172 } |
173 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 173 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
174 } | 174 } |
175 | 175 |
176 #endif | 176 #endif |
OLD | NEW |