blob: 2ba5b9d2aaf23a6f356388694d73f22f897ef249 [file] [log] [blame]
[email protected]0fb25002012-10-12 07:20:021// 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]cd57cc5a2012-10-12 22:43:414
[email protected]89e82672013-03-18 07:50:565#ifndef CC_QUADS_TEXTURE_DRAW_QUAD_H_
6#define CC_QUADS_TEXTURE_DRAW_QUAD_H_
[email protected]cd57cc5a2012-10-12 22:43:417
avi02a4d172015-12-21 06:14:368#include <stddef.h>
9
[email protected]cd57cc5a2012-10-12 22:43:4110#include "base/memory/scoped_ptr.h"
[email protected]681ccff2013-03-18 06:13:5211#include "cc/base/cc_export.h"
[email protected]89e82672013-03-18 07:50:5612#include "cc/quads/draw_quad.h"
heejin.r.chungd28506ba2014-10-23 16:36:2013#include "ui/gfx/geometry/rect_f.h"
[email protected]cd57cc5a2012-10-12 22:43:4114
15namespace cc {
16
[email protected]52347c842012-11-02 21:06:2017class CC_EXPORT TextureDrawQuad : public DrawQuad {
[email protected]c22418b2012-11-20 23:06:2618 public:
[email protected]cb3203582014-07-16 07:51:5319 TextureDrawQuad();
[email protected]cd57cc5a2012-10-12 22:43:4120
[email protected]c22418b2012-11-20 23:06:2621 void SetNew(const SharedQuadState* shared_quad_state,
[email protected]0023fc72014-01-10 20:05:0622 const gfx::Rect& rect,
23 const gfx::Rect& opaque_rect,
[email protected]9bf06c72014-03-07 18:16:2424 const gfx::Rect& visible_rect,
[email protected]c22418b2012-11-20 23:06:2625 unsigned resource_id,
26 bool premultiplied_alpha,
[email protected]14bc5d682014-01-17 07:26:4727 const gfx::PointF& uv_top_left,
28 const gfx::PointF& uv_bottom_right,
[email protected]d18b4d62013-07-12 05:33:4929 SkColor background_color,
[email protected]4c91aec2012-12-15 20:17:1830 const float vertex_opacity[4],
halliwellaa111282015-05-13 21:58:4331 bool y_flipped,
jackhou10c9af42014-12-04 05:24:4432 bool nearest_neighbor);
[email protected]cd57cc5a2012-10-12 22:43:4133
[email protected]c22418b2012-11-20 23:06:2634 void SetAll(const SharedQuadState* shared_quad_state,
[email protected]0023fc72014-01-10 20:05:0635 const gfx::Rect& rect,
36 const gfx::Rect& opaque_rect,
37 const gfx::Rect& visible_rect,
[email protected]c22418b2012-11-20 23:06:2638 bool needs_blending,
39 unsigned resource_id,
achaulkf89f5942015-06-10 17:01:3540 gfx::Size resource_size_in_pixels,
[email protected]c22418b2012-11-20 23:06:2641 bool premultiplied_alpha,
[email protected]14bc5d682014-01-17 07:26:4742 const gfx::PointF& uv_top_left,
43 const gfx::PointF& uv_bottom_right,
[email protected]d18b4d62013-07-12 05:33:4944 SkColor background_color,
[email protected]4c91aec2012-12-15 20:17:1845 const float vertex_opacity[4],
halliwellaa111282015-05-13 21:58:4346 bool y_flipped,
jackhou10c9af42014-12-04 05:24:4447 bool nearest_neighbor);
[email protected]cd57cc5a2012-10-12 22:43:4148
[email protected]c22418b2012-11-20 23:06:2649 bool premultiplied_alpha;
[email protected]1fd555b2013-01-18 00:13:2150 gfx::PointF uv_top_left;
51 gfx::PointF uv_bottom_right;
[email protected]d18b4d62013-07-12 05:33:4952 SkColor background_color;
[email protected]4c91aec2012-12-15 20:17:1853 float vertex_opacity[4];
halliwellaa111282015-05-13 21:58:4354 bool y_flipped;
jackhou10c9af42014-12-04 05:24:4455 bool nearest_neighbor;
[email protected]c22418b2012-11-20 23:06:2656
achaulkf89f5942015-06-10 17:01:3557 struct OverlayResources {
58 OverlayResources();
59
60 gfx::Size size_in_pixels[Resources::kMaxResourceIdCount];
achaulkf89f5942015-06-10 17:01:3561 };
62 OverlayResources overlay_resources;
63
vmpstr0eca2e82015-06-02 22:14:4664 ResourceId resource_id() const { return resources.ids[kResourceIdIndex]; }
achaulkf89f5942015-06-10 17:01:3565 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]05469632013-01-16 03:41:0071
[email protected]c22418b2012-11-20 23:06:2672 static const TextureDrawQuad* MaterialCast(const DrawQuad*);
[email protected]cd48d682012-12-13 02:42:1973
[email protected]c22418b2012-11-20 23:06:2674 private:
vmpstr0eca2e82015-06-02 22:14:4675 static const size_t kResourceIdIndex = 0;
76
ssid911e40e2015-02-09 17:55:2077 void ExtendValue(base::trace_event::TracedValue* value) const override;
[email protected]cd57cc5a2012-10-12 22:43:4178};
79
[email protected]adb08542013-03-26 18:06:1080} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:4181
[email protected]89e82672013-03-18 07:50:5682#endif // CC_QUADS_TEXTURE_DRAW_QUAD_H_