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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 2359443003: Fix some GPU image filter code to preserve precision and color space (Closed)
Patch Set: Created 4 years, 3 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
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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 #include "SkGrPriv.h" 10 #include "SkGrPriv.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 break; 501 break;
502 default: 502 default:
503 return false; 503 return false;
504 } 504 }
505 if (ctOut) { 505 if (ctOut) {
506 *ctOut = ct; 506 *ctOut = ct;
507 } 507 }
508 return true; 508 return true;
509 } 509 }
510 510
511 GrPixelConfig GrRenderableConfigForColorSpace(SkColorSpace* colorSpace) {
512 if (!colorSpace) {
513 return kRGBA_8888_GrPixelConfig;
514 } else if (colorSpace->gammaIsLinear()) {
515 return kRGBA_half_GrPixelConfig;
516 } else if (colorSpace->gammaCloseToSRGB()) {
517 return kSRGBA_8888_GrPixelConfig;
518 } else {
519 SkDEBUGFAIL("No renderable config exists for color space with strange ga mma");
520 return kUnknown_GrPixelConfig;
521 }
522 }
523
511 //////////////////////////////////////////////////////////////////////////////// //////////////// 524 //////////////////////////////////////////////////////////////////////////////// ////////////////
512 525
513 static inline bool blend_requires_shader(const SkXfermode::Mode mode, bool primi tiveIsSrc) { 526 static inline bool blend_requires_shader(const SkXfermode::Mode mode, bool primi tiveIsSrc) {
514 if (primitiveIsSrc) { 527 if (primitiveIsSrc) {
515 return SkXfermode::kSrc_Mode != mode; 528 return SkXfermode::kSrc_Mode != mode;
516 } else { 529 } else {
517 return SkXfermode::kDst_Mode != mode; 530 return SkXfermode::kDst_Mode != mode;
518 } 531 }
519 } 532 }
520 533
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 SkErrorInternals::SetError( kInvalidPaint_SkError, 787 SkErrorInternals::SetError( kInvalidPaint_SkError,
775 "Sorry, I don't understand the filtering " 788 "Sorry, I don't understand the filtering "
776 "mode you asked for. Falling back to " 789 "mode you asked for. Falling back to "
777 "MIPMaps."); 790 "MIPMaps.");
778 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 791 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
779 break; 792 break;
780 793
781 } 794 }
782 return textureFilterMode; 795 return textureFilterMode;
783 } 796 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | src/gpu/SkGrPriv.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698