[email protected] | 0fb2500 | 2012-10-12 07:20:02 | [diff] [blame] | 1 | // Copyright 2012 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. |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 4 | |
[email protected] | 89e8267 | 2013-03-18 07:50:56 | [diff] [blame] | 5 | #ifndef CC_QUADS_TEXTURE_DRAW_QUAD_H_ |
| 6 | #define CC_QUADS_TEXTURE_DRAW_QUAD_H_ |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 7 | |
avi | 02a4d17 | 2015-12-21 06:14:36 | [diff] [blame^] | 8 | #include <stddef.h> |
| 9 | |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 10 | #include "base/memory/scoped_ptr.h" |
[email protected] | 681ccff | 2013-03-18 06:13:52 | [diff] [blame] | 11 | #include "cc/base/cc_export.h" |
[email protected] | 89e8267 | 2013-03-18 07:50:56 | [diff] [blame] | 12 | #include "cc/quads/draw_quad.h" |
heejin.r.chung | d28506ba | 2014-10-23 16:36:20 | [diff] [blame] | 13 | #include "ui/gfx/geometry/rect_f.h" |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 14 | |
| 15 | namespace cc { |
| 16 | |
[email protected] | 52347c84 | 2012-11-02 21:06:20 | [diff] [blame] | 17 | class CC_EXPORT TextureDrawQuad : public DrawQuad { |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 18 | public: |
[email protected] | cb320358 | 2014-07-16 07:51:53 | [diff] [blame] | 19 | TextureDrawQuad(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 20 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 21 | void SetNew(const SharedQuadState* shared_quad_state, |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 22 | const gfx::Rect& rect, |
| 23 | const gfx::Rect& opaque_rect, |
[email protected] | 9bf06c7 | 2014-03-07 18:16:24 | [diff] [blame] | 24 | const gfx::Rect& visible_rect, |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 25 | unsigned resource_id, |
| 26 | bool premultiplied_alpha, |
[email protected] | 14bc5d68 | 2014-01-17 07:26:47 | [diff] [blame] | 27 | const gfx::PointF& uv_top_left, |
| 28 | const gfx::PointF& uv_bottom_right, |
[email protected] | d18b4d6 | 2013-07-12 05:33:49 | [diff] [blame] | 29 | SkColor background_color, |
[email protected] | 4c91aec | 2012-12-15 20:17:18 | [diff] [blame] | 30 | const float vertex_opacity[4], |
halliwell | aa11128 | 2015-05-13 21:58:43 | [diff] [blame] | 31 | bool y_flipped, |
jackhou | 10c9af4 | 2014-12-04 05:24:44 | [diff] [blame] | 32 | bool nearest_neighbor); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 33 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 34 | void SetAll(const SharedQuadState* shared_quad_state, |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 35 | const gfx::Rect& rect, |
| 36 | const gfx::Rect& opaque_rect, |
| 37 | const gfx::Rect& visible_rect, |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 38 | bool needs_blending, |
| 39 | unsigned resource_id, |
achaulk | f89f594 | 2015-06-10 17:01:35 | [diff] [blame] | 40 | gfx::Size resource_size_in_pixels, |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 41 | bool premultiplied_alpha, |
[email protected] | 14bc5d68 | 2014-01-17 07:26:47 | [diff] [blame] | 42 | const gfx::PointF& uv_top_left, |
| 43 | const gfx::PointF& uv_bottom_right, |
[email protected] | d18b4d6 | 2013-07-12 05:33:49 | [diff] [blame] | 44 | SkColor background_color, |
[email protected] | 4c91aec | 2012-12-15 20:17:18 | [diff] [blame] | 45 | const float vertex_opacity[4], |
halliwell | aa11128 | 2015-05-13 21:58:43 | [diff] [blame] | 46 | bool y_flipped, |
jackhou | 10c9af4 | 2014-12-04 05:24:44 | [diff] [blame] | 47 | bool nearest_neighbor); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 48 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 49 | bool premultiplied_alpha; |
[email protected] | 1fd555b | 2013-01-18 00:13:21 | [diff] [blame] | 50 | gfx::PointF uv_top_left; |
| 51 | gfx::PointF uv_bottom_right; |
[email protected] | d18b4d6 | 2013-07-12 05:33:49 | [diff] [blame] | 52 | SkColor background_color; |
[email protected] | 4c91aec | 2012-12-15 20:17:18 | [diff] [blame] | 53 | float vertex_opacity[4]; |
halliwell | aa11128 | 2015-05-13 21:58:43 | [diff] [blame] | 54 | bool y_flipped; |
jackhou | 10c9af4 | 2014-12-04 05:24:44 | [diff] [blame] | 55 | bool nearest_neighbor; |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 56 | |
achaulk | f89f594 | 2015-06-10 17:01:35 | [diff] [blame] | 57 | struct OverlayResources { |
| 58 | OverlayResources(); |
| 59 | |
| 60 | gfx::Size size_in_pixels[Resources::kMaxResourceIdCount]; |
achaulk | f89f594 | 2015-06-10 17:01:35 | [diff] [blame] | 61 | }; |
| 62 | OverlayResources overlay_resources; |
| 63 | |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 64 | ResourceId resource_id() const { return resources.ids[kResourceIdIndex]; } |
achaulk | f89f594 | 2015-06-10 17:01:35 | [diff] [blame] | 65 | const gfx::Size& resource_size_in_pixels() const { |
| 66 | return overlay_resources.size_in_pixels[kResourceIdIndex]; |
| 67 | } |
| 68 | void set_resource_size_in_pixels(const gfx::Size& size_in_pixels) { |
| 69 | overlay_resources.size_in_pixels[kResourceIdIndex] = size_in_pixels; |
| 70 | } |
[email protected] | 0546963 | 2013-01-16 03:41:00 | [diff] [blame] | 71 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 72 | static const TextureDrawQuad* MaterialCast(const DrawQuad*); |
[email protected] | cd48d68 | 2012-12-13 02:42:19 | [diff] [blame] | 73 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 74 | private: |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 75 | static const size_t kResourceIdIndex = 0; |
| 76 | |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 77 | void ExtendValue(base::trace_event::TracedValue* value) const override; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 78 | }; |
| 79 | |
[email protected] | adb0854 | 2013-03-26 18:06:10 | [diff] [blame] | 80 | } // namespace cc |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 81 | |
[email protected] | 89e8267 | 2013-03-18 07:50:56 | [diff] [blame] | 82 | #endif // CC_QUADS_TEXTURE_DRAW_QUAD_H_ |