| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
| 9 | 9 |
| 10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 SkXfermode::kSrc_Mode, // kReplace_Op | 33 SkXfermode::kSrc_Mode, // kReplace_Op |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 return modeMap[op]; | 36 return modeMap[op]; |
| 37 } | 37 } |
| 38 | 38 |
| 39 static inline GrPixelConfig fmt_to_config(SkTextureCompressor::Format fmt) { | 39 static inline GrPixelConfig fmt_to_config(SkTextureCompressor::Format fmt) { |
| 40 static const GrPixelConfig configMap[] = { | 40 static const GrPixelConfig configMap[] = { |
| 41 kLATC_GrPixelConfig, // kLATC_Format, | 41 kLATC_GrPixelConfig, // kLATC_Format, |
| 42 kR11_EAC_GrPixelConfig, // kR11_EAC_Format, | 42 kR11_EAC_GrPixelConfig, // kR11_EAC_Format, |
| 43 kETC1_GrPixelConfig, // kETC1_Format, |
| 43 kASTC_12x12_GrPixelConfig // kASTC_12x12_Format, | 44 kASTC_12x12_GrPixelConfig // kASTC_12x12_Format, |
| 44 }; | 45 }; |
| 45 GR_STATIC_ASSERT(0 == SkTextureCompressor::kLATC_Format); | 46 GR_STATIC_ASSERT(0 == SkTextureCompressor::kLATC_Format); |
| 46 GR_STATIC_ASSERT(1 == SkTextureCompressor::kR11_EAC_Format); | 47 GR_STATIC_ASSERT(1 == SkTextureCompressor::kR11_EAC_Format); |
| 47 GR_STATIC_ASSERT(2 == SkTextureCompressor::kASTC_12x12_Format); | 48 GR_STATIC_ASSERT(2 == SkTextureCompressor::kETC1_Format); |
| 49 GR_STATIC_ASSERT(3 == SkTextureCompressor::kASTC_12x12_Format); |
| 48 GR_STATIC_ASSERT(SK_ARRAY_COUNT(configMap) == SkTextureCompressor::kFormatCn
t); | 50 GR_STATIC_ASSERT(SK_ARRAY_COUNT(configMap) == SkTextureCompressor::kFormatCn
t); |
| 49 | 51 |
| 50 return configMap[fmt]; | 52 return configMap[fmt]; |
| 51 } | 53 } |
| 52 | 54 |
| 53 #if GR_COMPRESS_ALPHA_MASK | 55 #if GR_COMPRESS_ALPHA_MASK |
| 54 static bool choose_compressed_fmt(const GrDrawTargetCaps* caps, | 56 static bool choose_compressed_fmt(const GrDrawTargetCaps* caps, |
| 55 SkTextureCompressor::Format *fmt) { | 57 SkTextureCompressor::Format *fmt) { |
| 56 if (NULL == fmt) { | 58 if (NULL == fmt) { |
| 57 return false; | 59 return false; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 maskMatrix.preConcat(drawState->getViewMatrix()); | 317 maskMatrix.preConcat(drawState->getViewMatrix()); |
| 316 | 318 |
| 317 drawState->addCoverageEffect( | 319 drawState->addCoverageEffect( |
| 318 GrSimpleTextureEffect::Create(texture, | 320 GrSimpleTextureEffect::Create(texture, |
| 319 maskMatrix, | 321 maskMatrix, |
| 320 GrTextureParams::kNone_Fi
lterMode, | 322 GrTextureParams::kNone_Fi
lterMode, |
| 321 kPosition_GrCoordSet))->u
nref(); | 323 kPosition_GrCoordSet))->u
nref(); |
| 322 | 324 |
| 323 target->drawSimpleRect(dstRect); | 325 target->drawSimpleRect(dstRect); |
| 324 } | 326 } |
| OLD | NEW |