Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: content/renderer/compositor_bindings/web_blend_mode.h

Issue 470983004: Move blink<->cc bindings to cc/blink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_
6 #define CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_
7
8 #include "third_party/WebKit/public/platform/WebBlendMode.h"
9
10 namespace content {
11
12 inline SkXfermode::Mode BlendModeToSkia(blink::WebBlendMode blend_mode) {
13 switch (blend_mode) {
14 case blink::WebBlendModeNormal:
15 return SkXfermode::kSrcOver_Mode;
16 case blink::WebBlendModeMultiply:
17 return SkXfermode::kMultiply_Mode;
18 case blink::WebBlendModeScreen:
19 return SkXfermode::kScreen_Mode;
20 case blink::WebBlendModeOverlay:
21 return SkXfermode::kOverlay_Mode;
22 case blink::WebBlendModeDarken:
23 return SkXfermode::kDarken_Mode;
24 case blink::WebBlendModeLighten:
25 return SkXfermode::kLighten_Mode;
26 case blink::WebBlendModeColorDodge:
27 return SkXfermode::kColorDodge_Mode;
28 case blink::WebBlendModeColorBurn:
29 return SkXfermode::kColorBurn_Mode;
30 case blink::WebBlendModeHardLight:
31 return SkXfermode::kHardLight_Mode;
32 case blink::WebBlendModeSoftLight:
33 return SkXfermode::kSoftLight_Mode;
34 case blink::WebBlendModeDifference:
35 return SkXfermode::kDifference_Mode;
36 case blink::WebBlendModeExclusion:
37 return SkXfermode::kExclusion_Mode;
38 case blink::WebBlendModeHue:
39 return SkXfermode::kHue_Mode;
40 case blink::WebBlendModeSaturation:
41 return SkXfermode::kSaturation_Mode;
42 case blink::WebBlendModeColor:
43 return SkXfermode::kColor_Mode;
44 case blink::WebBlendModeLuminosity:
45 return SkXfermode::kLuminosity_Mode;
46 }
47 return SkXfermode::kSrcOver_Mode;
48 }
49
50 inline blink::WebBlendMode BlendModeFromSkia(SkXfermode::Mode blend_mode) {
51 switch (blend_mode) {
52 case SkXfermode::kSrcOver_Mode:
53 return blink::WebBlendModeNormal;
54 case SkXfermode::kMultiply_Mode:
55 return blink::WebBlendModeMultiply;
56 case SkXfermode::kScreen_Mode:
57 return blink::WebBlendModeScreen;
58 case SkXfermode::kOverlay_Mode:
59 return blink::WebBlendModeOverlay;
60 case SkXfermode::kDarken_Mode:
61 return blink::WebBlendModeDarken;
62 case SkXfermode::kLighten_Mode:
63 return blink::WebBlendModeLighten;
64 case SkXfermode::kColorDodge_Mode:
65 return blink::WebBlendModeColorDodge;
66 case SkXfermode::kColorBurn_Mode:
67 return blink::WebBlendModeColorBurn;
68 case SkXfermode::kHardLight_Mode:
69 return blink::WebBlendModeHardLight;
70 case SkXfermode::kSoftLight_Mode:
71 return blink::WebBlendModeSoftLight;
72 case SkXfermode::kDifference_Mode:
73 return blink::WebBlendModeDifference;
74 case SkXfermode::kExclusion_Mode:
75 return blink::WebBlendModeExclusion;
76 case SkXfermode::kHue_Mode:
77 return blink::WebBlendModeHue;
78 case SkXfermode::kSaturation_Mode:
79 return blink::WebBlendModeSaturation;
80 case SkXfermode::kColor_Mode:
81 return blink::WebBlendModeColor;
82 case SkXfermode::kLuminosity_Mode:
83 return blink::WebBlendModeLuminosity;
84
85 // these value are SkXfermodes, but no blend modes.
86 case SkXfermode::kClear_Mode:
87 case SkXfermode::kSrc_Mode:
88 case SkXfermode::kDst_Mode:
89 case SkXfermode::kDstOver_Mode:
90 case SkXfermode::kSrcIn_Mode:
91 case SkXfermode::kDstIn_Mode:
92 case SkXfermode::kSrcOut_Mode:
93 case SkXfermode::kDstOut_Mode:
94 case SkXfermode::kSrcATop_Mode:
95 case SkXfermode::kDstATop_Mode:
96 case SkXfermode::kXor_Mode:
97 case SkXfermode::kPlus_Mode:
98 case SkXfermode::kModulate_Mode:
99 NOTREACHED();
100 }
101 return blink::WebBlendModeNormal;
102 }
103
104 } // namespace content
105
106 #endif // CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_
107
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698