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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 SkISize onISize() override { | 72 SkISize onISize() override { |
73 return SkISize::Make(W * 4, H * 5); | 73 return SkISize::Make(W * 4, H * 5); |
74 } | 74 } |
75 | 75 |
76 void onDraw(SkCanvas* canvas) override { | 76 void onDraw(SkCanvas* canvas) override { |
77 GrContext* ctx = canvas->getGrContext(); | 77 GrContext* ctx = canvas->getGrContext(); |
78 | 78 |
79 // must be opaque to have a hope of testing LCD text | 79 // must be opaque to have a hope of testing LCD text |
80 const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType, | 80 const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType, |
81 sk_ref_sp(canvas->imageInf
o().colorSpace())); | 81 canvas->imageInfo().profil
eType()); |
82 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); | 82 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); |
83 bool gammaCorrect = canvas->getProps(&canvasProps) && canvasProps.isGamm
aCorrect(); | 83 bool gammaCorrect = canvas->getProps(&canvasProps) && canvasProps.isGamm
aCorrect(); |
84 | 84 |
85 const struct { | 85 const struct { |
86 SkPixelGeometry fGeo; | 86 SkPixelGeometry fGeo; |
87 const char* fLabel; | 87 const char* fLabel; |
88 } recs[] = { | 88 } recs[] = { |
89 { kUnknown_SkPixelGeometry, "Unknown" }, | 89 { kUnknown_SkPixelGeometry, "Unknown" }, |
90 { kRGB_H_SkPixelGeometry, "RGB_H" }, | 90 { kRGB_H_SkPixelGeometry, "RGB_H" }, |
91 { kBGR_H_SkPixelGeometry, "BGR_H" }, | 91 { kBGR_H_SkPixelGeometry, "BGR_H" }, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 SkASSERT(equal(surf->props(), surf2->props())); | 162 SkASSERT(equal(surf->props(), surf2->props())); |
163 | 163 |
164 sk_sp<SkImage> image2(surf2->makeImageSnapshot()); | 164 sk_sp<SkImage> image2(surf2->makeImageSnapshot()); |
165 canvas->drawImage(image2.get(), 10 + SkIntToScalar(image->width()) + 10,
10, nullptr); | 165 canvas->drawImage(image2.get(), 10 + SkIntToScalar(image->width()) + 10,
10, nullptr); |
166 } | 166 } |
167 | 167 |
168 private: | 168 private: |
169 typedef GM INHERITED; | 169 typedef GM INHERITED; |
170 }; | 170 }; |
171 DEF_GM( return new NewSurfaceGM ) | 171 DEF_GM( return new NewSurfaceGM ) |
OLD | NEW |