OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info)); | 96 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info)); |
97 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0))
; | 97 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0))
; |
98 if (ctx) { | 98 if (ctx) { |
99 REPORTER_ASSERT(reporter, NULL == | 99 REPORTER_ASSERT(reporter, NULL == |
100 SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted,
info, 0, NULL)); | 100 SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted,
info, 0, NULL)); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 #if SK_SUPPORT_GPU | 104 #if SK_SUPPORT_GPU |
105 static void test_wrapped_surface(skiatest::Reporter* reporter, GrContext* ctx) { | 105 static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
* ctx) { |
106 if (NULL == ctx) { | 106 if (NULL == ctx) { |
107 return; | 107 return; |
108 } | 108 } |
109 | 109 |
110 GrTestTarget tt; | 110 GrTestTarget tt; |
111 ctx->getTestTarget(&tt); | 111 ctx->getTestTarget(&tt); |
112 if (!tt.target()) { | 112 if (!tt.target()) { |
113 SkDEBUGFAIL("Couldn't get Gr test target."); | 113 SkDEBUGFAIL("Couldn't get Gr test target."); |
114 return; | 114 return; |
115 } | 115 } |
116 | 116 |
117 // We currently have only implemented the texture uploads for GL. | 117 // We currently have only implemented the texture uploads for GL. |
118 const GrGLInterface* gl = tt.glContext()->interface(); | 118 const GrGLInterface* gl = tt.glContext()->interface(); |
119 if (!gl) { | 119 if (!gl) { |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
123 for (int useFBO = 0; useFBO < 2; ++useFBO) { | 123 // Test the wrapped factory for SkSurface by creating a texture using GL and
then wrap it in |
124 // Test the wrapped factory for SkSurface by creating a texture using GL
and then wrap it in | 124 // a SkSurface. |
125 // a SkSurface. | 125 GrGLuint texID; |
126 GrGLuint texID; | 126 static const int kW = 100; |
127 static const int kW = 100; | 127 static const int kH = 100; |
128 static const int kH = 100; | 128 static const uint32_t kOrigColor = 0xFFAABBCC; |
129 static const uint32_t kOrigColor = 0xFFAABBCC; | 129 SkAutoTArray<uint32_t> pixels(kW * kH); |
130 SkAutoTArray<uint32_t> pixels(kW * kH); | 130 sk_memset32(pixels.get(), kOrigColor, kW * kH); |
131 sk_memset32(pixels.get(), kOrigColor, kW * kH); | 131 GR_GL_CALL(gl, GenTextures(1, &texID)); |
132 GR_GL_CALL(gl, GenTextures(1, &texID)); | 132 GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); |
133 GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); | 133 GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); |
134 GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); | 134 GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, texID)); |
135 GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, texID)); | 135 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, |
136 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, | 136 GR_GL_NEAREST)); |
137 GR_GL_NEAREST)); | 137 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, |
138 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, | 138 GR_GL_NEAREST)); |
139 GR_GL_NEAREST)); | 139 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, |
140 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, | 140 GR_GL_CLAMP_TO_EDGE)); |
141 GR_GL_CLAMP_TO_EDGE)); | 141 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, |
142 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, | 142 GR_GL_CLAMP_TO_EDGE)); |
143 GR_GL_CLAMP_TO_EDGE)); | 143 GR_GL_CALL(gl, TexImage2D(GR_GL_TEXTURE_2D, 0, GR_GL_RGBA, kW, kH, 0, GR_GL_
RGBA, |
144 GR_GL_CALL(gl, TexImage2D(GR_GL_TEXTURE_2D, 0, GR_GL_RGBA, kW, kH, 0, GR
_GL_RGBA, | 144 GR_GL_UNSIGNED_BYTE, |
145 GR_GL_UNSIGNED_BYTE, | 145 pixels.get())); |
146 pixels.get())); | |
147 | 146 |
148 SkAutoTUnref<SkSurface> surface; | 147 GrBackendTextureDesc wrappedDesc; |
149 GrGLuint fboID = 0; | 148 wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; |
150 if (useFBO) { | 149 wrappedDesc.fWidth = kW; |
151 GR_GL_CALL(gl, GenFramebuffers(1, &fboID)); | 150 wrappedDesc.fHeight = kH; |
152 GR_GL_CALL(gl, BindFramebuffer(GR_GL_FRAMEBUFFER, fboID)); | 151 wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
153 GR_GL_CALL(gl, FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_A
TTACHMENT0, | 152 wrappedDesc.fSampleCnt = 0; |
154 GR_GL_TEXTURE_2D, texID, 0)); | 153 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; |
155 GrBackendRenderTargetDesc wrappedDesc; | 154 wrappedDesc.fTextureHandle = texID; |
156 wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; | |
157 wrappedDesc.fWidth = kW; | |
158 wrappedDesc.fHeight = kH; | |
159 wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | |
160 wrappedDesc.fSampleCnt = 0; | |
161 wrappedDesc.fRenderTargetHandle = fboID; | |
162 wrappedDesc.fStencilBits = 0; | |
163 | 155 |
164 ctx->resetContext(); | 156 SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrapp
edDesc, NULL)); |
165 surface.reset(SkSurface::NewFromBackendRenderTarget(ctx, wrappedDesc
, NULL)); | 157 REPORTER_ASSERT(reporter, surface); |
166 } else { | 158 if (surface) { |
167 GrBackendTextureDesc wrappedDesc; | 159 // Validate that we can draw to the canvas and that the original texture
color is preserved |
168 wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; | 160 // in pixels that aren't rendered to via the surface. |
169 wrappedDesc.fWidth = kW; | 161 SkPaint paint; |
170 wrappedDesc.fHeight = kH; | 162 static const SkColor kRectColor = ~kOrigColor | 0xFF000000; |
171 wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 163 paint.setColor(kRectColor); |
172 wrappedDesc.fSampleCnt = 0; | 164 surface->getCanvas()->drawRect(SkRect::MakeWH(SkIntToScalar(kW), SkIntTo
Scalar(kH)/2), |
173 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; | 165 paint); |
174 wrappedDesc.fTextureHandle = texID; | 166 SkImageInfo readInfo = SkImageInfo::MakeN32Premul(kW, kH); |
175 | 167 surface->readPixels(readInfo, pixels.get(), kW * sizeof(uint32_t), 0, 0)
; |
176 ctx->resetContext(); | 168 bool stop = false; |
177 surface.reset(SkSurface::NewFromBackendTexture(ctx, wrappedDesc, NUL
L)); | 169 SkPMColor origColorPM = SkPackARGB32((kOrigColor >> 24 & 0xFF), |
178 } | 170 (kOrigColor >> 0 & 0xFF), |
179 REPORTER_ASSERT(reporter, surface); | 171 (kOrigColor >> 8 & 0xFF), |
180 if (surface) { | 172 (kOrigColor >> 16 & 0xFF)); |
181 // Validate that we can draw to the canvas and that the original tex
ture color is | 173 SkPMColor rectColorPM = SkPackARGB32((kRectColor >> 24 & 0xFF), |
182 // preserved in pixels that aren't rendered to via the surface. | 174 (kRectColor >> 16 & 0xFF), |
183 SkPaint paint; | 175 (kRectColor >> 8 & 0xFF), |
184 static const SkColor kRectColor = ~kOrigColor | 0xFF000000; | 176 (kRectColor >> 0 & 0xFF)); |
185 paint.setColor(kRectColor); | 177 for (int y = 0; y < kH/2 && !stop; ++y) { |
186 surface->getCanvas()->drawRect(SkRect::MakeWH(SkIntToScalar(kW), SkI
ntToScalar(kH)/2), | 178 for (int x = 0; x < kW && !stop; ++x) { |
187 paint); | 179 REPORTER_ASSERT(reporter, rectColorPM == pixels[x + y * kW]); |
188 SkImageInfo readInfo = SkImageInfo::MakeN32Premul(kW, kH); | 180 if (rectColorPM != pixels[x + y * kW]) { |
189 surface->readPixels(readInfo, pixels.get(), kW * sizeof(uint32_t), 0
, 0); | 181 stop = true; |
190 bool stop = false; | |
191 SkPMColor origColorPM = SkPackARGB32((kOrigColor >> 24 & 0xFF), | |
192 (kOrigColor >> 0 & 0xFF), | |
193 (kOrigColor >> 8 & 0xFF), | |
194 (kOrigColor >> 16 & 0xFF)); | |
195 SkPMColor rectColorPM = SkPackARGB32((kRectColor >> 24 & 0xFF), | |
196 (kRectColor >> 16 & 0xFF), | |
197 (kRectColor >> 8 & 0xFF), | |
198 (kRectColor >> 0 & 0xFF)); | |
199 for (int y = 0; y < kH/2 && !stop; ++y) { | |
200 for (int x = 0; x < kW && !stop; ++x) { | |
201 REPORTER_ASSERT(reporter, rectColorPM == pixels[x + y * kW])
; | |
202 if (rectColorPM != pixels[x + y * kW]) { | |
203 stop = true; | |
204 } | |
205 } | |
206 } | |
207 stop = false; | |
208 for (int y = kH/2; y < kH && !stop; ++y) { | |
209 for (int x = 0; x < kW && !stop; ++x) { | |
210 REPORTER_ASSERT(reporter, origColorPM == pixels[x + y * kW])
; | |
211 if (origColorPM != pixels[x + y * kW]) { | |
212 stop = true; | |
213 } | |
214 } | 182 } |
215 } | 183 } |
216 } | 184 } |
217 if (texID) { | 185 stop = false; |
218 GR_GL_CALL(gl, DeleteTextures(1, &texID)); | 186 for (int y = kH/2; y < kH && !stop; ++y) { |
| 187 for (int x = 0; x < kW && !stop; ++x) { |
| 188 REPORTER_ASSERT(reporter, origColorPM == pixels[x + y * kW]); |
| 189 if (origColorPM != pixels[x + y * kW]) { |
| 190 stop = true; |
| 191 } |
| 192 } |
219 } | 193 } |
220 if (fboID) { | |
221 GR_GL_CALL(gl, DeleteFramebuffers(1, &fboID)); | |
222 } | |
223 | |
224 } | 194 } |
225 } | 195 } |
226 #endif | 196 #endif |
227 | 197 |
228 | 198 |
229 static void test_image(skiatest::Reporter* reporter) { | 199 static void test_image(skiatest::Reporter* reporter) { |
230 SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); | 200 SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); |
231 size_t rowBytes = info.minRowBytes(); | 201 size_t rowBytes = info.minRowBytes(); |
232 size_t size = info.getSafeSize(rowBytes); | 202 size_t size = info.getSafeSize(rowBytes); |
233 SkData* data = SkData::NewUninitialized(size); | 203 SkData* data = SkData::NewUninitialized(size); |
(...skipping 26 matching lines...) Expand all Loading... |
260 return device->accessBitmap(false).getGenerationID(); | 230 return device->accessBitmap(false).getGenerationID(); |
261 } | 231 } |
262 | 232 |
263 /* | 233 /* |
264 * Test legacy behavor of bumping the surface's device's bitmap's genID when we
access its | 234 * Test legacy behavor of bumping the surface's device's bitmap's genID when we
access its |
265 * texture handle for writing. | 235 * texture handle for writing. |
266 * | 236 * |
267 * Note: this needs to be tested separately from checking newImageSnapshot, as
calling that | 237 * Note: this needs to be tested separately from checking newImageSnapshot, as
calling that |
268 * can also incidentally bump the genID (when a new backing surface is created)
. | 238 * can also incidentally bump the genID (when a new backing surface is created)
. |
269 */ | 239 */ |
270 static void test_texture_handle_genID(skiatest::Reporter* reporter, SkSurface* s
urf) { | 240 template <class F> |
| 241 static void test_texture_handle_genID(skiatest::Reporter* reporter, SkSurface* s
urf, F f) { |
271 const uint32_t gen0 = get_legacy_gen_id(surf); | 242 const uint32_t gen0 = get_legacy_gen_id(surf); |
272 surf->getTextureHandle(SkSurface::kFlushRead_TextureHandleAccess); | 243 f(surf, SkSurface::kFlushRead_BackendHandleAccess); |
273 const uint32_t gen1 = get_legacy_gen_id(surf); | 244 const uint32_t gen1 = get_legacy_gen_id(surf); |
274 REPORTER_ASSERT(reporter, gen0 == gen1); | 245 REPORTER_ASSERT(reporter, gen0 == gen1); |
275 | 246 |
276 surf->getTextureHandle(SkSurface::kFlushWrite_TextureHandleAccess); | 247 f(surf, SkSurface::kFlushWrite_BackendHandleAccess); |
277 const uint32_t gen2 = get_legacy_gen_id(surf); | 248 const uint32_t gen2 = get_legacy_gen_id(surf); |
278 REPORTER_ASSERT(reporter, gen0 != gen2); | 249 REPORTER_ASSERT(reporter, gen0 != gen2); |
279 | 250 |
280 surf->getTextureHandle(SkSurface::kDiscardWrite_TextureHandleAccess); | 251 f(surf, SkSurface::kDiscardWrite_BackendHandleAccess); |
281 const uint32_t gen3 = get_legacy_gen_id(surf); | 252 const uint32_t gen3 = get_legacy_gen_id(surf); |
282 REPORTER_ASSERT(reporter, gen0 != gen3); | 253 REPORTER_ASSERT(reporter, gen0 != gen3); |
283 REPORTER_ASSERT(reporter, gen2 != gen3); | 254 REPORTER_ASSERT(reporter, gen2 != gen3); |
284 } | 255 } |
285 | 256 |
286 static void test_texture_handle(skiatest::Reporter* reporter, SkSurface* surf) { | 257 template <class F> |
| 258 static void test_backend_handle(skiatest::Reporter* reporter, SkSurface* surf, F
f) { |
287 SkAutoTUnref<SkImage> image0(surf->newImageSnapshot()); | 259 SkAutoTUnref<SkImage> image0(surf->newImageSnapshot()); |
288 GrBackendObject obj = surf->getTextureHandle(SkSurface::kFlushRead_TextureHa
ndleAccess); | 260 GrBackendObject obj = f(surf, SkSurface::kFlushRead_BackendHandleAccess); |
289 REPORTER_ASSERT(reporter, obj != 0); | 261 REPORTER_ASSERT(reporter, obj != 0); |
290 SkAutoTUnref<SkImage> image1(surf->newImageSnapshot()); | 262 SkAutoTUnref<SkImage> image1(surf->newImageSnapshot()); |
291 // just read access should not affect the snapshot | 263 // just read access should not affect the snapshot |
292 REPORTER_ASSERT(reporter, image0->uniqueID() == image1->uniqueID()); | 264 REPORTER_ASSERT(reporter, image0->uniqueID() == image1->uniqueID()); |
293 | 265 |
294 obj = surf->getTextureHandle(SkSurface::kFlushWrite_TextureHandleAccess); | 266 obj = f(surf, SkSurface::kFlushWrite_BackendHandleAccess); |
295 REPORTER_ASSERT(reporter, obj != 0); | 267 REPORTER_ASSERT(reporter, obj != 0); |
296 SkAutoTUnref<SkImage> image2(surf->newImageSnapshot()); | 268 SkAutoTUnref<SkImage> image2(surf->newImageSnapshot()); |
297 // expect a new image, since we claimed we would write | 269 // expect a new image, since we claimed we would write |
298 REPORTER_ASSERT(reporter, image0->uniqueID() != image2->uniqueID()); | 270 REPORTER_ASSERT(reporter, image0->uniqueID() != image2->uniqueID()); |
299 | 271 |
300 obj = surf->getTextureHandle(SkSurface::kDiscardWrite_TextureHandleAccess); | 272 obj = f(surf, SkSurface::kDiscardWrite_BackendHandleAccess); |
301 REPORTER_ASSERT(reporter, obj != 0); | 273 REPORTER_ASSERT(reporter, obj != 0); |
302 SkAutoTUnref<SkImage> image3(surf->newImageSnapshot()); | 274 SkAutoTUnref<SkImage> image3(surf->newImageSnapshot()); |
303 // expect a new(er) image, since we claimed we would write | 275 // expect a new(er) image, since we claimed we would write |
304 REPORTER_ASSERT(reporter, image0->uniqueID() != image3->uniqueID()); | 276 REPORTER_ASSERT(reporter, image0->uniqueID() != image3->uniqueID()); |
305 REPORTER_ASSERT(reporter, image2->uniqueID() != image3->uniqueID()); | 277 REPORTER_ASSERT(reporter, image2->uniqueID() != image3->uniqueID()); |
306 } | 278 } |
307 | 279 |
308 static SkImage* create_image(skiatest::Reporter* reporter, | 280 static SkImage* create_image(skiatest::Reporter* reporter, |
309 ImageType imageType, GrContext* context, SkColor co
lor, | 281 ImageType imageType, GrContext* context, SkColor co
lor, |
310 ReleaseDataContext* releaseContext) { | 282 ReleaseDataContext* releaseContext) { |
(...skipping 13 matching lines...) Expand all Loading... |
324 return SkImage::NewRasterData(info, data, rowBytes); | 296 return SkImage::NewRasterData(info, data, rowBytes); |
325 case kRasterProc_ImageType: | 297 case kRasterProc_ImageType: |
326 SkASSERT(releaseContext); | 298 SkASSERT(releaseContext); |
327 releaseContext->fData = SkRef(data.get()); | 299 releaseContext->fData = SkRef(data.get()); |
328 return SkImage::NewFromRaster(info, addr, rowBytes, | 300 return SkImage::NewFromRaster(info, addr, rowBytes, |
329 ReleaseDataContext::Release, releaseCo
ntext); | 301 ReleaseDataContext::Release, releaseCo
ntext); |
330 case kGpu_ImageType: { | 302 case kGpu_ImageType: { |
331 SkAutoTUnref<SkSurface> surf( | 303 SkAutoTUnref<SkSurface> surf( |
332 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, inf
o, 0)); | 304 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, inf
o, 0)); |
333 surf->getCanvas()->clear(color); | 305 surf->getCanvas()->clear(color); |
334 // test our backing texture while were here... | 306 // test our backing texture / rendertarget while were here... |
335 test_texture_handle_genID(reporter, surf); | 307 auto textureAccessorFunc = |
336 test_texture_handle(reporter, surf); | 308 [](SkSurface* surf, SkSurface::BackendHandleAccess access) -
> GrBackendObject { |
| 309 return surf->getTextureHandle(access); }; |
| 310 auto renderTargetAccessorFunc = |
| 311 [](SkSurface* surf, SkSurface::BackendHandleAccess access) -
> GrBackendObject { |
| 312 GrBackendObject obj; |
| 313 SkAssertResult(surf->getRenderTargetHandle(&obj, access)
); |
| 314 return obj; }; |
| 315 test_backend_handle(reporter, surf, textureAccessorFunc); |
| 316 test_backend_handle(reporter, surf, renderTargetAccessorFunc); |
| 317 test_texture_handle_genID(reporter, surf, textureAccessorFunc); |
| 318 test_texture_handle_genID(reporter, surf, renderTargetAccessorFunc); |
| 319 |
337 // redraw so our returned image looks as expected. | 320 // redraw so our returned image looks as expected. |
338 surf->getCanvas()->clear(color); | 321 surf->getCanvas()->clear(color); |
339 return surf->newImageSnapshot(); | 322 return surf->newImageSnapshot(); |
340 } | 323 } |
341 case kCodec_ImageType: { | 324 case kCodec_ImageType: { |
342 SkBitmap bitmap; | 325 SkBitmap bitmap; |
343 bitmap.installPixels(info, addr, rowBytes); | 326 bitmap.installPixels(info, addr, rowBytes); |
344 SkAutoTUnref<SkData> src( | 327 SkAutoTUnref<SkData> src( |
345 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, 1
00)); | 328 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, 1
00)); |
346 return SkImage::NewFromEncoded(src); | 329 return SkImage::NewFromEncoded(src); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceTy
pe, context); | 859 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceTy
pe, context); |
877 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpuScratch_Su
rfaceType, context); | 860 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpuScratch_Su
rfaceType, context); |
878 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kDiscard_ContentChangeMode); | 861 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kDiscard_ContentChangeMode); |
879 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kDiscard_ContentChangeMode); | 862 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kDiscard_ContentChangeMode); |
880 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kRetain_ContentChangeMode); | 863 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kRetain_ContentChangeMode); |
881 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); | 864 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); |
882 TestGetTexture(reporter, kGpu_SurfaceType, context); | 865 TestGetTexture(reporter, kGpu_SurfaceType, context); |
883 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 866 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
884 test_empty_surface(reporter, context); | 867 test_empty_surface(reporter, context); |
885 test_surface_budget(reporter, context); | 868 test_surface_budget(reporter, context); |
886 test_wrapped_surface(reporter, context); | 869 test_wrapped_texture_surface(reporter, context); |
887 } | 870 } |
888 } | 871 } |
889 } | 872 } |
890 #endif | 873 #endif |
891 } | 874 } |
892 | 875 |
893 #if SK_SUPPORT_GPU | 876 #if SK_SUPPORT_GPU |
894 | 877 |
895 struct ReleaseTextureContext { | 878 struct ReleaseTextureContext { |
896 ReleaseTextureContext(skiatest::Reporter* reporter) { | 879 ReleaseTextureContext(skiatest::Reporter* reporter) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color | 962 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color |
980 test_image_color(reporter, refImg, expected1); | 963 test_image_color(reporter, refImg, expected1); |
981 test_image_color(reporter, cpyImg, expected0); | 964 test_image_color(reporter, cpyImg, expected0); |
982 | 965 |
983 // Now exercise the release proc | 966 // Now exercise the release proc |
984 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 967 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
985 refImg.reset(NULL); // force a release of the image | 968 refImg.reset(NULL); // force a release of the image |
986 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 969 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
987 } | 970 } |
988 #endif | 971 #endif |
OLD | NEW |