| OLD | NEW |
| 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" |
| 11 | 11 |
| 12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrGpuResourcePriv.h" | 14 #include "GrGpuResourcePriv.h" |
| 15 #include "GrImageIDTextureAdjuster.h" | 15 #include "GrImageIDTextureAdjuster.h" |
| 16 #include "GrTextureParamsAdjuster.h" | 16 #include "GrTextureParamsAdjuster.h" |
| 17 #include "GrTexturePriv.h" | 17 #include "GrTexturePriv.h" |
| 18 #include "GrTypes.h" | 18 #include "GrTypes.h" |
| 19 #include "GrXferProcessor.h" | 19 #include "GrXferProcessor.h" |
| 20 #include "GrYUVProvider.h" | 20 #include "GrYUVProvider.h" |
| 21 | 21 |
| 22 #include "SkColorFilter.h" | 22 #include "SkColorFilter.h" |
| 23 #include "SkConfig8888.h" | 23 #include "SkConfig8888.h" |
| 24 #include "SkCanvas.h" | 24 #include "SkCanvas.h" |
| 25 #include "SkData.h" | 25 #include "SkData.h" |
| 26 #include "SkErrorInternals.h" | 26 #include "SkErrorInternals.h" |
| 27 #include "SkGrPixelRef.h" | |
| 28 #include "SkMessageBus.h" | 27 #include "SkMessageBus.h" |
| 29 #include "SkMipMap.h" | 28 #include "SkMipMap.h" |
| 30 #include "SkPixelRef.h" | 29 #include "SkPixelRef.h" |
| 31 #include "SkPM4fPriv.h" | 30 #include "SkPM4fPriv.h" |
| 32 #include "SkResourceCache.h" | 31 #include "SkResourceCache.h" |
| 33 #include "SkTemplates.h" | 32 #include "SkTemplates.h" |
| 34 #include "SkYUVPlanesCache.h" | 33 #include "SkYUVPlanesCache.h" |
| 35 #include "effects/GrBicubicEffect.h" | 34 #include "effects/GrBicubicEffect.h" |
| 36 #include "effects/GrConstColorProcessor.h" | 35 #include "effects/GrConstColorProcessor.h" |
| 37 #include "effects/GrDitherEffect.h" | 36 #include "effects/GrDitherEffect.h" |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 #endif | 750 #endif |
| 752 const GrPixelConfig config = tex->config(); | 751 const GrPixelConfig config = tex->config(); |
| 753 SkColorType ct = kUnknown_SkColorType; | 752 SkColorType ct = kUnknown_SkColorType; |
| 754 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 753 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
| 755 if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) { | 754 if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) { |
| 756 ct = kUnknown_SkColorType; | 755 ct = kUnknown_SkColorType; |
| 757 } | 756 } |
| 758 return SkImageInfo::Make(w, h, ct, at, std::move(colorSpace)); | 757 return SkImageInfo::Make(w, h, ct, at, std::move(colorSpace)); |
| 759 } | 758 } |
| 760 | 759 |
| 761 | |
| 762 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | |
| 763 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | |
| 764 dst->setInfo(info); | |
| 765 dst->setPixelRef(new SkGrPixelRef(info, src))->unref(); | |
| 766 } | |
| 767 | |
| 768 GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain
tFilterQuality, | 760 GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain
tFilterQuality, |
| 769 const SkMatrix& view
M, | 761 const SkMatrix& view
M, |
| 770 const SkMatrix& loca
lM, | 762 const SkMatrix& loca
lM, |
| 771 bool* doBicubic) { | 763 bool* doBicubic) { |
| 772 *doBicubic = false; | 764 *doBicubic = false; |
| 773 GrTextureParams::FilterMode textureFilterMode; | 765 GrTextureParams::FilterMode textureFilterMode; |
| 774 switch (paintFilterQuality) { | 766 switch (paintFilterQuality) { |
| 775 case kNone_SkFilterQuality: | 767 case kNone_SkFilterQuality: |
| 776 textureFilterMode = GrTextureParams::kNone_FilterMode; | 768 textureFilterMode = GrTextureParams::kNone_FilterMode; |
| 777 break; | 769 break; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 799 SkErrorInternals::SetError( kInvalidPaint_SkError, | 791 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 800 "Sorry, I don't understand the filtering
" | 792 "Sorry, I don't understand the filtering
" |
| 801 "mode you asked for. Falling back to " | 793 "mode you asked for. Falling back to " |
| 802 "MIPMaps."); | 794 "MIPMaps."); |
| 803 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 795 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 804 break; | 796 break; |
| 805 | 797 |
| 806 } | 798 } |
| 807 return textureFilterMode; | 799 return textureFilterMode; |
| 808 } | 800 } |
| OLD | NEW |