| 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 "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color)); | 144 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color)); |
| 145 if (!image.get()) { | 145 if (!image.get()) { |
| 146 continue; // gpu may not be enabled | 146 continue; // gpu may not be enabled |
| 147 } | 147 } |
| 148 const void* addr = image->peekPixels(&info, &rowBytes); | 148 const void* addr = image->peekPixels(&info, &rowBytes); |
| 149 bool success = (NULL != addr); | 149 bool success = (NULL != addr); |
| 150 REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); | 150 REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); |
| 151 if (success) { | 151 if (success) { |
| 152 REPORTER_ASSERT(reporter, 10 == info.fWidth); | 152 REPORTER_ASSERT(reporter, 10 == info.fWidth); |
| 153 REPORTER_ASSERT(reporter, 10 == info.fHeight); | 153 REPORTER_ASSERT(reporter, 10 == info.fHeight); |
| 154 REPORTER_ASSERT(reporter, kPMColor_SkColorType == info.fColorType); | 154 REPORTER_ASSERT(reporter, kN32_SkColorType == info.fColorType); |
| 155 REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.fAlphaType || | 155 REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.fAlphaType || |
| 156 kOpaque_SkAlphaType == info.fAlphaType); | 156 kOpaque_SkAlphaType == info.fAlphaType); |
| 157 REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes); | 157 REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes); |
| 158 REPORTER_ASSERT(reporter, pmcolor == *(const SkPMColor*)addr); | 158 REPORTER_ASSERT(reporter, pmcolor == *(const SkPMColor*)addr); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 static void test_canvaspeek(skiatest::Reporter* reporter, | 163 static void test_canvaspeek(skiatest::Reporter* reporter, |
| 164 GrContextFactory* factory) { | 164 GrContextFactory* factory) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kDiscard_ContentChangeMode); | 447 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kDiscard_ContentChangeMode); |
| 448 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kDiscard_ContentChangeMode); | 448 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kDiscard_ContentChangeMode); |
| 449 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kRetain_ContentChangeMode); | 449 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kRetain_ContentChangeMode); |
| 450 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kRetain_ContentChangeMode); | 450 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kRetain_ContentChangeMode); |
| 451 TestGetTexture(reporter, kGpu_SurfaceType, context); | 451 TestGetTexture(reporter, kGpu_SurfaceType, context); |
| 452 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 452 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 #endif | 455 #endif |
| 456 } | 456 } |
| OLD | NEW |