jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 1 | // Copyright 2017 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 UI_GL_DC_RENDERER_LAYER_PARAMS_H_ |
| 6 | #define UI_GL_DC_RENDERER_LAYER_PARAMS_H_ |
| 7 | |
| 8 | #include <vector> |
| 9 | |
jbauman | 78f5d7d | 2017-03-29 21:47:36 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 11 | #include "third_party/skia/include/core/SkColor.h" |
| 12 | #include "ui/gfx/geometry/point.h" |
| 13 | #include "ui/gfx/geometry/rect.h" |
| 14 | #include "ui/gfx/geometry/rect_f.h" |
| 15 | #include "ui/gfx/transform.h" |
| 16 | #include "ui/gl/gl_export.h" |
| 17 | |
| 18 | namespace gl { |
| 19 | class GLImage; |
| 20 | } |
| 21 | |
| 22 | namespace ui { |
| 23 | |
| 24 | struct GL_EXPORT DCRendererLayerParams { |
| 25 | DCRendererLayerParams(bool is_clipped, |
| 26 | const gfx::Rect clip_rect, |
jbauman | 78f5d7d | 2017-03-29 21:47:36 | [diff] [blame] | 27 | int z_order, |
jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 28 | const gfx::Transform& transform, |
jbauman | d817ddec | 2017-05-04 21:05:05 | [diff] [blame] | 29 | std::vector<scoped_refptr<gl::GLImage>> image, |
jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 30 | const gfx::RectF& contents_rect, |
| 31 | const gfx::Rect& rect, |
| 32 | unsigned background_color, |
| 33 | unsigned edge_aa_mask, |
| 34 | float opacity, |
| 35 | unsigned filter); |
| 36 | DCRendererLayerParams(const DCRendererLayerParams& other); |
| 37 | ~DCRendererLayerParams(); |
| 38 | |
| 39 | bool is_clipped; |
| 40 | const gfx::Rect clip_rect; |
jbauman | 78f5d7d | 2017-03-29 21:47:36 | [diff] [blame] | 41 | int z_order; |
jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 42 | const gfx::Transform transform; |
jbauman | d817ddec | 2017-05-04 21:05:05 | [diff] [blame] | 43 | std::vector<scoped_refptr<gl::GLImage>> image; |
jbauman | 80ceeee | 2017-03-13 22:43:57 | [diff] [blame] | 44 | const gfx::RectF contents_rect; |
| 45 | const gfx::Rect rect; |
| 46 | unsigned background_color; |
| 47 | unsigned edge_aa_mask; |
| 48 | float opacity; |
| 49 | unsigned filter; |
| 50 | |
| 51 | // This is a subset of cc::FilterOperation::FilterType. |
| 52 | enum class FilterEffectType : uint32_t { |
| 53 | GRAYSDCLE, |
| 54 | SEPIA, |
| 55 | SATURATE, |
| 56 | HUE_ROTATE, |
| 57 | INVERT, |
| 58 | BRIGHTNESS, |
| 59 | CONTRAST, |
| 60 | OPACITY, |
| 61 | BLUR, |
| 62 | DROP_SHADOW, |
| 63 | }; |
| 64 | struct GL_EXPORT FilterEffect { |
| 65 | FilterEffectType type = FilterEffectType::GRAYSDCLE; |
| 66 | |
| 67 | // For every filter other than DROP_SHADOW, only |amount| is populated. |
| 68 | float amount = 0; |
| 69 | gfx::Point drop_shadow_offset; |
| 70 | SkColor drop_shadow_color = 0; |
| 71 | }; |
| 72 | using FilterEffects = std::vector<FilterEffect>; |
| 73 | |
| 74 | FilterEffects filter_effects; |
| 75 | }; |
| 76 | |
| 77 | } // namespace ui |
| 78 | |
| 79 | #endif // UI_GL_DC_RENDERER_LAYER_PARAMS_H_ |