Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: tests/SurfaceTest.cpp

Issue 153583007: Revert "Serialization of SkPictureImageFilter" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/MatrixClipCollapseTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 kPicture_ImageType, 53 kPicture_ImageType,
54 kCodec_ImageType, 54 kCodec_ImageType,
55 }; 55 };
56 56
57 static void test_image(skiatest::Reporter* reporter) { 57 static void test_image(skiatest::Reporter* reporter) {
58 SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); 58 SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1);
59 size_t rowBytes = info.minRowBytes(); 59 size_t rowBytes = info.minRowBytes();
60 size_t size = info.getSafeSize(rowBytes); 60 size_t size = info.getSafeSize(rowBytes);
61 void* addr = sk_malloc_throw(size); 61 void* addr = sk_malloc_throw(size);
62 SkData* data = SkData::NewFromMalloc(addr, size); 62 SkData* data = SkData::NewFromMalloc(addr, size);
63 63
64 REPORTER_ASSERT(reporter, 1 == data->getRefCnt()); 64 REPORTER_ASSERT(reporter, 1 == data->getRefCnt());
65 SkImage* image = SkImage::NewRasterData(info, data, rowBytes); 65 SkImage* image = SkImage::NewRasterData(info, data, rowBytes);
66 REPORTER_ASSERT(reporter, 2 == data->getRefCnt()); 66 REPORTER_ASSERT(reporter, 2 == data->getRefCnt());
67 image->unref(); 67 image->unref();
68 REPORTER_ASSERT(reporter, 1 == data->getRefCnt()); 68 REPORTER_ASSERT(reporter, 1 == data->getRefCnt());
69 data->unref(); 69 data->unref();
70 } 70 }
71 71
72 static SkImage* createImage(ImageType imageType, GrContext* context, 72 static SkImage* createImage(ImageType imageType, GrContext* context,
73 SkColor color) { 73 SkColor color) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 { kPicture_ImageType, false }, 117 { kPicture_ImageType, false },
118 { kCodec_ImageType, false }, 118 { kCodec_ImageType, false },
119 }; 119 };
120 120
121 const SkColor color = SK_ColorRED; 121 const SkColor color = SK_ColorRED;
122 const SkPMColor pmcolor = SkPreMultiplyColor(color); 122 const SkPMColor pmcolor = SkPreMultiplyColor(color);
123 123
124 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 124 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
125 SkImageInfo info; 125 SkImageInfo info;
126 size_t rowBytes; 126 size_t rowBytes;
127 127
128 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color)); 128 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color));
129 if (!image.get()) { 129 if (!image.get()) {
130 continue; // gpu may not be enabled 130 continue; // gpu may not be enabled
131 } 131 }
132 const void* addr = image->peekPixels(&info, &rowBytes); 132 const void* addr = image->peekPixels(&info, &rowBytes);
133 bool success = (NULL != addr); 133 bool success = (NULL != addr);
134 REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); 134 REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success);
135 if (success) { 135 if (success) {
136 REPORTER_ASSERT(reporter, 10 == info.fWidth); 136 REPORTER_ASSERT(reporter, 10 == info.fWidth);
137 REPORTER_ASSERT(reporter, 10 == info.fHeight); 137 REPORTER_ASSERT(reporter, 10 == info.fHeight);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 Test_crbug263329(reporter, context); 346 Test_crbug263329(reporter, context);
347 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context); 347 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context);
348 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context); 348 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context);
349 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kDiscard_ContentChangeMode); 349 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kDiscard_ContentChangeMode);
350 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kRetain_ContentChangeMode); 350 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kRetain_ContentChangeMode);
351 TestGetTexture(reporter, kGpu_SurfaceType, context); 351 TestGetTexture(reporter, kGpu_SurfaceType, context);
352 } 352 }
353 } 353 }
354 #endif 354 #endif
355 } 355 }
OLDNEW
« no previous file with comments | « tests/MatrixClipCollapseTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698