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

Side by Side Diff: gm/color4f.cpp

Issue 2074103004: Revert of More removal of SkColorProfileType... (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « gm/all_bitmap_configs.cpp ('k') | gm/dftext.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 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
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 sk_sp<SkColorSpace> colorSpaces[]{ 76 SkColorProfileType const profiles[] { kLinear_SkColorProfileType, kSRGB_SkCo lorProfileType };
77 nullptr, 77 for (auto profile : profiles) {
78 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)
79 };
80 for (auto colorSpace : colorSpaces) {
81 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType, 78 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType,
82 colorSpace); 79 profile);
83 auto surface(SkSurface::MakeRaster(info)); 80 auto surface(SkSurface::MakeRaster(info));
84 surface->getCanvas()->drawPaint(bg); 81 surface->getCanvas()->drawPaint(bg);
85 draw_into_canvas(surface->getCanvas()); 82 draw_into_canvas(surface->getCanvas());
86 surface->draw(canvas, 0, 0, nullptr); 83 surface->draw(canvas, 0, 0, nullptr);
87 canvas->translate(0, 120); 84 canvas->translate(0, 120);
88 } 85 }
89 } 86 }
90 87
91 //////////////////////////////////////////////////////////////////////////////// /////////////////// 88 //////////////////////////////////////////////////////////////////////////////// ///////////////////
92 #include "SkColorSpace.h" 89 #include "SkColorSpace.h"
(...skipping 26 matching lines...) Expand all
119 canvas->save(); 116 canvas->save();
120 for (const auto& s : shaders) { 117 for (const auto& s : shaders) {
121 paint.setShader(s); 118 paint.setShader(s);
122 canvas->drawRect(r, paint); 119 canvas->drawRect(r, paint);
123 canvas->translate(r.width() * 6 / 5, 0); 120 canvas->translate(r.width() * 6 / 5, 0);
124 } 121 }
125 canvas->restore(); 122 canvas->restore();
126 canvas->translate(0, r.height() * 6 / 5); 123 canvas->translate(0, r.height() * 6 / 5);
127 } 124 }
128 } 125 }
OLDNEW
« no previous file with comments | « gm/all_bitmap_configs.cpp ('k') | gm/dftext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698