OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const struct { | 79 const struct { |
80 SkPixelGeometry fGeo; | 80 SkPixelGeometry fGeo; |
81 const char* fLabel; | 81 const char* fLabel; |
82 } rec[] = { | 82 } rec[] = { |
83 { kUnknown_SkPixelGeometry, "Unknown" }, | 83 { kUnknown_SkPixelGeometry, "Unknown" }, |
84 { kRGB_H_SkPixelGeometry, "RGB_H" }, | 84 { kRGB_H_SkPixelGeometry, "RGB_H" }, |
85 { kBGR_H_SkPixelGeometry, "BGR_H" }, | 85 { kBGR_H_SkPixelGeometry, "BGR_H" }, |
86 { kRGB_V_SkPixelGeometry, "RGB_V" }, | 86 { kRGB_V_SkPixelGeometry, "RGB_V" }, |
87 { kBGR_V_SkPixelGeometry, "BGR_V" }, | 87 { kBGR_V_SkPixelGeometry, "BGR_V" }, |
88 }; | 88 }; |
89 | 89 |
90 SkScalar x = 0; | 90 SkScalar x = 0; |
91 for (int disallowAA = 0; disallowAA <= 1; ++disallowAA) { | 91 for (int disallowAA = 0; disallowAA <= 1; ++disallowAA) { |
92 for (int disallowDither = 0; disallowDither <= 1; ++disallowDither)
{ | 92 for (int disallowDither = 0; disallowDither <= 1; ++disallowDither)
{ |
93 SkScalar y = 0; | 93 SkScalar y = 0; |
94 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { | 94 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { |
95 auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA
, disallowDither)); | 95 auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA
, disallowDither)); |
96 test_draw(surface->getCanvas(), rec[i].fLabel); | 96 test_draw(surface->getCanvas(), rec[i].fLabel); |
97 surface->draw(canvas, x, y, nullptr); | 97 surface->draw(canvas, x, y, nullptr); |
98 y += H; | 98 y += H; |
99 } | 99 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 SkASSERT(equal(surf->props(), surf2->props())); | 149 SkASSERT(equal(surf->props(), surf2->props())); |
150 | 150 |
151 sk_sp<SkImage> image2(surf2->makeImageSnapshot()); | 151 sk_sp<SkImage> image2(surf2->makeImageSnapshot()); |
152 canvas->drawImage(image2.get(), 10 + SkIntToScalar(image->width()) + 10,
10, nullptr); | 152 canvas->drawImage(image2.get(), 10 + SkIntToScalar(image->width()) + 10,
10, nullptr); |
153 } | 153 } |
154 | 154 |
155 private: | 155 private: |
156 typedef GM INHERITED; | 156 typedef GM INHERITED; |
157 }; | 157 }; |
158 DEF_GM( return new NewSurfaceGM ) | 158 DEF_GM( return new NewSurfaceGM ) |
159 | |
OLD | NEW |