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

Side by Side Diff: tests/SurfaceTest.cpp

Issue 1017293002: guarded change to SkImageGenerator to make getInfo() const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « tests/ImageGeneratorTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 enum ImageType { 60 enum ImageType {
61 kRasterCopy_ImageType, 61 kRasterCopy_ImageType,
62 kRasterData_ImageType, 62 kRasterData_ImageType,
63 kGpu_ImageType, 63 kGpu_ImageType,
64 kCodec_ImageType, 64 kCodec_ImageType,
65 }; 65 };
66 66
67 #include "SkImageGenerator.h" 67 #include "SkImageGenerator.h"
68 68
69 class EmptyGenerator : public SkImageGenerator { 69 class EmptyGenerator : public SkImageGenerator {
70 protected: 70 public:
71 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { 71 EmptyGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {}
72 *info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
73 return true;
74 }
75 }; 72 };
76 73
77 static void test_empty_image(skiatest::Reporter* reporter) { 74 static void test_empty_image(skiatest::Reporter* reporter) {
78 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S kAlphaType); 75 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S kAlphaType);
79 76
80 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0)); 77 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0));
81 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0)); 78 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0));
82 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(SkNEW(EmptyGener ator))); 79 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(SkNEW(EmptyGener ator)));
83 } 80 }
84 81
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kRetain_ContentChangeMode); 567 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kRetain_ContentChangeMode);
571 TestGetTexture(reporter, kGpu_SurfaceType, context); 568 TestGetTexture(reporter, kGpu_SurfaceType, context);
572 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); 569 TestGetTexture(reporter, kGpuScratch_SurfaceType, context);
573 test_empty_surface(reporter, context); 570 test_empty_surface(reporter, context);
574 test_surface_budget(reporter, context); 571 test_surface_budget(reporter, context);
575 } 572 }
576 } 573 }
577 } 574 }
578 #endif 575 #endif
579 } 576 }
OLDNEW
« no previous file with comments | « tests/ImageGeneratorTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698