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, | |
44 kASTC_12x12_GrPixelConfig // kASTC_12x12_Format, | 43 kASTC_12x12_GrPixelConfig // kASTC_12x12_Format, |
45 }; | 44 }; |
46 GR_STATIC_ASSERT(0 == SkTextureCompressor::kLATC_Format); | 45 GR_STATIC_ASSERT(0 == SkTextureCompressor::kLATC_Format); |
47 GR_STATIC_ASSERT(1 == SkTextureCompressor::kR11_EAC_Format); | 46 GR_STATIC_ASSERT(1 == SkTextureCompressor::kR11_EAC_Format); |
48 GR_STATIC_ASSERT(2 == SkTextureCompressor::kETC1_Format); | 47 GR_STATIC_ASSERT(2 == SkTextureCompressor::kASTC_12x12_Format); |
49 GR_STATIC_ASSERT(3 == SkTextureCompressor::kASTC_12x12_Format); | |
50 GR_STATIC_ASSERT(SK_ARRAY_COUNT(configMap) == SkTextureCompressor::kFormatCn
t); | 48 GR_STATIC_ASSERT(SK_ARRAY_COUNT(configMap) == SkTextureCompressor::kFormatCn
t); |
51 | 49 |
52 return configMap[fmt]; | 50 return configMap[fmt]; |
53 } | 51 } |
54 | 52 |
55 #if GR_COMPRESS_ALPHA_MASK | 53 #if GR_COMPRESS_ALPHA_MASK |
56 static bool choose_compressed_fmt(const GrDrawTargetCaps* caps, | 54 static bool choose_compressed_fmt(const GrDrawTargetCaps* caps, |
57 SkTextureCompressor::Format *fmt) { | 55 SkTextureCompressor::Format *fmt) { |
58 if (NULL == fmt) { | 56 if (NULL == fmt) { |
59 return false; | 57 return false; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 maskMatrix.preConcat(drawState->getViewMatrix()); | 315 maskMatrix.preConcat(drawState->getViewMatrix()); |
318 | 316 |
319 drawState->addCoverageEffect( | 317 drawState->addCoverageEffect( |
320 GrSimpleTextureEffect::Create(texture, | 318 GrSimpleTextureEffect::Create(texture, |
321 maskMatrix, | 319 maskMatrix, |
322 GrTextureParams::kNone_Fi
lterMode, | 320 GrTextureParams::kNone_Fi
lterMode, |
323 kPosition_GrCoordSet))->u
nref(); | 321 kPosition_GrCoordSet))->u
nref(); |
324 | 322 |
325 target->drawSimpleRect(dstRect); | 323 target->drawSimpleRect(dstRect); |
326 } | 324 } |
OLD | NEW |