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

Side by Side Diff: include/gpu/GrTypes.h

Issue 1814533003: Revert of sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « include/gpu/GrTextureParams.h ('k') | include/gpu/SkGr.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 #ifndef GrTypes_DEFINED 8 #ifndef GrTypes_DEFINED
9 #define GrTypes_DEFINED 9 #define GrTypes_DEFINED
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 kRGBA_8888_GrPixelConfig, 211 kRGBA_8888_GrPixelConfig,
212 /** 212 /**
213 * Premultiplied. Byte order is b,g,r,a. 213 * Premultiplied. Byte order is b,g,r,a.
214 */ 214 */
215 kBGRA_8888_GrPixelConfig, 215 kBGRA_8888_GrPixelConfig,
216 /** 216 /**
217 * Premultiplied and sRGB. Byte order is r,g,b,a. 217 * Premultiplied and sRGB. Byte order is r,g,b,a.
218 */ 218 */
219 kSRGBA_8888_GrPixelConfig, 219 kSRGBA_8888_GrPixelConfig,
220 /** 220 /**
221 * Premultiplied and sRGB. Byte order is b,g,r,a.
222 */
223 kSBGRA_8888_GrPixelConfig,
224 /**
225 * ETC1 Compressed Data 221 * ETC1 Compressed Data
226 */ 222 */
227 kETC1_GrPixelConfig, 223 kETC1_GrPixelConfig,
228 /** 224 /**
229 * LATC/RGTC/3Dc/BC4 Compressed Data 225 * LATC/RGTC/3Dc/BC4 Compressed Data
230 */ 226 */
231 kLATC_GrPixelConfig, 227 kLATC_GrPixelConfig,
232 /** 228 /**
233 * R11 EAC Compressed Data 229 * R11 EAC Compressed Data
234 * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec) 230 * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec)
(...skipping 30 matching lines...) Expand all
265 kLast_GrPixelConfig = kRGBA_half_GrPixelConfig 261 kLast_GrPixelConfig = kRGBA_half_GrPixelConfig
266 }; 262 };
267 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; 263 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
268 264
269 // Aliases for pixel configs that match skia's byte order. 265 // Aliases for pixel configs that match skia's byte order.
270 #ifndef SK_CPU_LENDIAN 266 #ifndef SK_CPU_LENDIAN
271 #error "Skia gpu currently assumes little endian" 267 #error "Skia gpu currently assumes little endian"
272 #endif 268 #endif
273 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 269 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
274 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g; 270 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g;
275 static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSBGRA_8888_GrPixe lConfig;
276 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 271 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
277 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g; 272 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g;
278 static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSRGBA_8888_GrPixe lConfig;
279 #else 273 #else
280 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." 274 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
281 #endif 275 #endif
282 276
283 // Returns true if the pixel config is a GPU-specific compressed format 277 // Returns true if the pixel config is a GPU-specific compressed format
284 // representation. 278 // representation.
285 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) { 279 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
286 switch (config) { 280 switch (config) {
287 case kIndex_8_GrPixelConfig: 281 case kIndex_8_GrPixelConfig:
288 case kETC1_GrPixelConfig: 282 case kETC1_GrPixelConfig:
(...skipping 21 matching lines...) Expand all
310 return config; 304 return config;
311 } 305 }
312 } 306 }
313 307
314 // Returns true if the pixel config is 32 bits per pixel 308 // Returns true if the pixel config is 32 bits per pixel
315 static inline bool GrPixelConfigIs8888(GrPixelConfig config) { 309 static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
316 switch (config) { 310 switch (config) {
317 case kRGBA_8888_GrPixelConfig: 311 case kRGBA_8888_GrPixelConfig:
318 case kBGRA_8888_GrPixelConfig: 312 case kBGRA_8888_GrPixelConfig:
319 case kSRGBA_8888_GrPixelConfig: 313 case kSRGBA_8888_GrPixelConfig:
320 case kSBGRA_8888_GrPixelConfig:
321 return true; 314 return true;
322 default: 315 default:
323 return false; 316 return false;
324 } 317 }
325 } 318 }
326 319
327 // Returns true if the color (non-alpha) components represent sRGB values. It do es NOT indicate that 320 // Returns true if the color (non-alpha) components represent sRGB values. It do es NOT indicate that
328 // all three color components are present in the config or anything about their order. 321 // all three color components are present in the config or anything about their order.
329 static inline bool GrPixelConfigIsSRGB(GrPixelConfig config) { 322 static inline bool GrPixelConfigIsSRGB(GrPixelConfig config) {
330 switch (config) { 323 switch (config) {
331 case kSRGBA_8888_GrPixelConfig: 324 case kSRGBA_8888_GrPixelConfig:
332 case kSBGRA_8888_GrPixelConfig:
333 return true; 325 return true;
334 default: 326 default:
335 return false; 327 return false;
336 } 328 }
337 } 329 }
338 330
339 // Takes a config and returns the equivalent config with the R and B order 331 // Takes a config and returns the equivalent config with the R and B order
340 // swapped if such a config exists. Otherwise, kUnknown_GrPixelConfig 332 // swapped if such a config exists. Otherwise, kUnknown_GrPixelConfig
341 static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) { 333 static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) {
342 switch (config) { 334 switch (config) {
343 case kBGRA_8888_GrPixelConfig: 335 case kBGRA_8888_GrPixelConfig:
344 return kRGBA_8888_GrPixelConfig; 336 return kRGBA_8888_GrPixelConfig;
345 case kRGBA_8888_GrPixelConfig: 337 case kRGBA_8888_GrPixelConfig:
346 return kBGRA_8888_GrPixelConfig; 338 return kBGRA_8888_GrPixelConfig;
347 case kSBGRA_8888_GrPixelConfig:
348 return kSRGBA_8888_GrPixelConfig;
349 case kSRGBA_8888_GrPixelConfig:
350 return kSBGRA_8888_GrPixelConfig;
351 default: 339 default:
352 return kUnknown_GrPixelConfig; 340 return kUnknown_GrPixelConfig;
353 } 341 }
354 } 342 }
355 343
356 static inline size_t GrBytesPerPixel(GrPixelConfig config) { 344 static inline size_t GrBytesPerPixel(GrPixelConfig config) {
357 SkASSERT(!GrPixelConfigIsCompressed(config)); 345 SkASSERT(!GrPixelConfigIsCompressed(config));
358 switch (config) { 346 switch (config) {
359 case kAlpha_8_GrPixelConfig: 347 case kAlpha_8_GrPixelConfig:
360 return 1; 348 return 1;
361 case kRGB_565_GrPixelConfig: 349 case kRGB_565_GrPixelConfig:
362 case kRGBA_4444_GrPixelConfig: 350 case kRGBA_4444_GrPixelConfig:
363 case kAlpha_half_GrPixelConfig: 351 case kAlpha_half_GrPixelConfig:
364 return 2; 352 return 2;
365 case kRGBA_8888_GrPixelConfig: 353 case kRGBA_8888_GrPixelConfig:
366 case kBGRA_8888_GrPixelConfig: 354 case kBGRA_8888_GrPixelConfig:
367 case kSRGBA_8888_GrPixelConfig: 355 case kSRGBA_8888_GrPixelConfig:
368 case kSBGRA_8888_GrPixelConfig:
369 return 4; 356 return 4;
370 case kRGBA_half_GrPixelConfig: 357 case kRGBA_half_GrPixelConfig:
371 return 8; 358 return 8;
372 case kRGBA_float_GrPixelConfig: 359 case kRGBA_float_GrPixelConfig:
373 return 16; 360 return 16;
374 default: 361 default:
375 return 0; 362 return 0;
376 } 363 }
377 } 364 }
378 365
(...skipping 13 matching lines...) Expand all
392 case kLATC_GrPixelConfig: 379 case kLATC_GrPixelConfig:
393 case kASTC_12x12_GrPixelConfig: 380 case kASTC_12x12_GrPixelConfig:
394 case kAlpha_8_GrPixelConfig: 381 case kAlpha_8_GrPixelConfig:
395 case kAlpha_half_GrPixelConfig: 382 case kAlpha_half_GrPixelConfig:
396 return true; 383 return true;
397 default: 384 default:
398 return false; 385 return false;
399 } 386 }
400 } 387 }
401 388
402 static inline bool GrAllowSRGBForDestinationPixelConfig(GrPixelConfig config) {
403 switch (config) {
404 case kRGBA_8888_GrPixelConfig:
405 case kBGRA_8888_GrPixelConfig:
406 return false;
407 default:
408 return true;
409 }
410 }
411
412 /** 389 /**
413 * Optional bitfield flags that can be set on GrSurfaceDesc (below). 390 * Optional bitfield flags that can be set on GrSurfaceDesc (below).
414 */ 391 */
415 enum GrSurfaceFlags { 392 enum GrSurfaceFlags {
416 kNone_GrSurfaceFlags = 0x0, 393 kNone_GrSurfaceFlags = 0x0,
417 /** 394 /**
418 * Creates a texture that can be rendered to as a GrRenderTarget. Use 395 * Creates a texture that can be rendered to as a GrRenderTarget. Use
419 * GrTexture::asRenderTarget() to access. 396 * GrTexture::asRenderTarget() to access.
420 */ 397 */
421 kRenderTarget_GrSurfaceFlag = 0x1, 398 kRenderTarget_GrSurfaceFlag = 0x1,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 return 4 * width * height; 684 return 4 * width * height;
708 } 685 }
709 } 686 }
710 687
711 /** 688 /**
712 * This value translates to reseting all the context state for any backend. 689 * This value translates to reseting all the context state for any backend.
713 */ 690 */
714 static const uint32_t kAll_GrBackendState = 0xffffffff; 691 static const uint32_t kAll_GrBackendState = 0xffffffff;
715 692
716 #endif 693 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTextureParams.h ('k') | include/gpu/SkGr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698