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

Side by Side Diff: tools/skiaserve/Request.cpp

Issue 2177193004: Always supply a color space (sRGB for now) with F16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix uploading of F16 textures with color spaces Created 4 years, 4 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 | « tools/flags/SkCommonFlagsConfig.cpp ('k') | no next file » | 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 2016 Google Inc. 2 * Copyright 2016 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 "Request.h" 8 #include "Request.h"
9 9
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 struct ColorAndProfile { 161 struct ColorAndProfile {
162 SkColorType fColorType; 162 SkColorType fColorType;
163 bool fSRGB; 163 bool fSRGB;
164 bool fGammaCorrect; 164 bool fGammaCorrect;
165 }; 165 };
166 166
167 ColorAndProfile ColorModes[] = { 167 ColorAndProfile ColorModes[] = {
168 { kN32_SkColorType, false, false }, 168 { kN32_SkColorType, false, false },
169 { kN32_SkColorType, true, true }, 169 { kN32_SkColorType, true, true },
170 { kRGBA_F16_SkColorType, false, true }, 170 { kRGBA_F16_SkColorType, true, true },
171 }; 171 };
172 172
173 } 173 }
174 174
175 SkSurface* Request::createCPUSurface() { 175 SkSurface* Request::createCPUSurface() {
176 SkIRect bounds = this->getBounds(); 176 SkIRect bounds = this->getBounds();
177 ColorAndProfile cap = ColorModes[fColorMode]; 177 ColorAndProfile cap = ColorModes[fColorMode];
178 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 178 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
179 SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fC olorType, 179 SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fC olorType,
180 kPremul_SkAlphaType, cap.fSRGB ? srgbCo lorSpace : nullptr); 180 kPremul_SkAlphaType, cap.fSRGB ? srgbCo lorSpace : nullptr);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 SkASSERT(bitmap); 300 SkASSERT(bitmap);
301 301
302 // Convert to format suitable for inspection 302 // Convert to format suitable for inspection
303 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 303 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
304 SkASSERT(encodedBitmap.get()); 304 SkASSERT(encodedBitmap.get());
305 305
306 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 306 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
307 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 307 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
308 return result; 308 return result;
309 } 309 }
OLDNEW
« no previous file with comments | « tools/flags/SkCommonFlagsConfig.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698