OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 DEF_SIMPLE_GM(color4f, canvas, 1024, 260) { | 68 DEF_SIMPLE_GM(color4f, canvas, 1024, 260) { |
69 canvas->translate(10, 10); | 69 canvas->translate(10, 10); |
70 | 70 |
71 SkPaint bg; | 71 SkPaint bg; |
72 // need the target to be opaque, so we can draw it to the screen | 72 // need the target to be opaque, so we can draw it to the screen |
73 // even if it holds sRGB values. | 73 // even if it holds sRGB values. |
74 bg.setColor(0xFFFFFFFF); | 74 bg.setColor(0xFFFFFFFF); |
75 | 75 |
76 SkColorProfileType const profiles[] { kLinear_SkColorProfileType, kSRGB_SkCo
lorProfileType }; | 76 sk_sp<SkColorSpace> colorSpaces[]{ |
77 for (auto profile : profiles) { | 77 nullptr, |
| 78 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) |
| 79 }; |
| 80 for (auto colorSpace : colorSpaces) { |
78 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType,
kPremul_SkAlphaType, | 81 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType,
kPremul_SkAlphaType, |
79 profile); | 82 colorSpace); |
80 auto surface(SkSurface::MakeRaster(info)); | 83 auto surface(SkSurface::MakeRaster(info)); |
81 surface->getCanvas()->drawPaint(bg); | 84 surface->getCanvas()->drawPaint(bg); |
82 draw_into_canvas(surface->getCanvas()); | 85 draw_into_canvas(surface->getCanvas()); |
83 surface->draw(canvas, 0, 0, nullptr); | 86 surface->draw(canvas, 0, 0, nullptr); |
84 canvas->translate(0, 120); | 87 canvas->translate(0, 120); |
85 } | 88 } |
86 } | 89 } |
87 | 90 |
88 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 91 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
89 #include "SkColorSpace.h" | 92 #include "SkColorSpace.h" |
(...skipping 26 matching lines...) Expand all Loading... |
116 canvas->save(); | 119 canvas->save(); |
117 for (const auto& s : shaders) { | 120 for (const auto& s : shaders) { |
118 paint.setShader(s); | 121 paint.setShader(s); |
119 canvas->drawRect(r, paint); | 122 canvas->drawRect(r, paint); |
120 canvas->translate(r.width() * 6 / 5, 0); | 123 canvas->translate(r.width() * 6 / 5, 0); |
121 } | 124 } |
122 canvas->restore(); | 125 canvas->restore(); |
123 canvas->translate(0, r.height() * 6 / 5); | 126 canvas->translate(0, r.height() * 6 / 5); |
124 } | 127 } |
125 } | 128 } |
OLD | NEW |