| 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 "GrTypes.h" | 17 #include "GrTypes.h" |
| 18 #include "GrXferProcessor.h" | 18 #include "GrXferProcessor.h" |
| 19 #include "GrYUVProvider.h" | 19 #include "GrYUVProvider.h" |
| 20 | 20 |
| 21 #include "SkColorFilter.h" | 21 #include "SkColorFilter.h" |
| 22 #include "SkConfig8888.h" | 22 #include "SkConfig8888.h" |
| 23 #include "SkCanvas.h" | 23 #include "SkCanvas.h" |
| 24 #include "SkData.h" | 24 #include "SkData.h" |
| 25 #include "SkEncodedFormat.h" |
| 25 #include "SkErrorInternals.h" | 26 #include "SkErrorInternals.h" |
| 26 #include "SkGrPixelRef.h" | 27 #include "SkGrPixelRef.h" |
| 27 #include "SkMessageBus.h" | 28 #include "SkMessageBus.h" |
| 28 #include "SkMipMap.h" | 29 #include "SkMipMap.h" |
| 29 #include "SkPixelRef.h" | 30 #include "SkPixelRef.h" |
| 30 #include "SkResourceCache.h" | 31 #include "SkResourceCache.h" |
| 31 #include "SkTemplates.h" | 32 #include "SkTemplates.h" |
| 32 #include "SkTextureCompressor.h" | 33 #include "SkTextureCompressor.h" |
| 33 #include "SkYUVPlanesCache.h" | 34 #include "SkYUVPlanesCache.h" |
| 34 #include "effects/GrBicubicEffect.h" | 35 #include "effects/GrBicubicEffect.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 SkASSERT(!imageBounds.isEmpty()); | 60 SkASSERT(!imageBounds.isEmpty()); |
| 60 static const GrUniqueKey::Domain kImageIDDomain = GrUniqueKey::GenerateDomai
n(); | 61 static const GrUniqueKey::Domain kImageIDDomain = GrUniqueKey::GenerateDomai
n(); |
| 61 GrUniqueKey::Builder builder(key, kImageIDDomain, 5); | 62 GrUniqueKey::Builder builder(key, kImageIDDomain, 5); |
| 62 builder[0] = imageID; | 63 builder[0] = imageID; |
| 63 builder[1] = imageBounds.fLeft; | 64 builder[1] = imageBounds.fLeft; |
| 64 builder[2] = imageBounds.fTop; | 65 builder[2] = imageBounds.fTop; |
| 65 builder[3] = imageBounds.fRight; | 66 builder[3] = imageBounds.fRight; |
| 66 builder[4] = imageBounds.fBottom; | 67 builder[4] = imageBounds.fBottom; |
| 67 } | 68 } |
| 68 | 69 |
| 70 bool GrIsCompressedFormatPossiblySupported(GrContext* ctx, SkEncodedFormat forma
t) { |
| 71 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 72 if (!ctx->caps()->isConfigTexturable(kETC1_GrPixelConfig)) { |
| 73 return false; |
| 74 } |
| 75 switch (format) { |
| 76 case kPKM_SkEncodedFormat: // file format for ETC1 |
| 77 return true; |
| 78 default: |
| 79 return false; |
| 80 } |
| 81 #endif |
| 82 return false; |
| 83 } |
| 84 |
| 69 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, | 85 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, |
| 70 int expectedW, int expectedH, | 86 int expectedW, int expectedH, |
| 71 const void** outStartOfDataToUp
load) { | 87 const void** outStartOfDataToUp
load) { |
| 72 *outStartOfDataToUpload = nullptr; | 88 *outStartOfDataToUpload = nullptr; |
| 73 #ifndef SK_IGNORE_ETC1_SUPPORT | 89 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 74 if (!ctx->caps()->isConfigTexturable(kETC1_GrPixelConfig)) { | 90 if (!ctx->caps()->isConfigTexturable(kETC1_GrPixelConfig)) { |
| 75 return kUnknown_GrPixelConfig; | 91 return kUnknown_GrPixelConfig; |
| 76 } | 92 } |
| 77 | 93 |
| 78 const uint8_t* bytes = data->bytes(); | 94 const uint8_t* bytes = data->bytes(); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 SkErrorInternals::SetError( kInvalidPaint_SkError, | 772 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 757 "Sorry, I don't understand the filtering
" | 773 "Sorry, I don't understand the filtering
" |
| 758 "mode you asked for. Falling back to " | 774 "mode you asked for. Falling back to " |
| 759 "MIPMaps."); | 775 "MIPMaps."); |
| 760 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 776 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 761 break; | 777 break; |
| 762 | 778 |
| 763 } | 779 } |
| 764 return textureFilterMode; | 780 return textureFilterMode; |
| 765 } | 781 } |
| OLD | NEW |