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

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

Issue 2165703003: Adding an SkColorSpace to SkImage_Gpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: s/NULL/nullptr/ Created 4 years, 5 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 | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/image/SkImage.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 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 shaderFP = GrFragmentProcessor::MulOutputByInputAlpha(fp); 735 shaderFP = GrFragmentProcessor::MulOutputByInputAlpha(fp);
736 } 736 }
737 737
738 return SkPaintToGrPaintReplaceShader(context, paint, std::move(shaderFP), al lowSRGBInputs, 738 return SkPaintToGrPaintReplaceShader(context, paint, std::move(shaderFP), al lowSRGBInputs,
739 grPaint); 739 grPaint);
740 } 740 }
741 741
742 742
743 //////////////////////////////////////////////////////////////////////////////// //////////////// 743 //////////////////////////////////////////////////////////////////////////////// ////////////////
744 744
745 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) { 745 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque,
746 sk_sp<SkColorSpace> colorSpace) {
746 #ifdef SK_DEBUG 747 #ifdef SK_DEBUG
747 const GrSurfaceDesc& desc = tex->desc(); 748 const GrSurfaceDesc& desc = tex->desc();
748 SkASSERT(w <= desc.fWidth); 749 SkASSERT(w <= desc.fWidth);
749 SkASSERT(h <= desc.fHeight); 750 SkASSERT(h <= desc.fHeight);
750 #endif 751 #endif
751 const GrPixelConfig config = tex->config(); 752 const GrPixelConfig config = tex->config();
752 SkColorType ct = kUnknown_SkColorType; 753 SkColorType ct = kUnknown_SkColorType;
753 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; 754 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
754 if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) { 755 if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) {
755 ct = kUnknown_SkColorType; 756 ct = kUnknown_SkColorType;
756 } 757 }
757 return SkImageInfo::Make(w, h, ct, at); 758 return SkImageInfo::Make(w, h, ct, at, std::move(colorSpace));
758 } 759 }
759 760
760 761
761 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap * dst) { 762 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap * dst) {
762 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); 763 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque);
763 dst->setInfo(info); 764 dst->setInfo(info);
764 dst->setPixelRef(new SkGrPixelRef(info, src))->unref(); 765 dst->setPixelRef(new SkGrPixelRef(info, src))->unref();
765 } 766 }
766 767
767 GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain tFilterQuality, 768 GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain tFilterQuality,
(...skipping 30 matching lines...) Expand all
798 SkErrorInternals::SetError( kInvalidPaint_SkError, 799 SkErrorInternals::SetError( kInvalidPaint_SkError,
799 "Sorry, I don't understand the filtering " 800 "Sorry, I don't understand the filtering "
800 "mode you asked for. Falling back to " 801 "mode you asked for. Falling back to "
801 "MIPMaps."); 802 "MIPMaps.");
802 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 803 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
803 break; 804 break;
804 805
805 } 806 }
806 return textureFilterMode; 807 return textureFilterMode;
807 } 808 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698