OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 { CompositeSourceAtop, SkXfermode::kSrcATop_Mode }, | 51 { CompositeSourceAtop, SkXfermode::kSrcATop_Mode }, |
52 { CompositeDestinationOver, SkXfermode::kDstOver_Mode }, | 52 { CompositeDestinationOver, SkXfermode::kDstOver_Mode }, |
53 { CompositeDestinationIn, SkXfermode::kDstIn_Mode }, | 53 { CompositeDestinationIn, SkXfermode::kDstIn_Mode }, |
54 { CompositeDestinationOut, SkXfermode::kDstOut_Mode }, | 54 { CompositeDestinationOut, SkXfermode::kDstOut_Mode }, |
55 { CompositeDestinationAtop, SkXfermode::kDstATop_Mode }, | 55 { CompositeDestinationAtop, SkXfermode::kDstATop_Mode }, |
56 { CompositeXOR, SkXfermode::kXor_Mode }, | 56 { CompositeXOR, SkXfermode::kXor_Mode }, |
57 { CompositePlusDarker, SkXfermode::kDarken_Mode }, | 57 { CompositePlusDarker, SkXfermode::kDarken_Mode }, |
58 { CompositePlusLighter, SkXfermode::kPlus_Mode } | 58 { CompositePlusLighter, SkXfermode::kPlus_Mode } |
59 }; | 59 }; |
60 | 60 |
61 // keep this array in sync with blink::WebBlendMode enum in public/platform/WebB
lendMode.h | 61 // keep this array in sync with WebBlendMode enum in public/platform/WebBlendMod
e.h |
62 static const uint8_t gMapBlendOpsToXfermodeModes[] = { | 62 static const uint8_t gMapBlendOpsToXfermodeModes[] = { |
63 SkXfermode::kClear_Mode, // blink::WebBlendModeNormal | 63 SkXfermode::kClear_Mode, // WebBlendModeNormal |
64 SkXfermode::kMultiply_Mode, // blink::WebBlendModeMultiply | 64 SkXfermode::kMultiply_Mode, // WebBlendModeMultiply |
65 SkXfermode::kScreen_Mode, // blink::WebBlendModeScreen | 65 SkXfermode::kScreen_Mode, // WebBlendModeScreen |
66 SkXfermode::kOverlay_Mode, // blink::WebBlendModeOverlay | 66 SkXfermode::kOverlay_Mode, // WebBlendModeOverlay |
67 SkXfermode::kDarken_Mode, // blink::WebBlendModeDarken | 67 SkXfermode::kDarken_Mode, // WebBlendModeDarken |
68 SkXfermode::kLighten_Mode, // blink::WebBlendModeLighten | 68 SkXfermode::kLighten_Mode, // WebBlendModeLighten |
69 SkXfermode::kColorDodge_Mode, // blink::WebBlendModeColorDodge | 69 SkXfermode::kColorDodge_Mode, // WebBlendModeColorDodge |
70 SkXfermode::kColorBurn_Mode, // blink::WebBlendModeColorBurn | 70 SkXfermode::kColorBurn_Mode, // WebBlendModeColorBurn |
71 SkXfermode::kHardLight_Mode, // blink::WebBlendModeHardLight | 71 SkXfermode::kHardLight_Mode, // WebBlendModeHardLight |
72 SkXfermode::kSoftLight_Mode, // blink::WebBlendModeSoftLight | 72 SkXfermode::kSoftLight_Mode, // WebBlendModeSoftLight |
73 SkXfermode::kDifference_Mode, // blink::WebBlendModeDifference | 73 SkXfermode::kDifference_Mode, // WebBlendModeDifference |
74 SkXfermode::kExclusion_Mode, // blink::WebBlendModeExclusion | 74 SkXfermode::kExclusion_Mode, // WebBlendModeExclusion |
75 SkXfermode::kHue_Mode, // blink::WebBlendModeHue | 75 SkXfermode::kHue_Mode, // WebBlendModeHue |
76 SkXfermode::kSaturation_Mode, // blink::WebBlendModeSaturation | 76 SkXfermode::kSaturation_Mode, // WebBlendModeSaturation |
77 SkXfermode::kColor_Mode, // blink::WebBlendModeColor | 77 SkXfermode::kColor_Mode, // WebBlendModeColor |
78 SkXfermode::kLuminosity_Mode // blink::WebBlendModeLuminosity | 78 SkXfermode::kLuminosity_Mode // WebBlendModeLuminosity |
79 }; | 79 }; |
80 | 80 |
81 PassRefPtr<SkXfermode> WebCoreCompositeToSkiaComposite(CompositeOperator op, bli
nk::WebBlendMode blendMode) | 81 PassRefPtr<SkXfermode> WebCoreCompositeToSkiaComposite(CompositeOperator op, Web
BlendMode blendMode) |
82 { | 82 { |
83 if (blendMode != blink::WebBlendModeNormal) { | 83 if (blendMode != WebBlendModeNormal) { |
84 if ((uint8_t)blendMode >= SK_ARRAY_COUNT(gMapBlendOpsToXfermodeModes)) { | 84 if ((uint8_t)blendMode >= SK_ARRAY_COUNT(gMapBlendOpsToXfermodeModes)) { |
85 SkDEBUGF(("GraphicsContext::setPlatformCompositeOperation unknown bl
ink::WebBlendMode %d\n", blendMode)); | 85 SkDEBUGF(("GraphicsContext::setPlatformCompositeOperation unknown We
bBlendMode %d\n", blendMode)); |
86 return adoptRef(SkXfermode::Create(SkXfermode::kSrcOver_Mode)); | 86 return adoptRef(SkXfermode::Create(SkXfermode::kSrcOver_Mode)); |
87 } | 87 } |
88 SkXfermode::Mode mode = (SkXfermode::Mode)gMapBlendOpsToXfermodeModes[(u
int8_t)blendMode]; | 88 SkXfermode::Mode mode = (SkXfermode::Mode)gMapBlendOpsToXfermodeModes[(u
int8_t)blendMode]; |
89 return adoptRef(SkXfermode::Create(mode)); | 89 return adoptRef(SkXfermode::Create(mode)); |
90 } | 90 } |
91 | 91 |
92 const CompositOpToXfermodeMode* table = gMapCompositOpsToXfermodeModes; | 92 const CompositOpToXfermodeMode* table = gMapCompositOpsToXfermodeModes; |
93 | 93 |
94 for (unsigned i = 0; i < SK_ARRAY_COUNT(gMapCompositOpsToXfermodeModes); i++
) { | 94 for (unsigned i = 0; i < SK_ARRAY_COUNT(gMapCompositOpsToXfermodeModes); i++
) { |
95 if (table[i].mCompositOp == op) | 95 if (table[i].mCompositOp == op) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // though - that's why it's not always on. | 311 // though - that's why it's not always on. |
312 SkScalar widthExpansion, heightExpansion; | 312 SkScalar widthExpansion, heightExpansion; |
313 if (totalMatrix.getType() & SkMatrix::kAffine_Mask) | 313 if (totalMatrix.getType() & SkMatrix::kAffine_Mask) |
314 widthExpansion = totalMatrix[SkMatrix::kMSkewY], heightExpansion = total
Matrix[SkMatrix::kMSkewX]; | 314 widthExpansion = totalMatrix[SkMatrix::kMSkewY], heightExpansion = total
Matrix[SkMatrix::kMSkewX]; |
315 else | 315 else |
316 widthExpansion = totalMatrix[SkMatrix::kMScaleX], heightExpansion = tota
lMatrix[SkMatrix::kMScaleY]; | 316 widthExpansion = totalMatrix[SkMatrix::kMScaleX], heightExpansion = tota
lMatrix[SkMatrix::kMScaleY]; |
317 return destRect.width() * fabs(widthExpansion) < 1 || destRect.height() * fa
bs(heightExpansion) < 1; | 317 return destRect.width() * fabs(widthExpansion) < 1 || destRect.height() * fa
bs(heightExpansion) < 1; |
318 } | 318 } |
319 | 319 |
320 } // namespace blink | 320 } // namespace blink |
OLD | NEW |