OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 //! kRectangleImage_SrcType drawn directly instead in an image. | 54 //! kRectangleImage_SrcType drawn directly instead in an image. |
55 kRectangle_SrcType = 0x08, | 55 kRectangle_SrcType = 0x08, |
56 //! Two rectangles, first on the right half, second on the bottom half. | 56 //! Two rectangles, first on the right half, second on the bottom half. |
57 kQuarterClear_SrcType = 0x10, | 57 kQuarterClear_SrcType = 0x10, |
58 //! kQuarterClear_SrcType in a layer. | 58 //! kQuarterClear_SrcType in a layer. |
59 kQuarterClearInLayer_SrcType = 0x20, | 59 kQuarterClearInLayer_SrcType = 0x20, |
60 //! A W/2xH/2 transparent image. | 60 //! A W/2xH/2 transparent image. |
61 kSmallTransparentImage_SrcType = 0x40, | 61 kSmallTransparentImage_SrcType = 0x40, |
62 //! kRectangleImage_SrcType drawn directly with a mask. | 62 //! kRectangleImage_SrcType drawn directly with a mask. |
63 kRectangleWithMask_SrcType = 0x80, | 63 kRectangleWithMask_SrcType = 0x80, |
64 | 64 |
65 kAll_SrcType = 0xFF, //!< All the source types. | 65 kAll_SrcType = 0xFF, //!< All the source types. |
66 kBasic_SrcType = 0x03, //!< Just basic source types. | 66 kBasic_SrcType = 0x03, //!< Just basic source types. |
67 }; | 67 }; |
68 | 68 |
69 const struct { | 69 const struct { |
70 SkXfermode::Mode fMode; | 70 SkXfermode::Mode fMode; |
71 const char* fLabel; | 71 const char* fLabel; |
72 int fSourceTypeMask; // The source types to use this | 72 int fSourceTypeMask; // The source types to use this |
73 // mode with. See draw_mode for | 73 // mode with. See draw_mode for |
74 // an explanation of each type. | 74 // an explanation of each type. |
75 // PDF has to play some tricks | 75 // PDF has to play some tricks |
76 // to support the base modes, | 76 // to support the base modes, |
77 // test those more extensively. | 77 // test those more extensively. |
78 } gModes[] = { | 78 } gModes[] = { |
79 { SkXfermode::kClear_Mode, "Clear", kAll_SrcType }, | 79 { SkXfermode::kClear_Mode, "Clear", kAll_SrcType }, |
80 { SkXfermode::kSrc_Mode, "Src", kAll_SrcType }, | 80 { SkXfermode::kSrc_Mode, "Src", kAll_SrcType }, |
81 { SkXfermode::kDst_Mode, "Dst", kAll_SrcType }, | 81 { SkXfermode::kDst_Mode, "Dst", kAll_SrcType }, |
82 { SkXfermode::kSrcOver_Mode, "SrcOver", kAll_SrcType }, | 82 { SkXfermode::kSrcOver_Mode, "SrcOver", kAll_SrcType }, |
83 { SkXfermode::kDstOver_Mode, "DstOver", kAll_SrcType }, | 83 { SkXfermode::kDstOver_Mode, "DstOver", kAll_SrcType }, |
84 { SkXfermode::kSrcIn_Mode, "SrcIn", kAll_SrcType }, | 84 { SkXfermode::kSrcIn_Mode, "SrcIn", kAll_SrcType }, |
85 { SkXfermode::kDstIn_Mode, "DstIn", kAll_SrcType }, | 85 { SkXfermode::kDstIn_Mode, "DstIn", kAll_SrcType }, |
86 { SkXfermode::kSrcOut_Mode, "SrcOut", kAll_SrcType }, | 86 { SkXfermode::kSrcOut_Mode, "SrcOut", kAll_SrcType }, |
87 { SkXfermode::kDstOut_Mode, "DstOut", kAll_SrcType }, | 87 { SkXfermode::kDstOut_Mode, "DstOut", kAll_SrcType }, |
88 { SkXfermode::kSrcATop_Mode, "SrcATop", kAll_SrcType }, | 88 { SkXfermode::kSrcATop_Mode, "SrcATop", kAll_SrcType }, |
89 { SkXfermode::kDstATop_Mode, "DstATop", kAll_SrcType }, | 89 { SkXfermode::kDstATop_Mode, "DstATop", kAll_SrcType }, |
90 | 90 |
91 { SkXfermode::kXor_Mode, "Xor", kBasic_SrcType }, | 91 { SkXfermode::kXor_Mode, "Xor", kBasic_SrcType }, |
92 { SkXfermode::kPlus_Mode, "Plus", kBasic_SrcType }, | 92 { SkXfermode::kPlus_Mode, "Plus", kBasic_SrcType }, |
93 { SkXfermode::kModulate_Mode, "Modulate", kAll_SrcType }, | 93 { SkXfermode::kModulate_Mode, "Modulate", kAll_SrcType }, |
94 { SkXfermode::kScreen_Mode, "Screen", kBasic_SrcType }, | 94 { SkXfermode::kScreen_Mode, "Screen", kBasic_SrcType }, |
95 { SkXfermode::kOverlay_Mode, "Overlay", kBasic_SrcType }, | 95 { SkXfermode::kOverlay_Mode, "Overlay", kBasic_SrcType }, |
96 { SkXfermode::kDarken_Mode, "Darken", kBasic_SrcType }, | 96 { SkXfermode::kDarken_Mode, "Darken", kBasic_SrcType }, |
97 { SkXfermode::kLighten_Mode, "Lighten", kBasic_SrcType }, | 97 { SkXfermode::kLighten_Mode, "Lighten", kBasic_SrcType }, |
98 { SkXfermode::kColorDodge_Mode, "ColorDodge", kBasic_SrcType }, | 98 { SkXfermode::kColorDodge_Mode, "ColorDodge", kBasic_SrcType }, |
99 { SkXfermode::kColorBurn_Mode, "ColorBurn", kBasic_SrcType }, | 99 { SkXfermode::kColorBurn_Mode, "ColorBurn", kBasic_SrcType }, |
100 { SkXfermode::kHardLight_Mode, "HardLight", kBasic_SrcType }, | 100 { SkXfermode::kHardLight_Mode, "HardLight", kBasic_SrcType }, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 x0 += SkIntToScalar(400); | 322 x0 += SkIntToScalar(400); |
323 y0 = 0; | 323 y0 = 0; |
324 } | 324 } |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 private: | 328 private: |
329 typedef GM INHERITED; | 329 typedef GM INHERITED; |
330 }; | 330 }; |
331 DEF_GM( return new XfermodesGM; ) | 331 DEF_GM( return new XfermodesGM; ) |
OLD | NEW |