summaryrefslogtreecommitdiffstats
path: root/cc/tile_draw_quad.h
blob: 1bc97830cf9ab2024e31c437780df95c9420fa6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_TILE_DRAW_QUAD_H_
#define CC_TILE_DRAW_QUAD_H_

#include "base/memory/scoped_ptr.h"
#include "cc/cc_export.h"
#include "cc/draw_quad.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"

namespace cc {

class CC_EXPORT TileDrawQuad : public DrawQuad {
 public:
  static scoped_ptr<TileDrawQuad> Create();

  void SetNew(const SharedQuadState* shared_quad_state,
              gfx::Rect rect,
              gfx::Rect opaque_rect,
              unsigned resource_id,
              const gfx::RectF& tex_coord_rect,
              gfx::Size texture_size,
              bool swizzle_contents,
              bool left_edge_aa,
              bool top_edge_aa,
              bool right_edge_aa,
              bool bottom_edge_aa);

  void SetAll(const SharedQuadState* shared_quad_state,
              gfx::Rect rect,
              gfx::Rect opaque_rect,
              gfx::Rect visible_rect,
              bool needs_blending,
              unsigned resource_id,
              const gfx::RectF& tex_coord_rect,
              gfx::Size texture_size,
              bool swizzle_contents,
              bool left_edge_aa,
              bool top_edge_aa,
              bool right_edge_aa,
              bool bottom_edge_aa);

  unsigned resource_id;
  gfx::RectF tex_coord_rect;
  gfx::Size texture_size;
  bool swizzle_contents;

  // TODO(danakj): Stick the data used to compute these things in the quad
  // instead so the parent compositor can decide to use AA on its own.
  bool left_edge_aa;
  bool top_edge_aa;
  bool right_edge_aa;
  bool bottom_edge_aa;

  bool IsAntialiased() const {
    return left_edge_aa || top_edge_aa || right_edge_aa || bottom_edge_aa;
  }

  virtual void AppendResources(ResourceProvider::ResourceIdArray* resources)
      OVERRIDE;

  static const TileDrawQuad* MaterialCast(const DrawQuad*);
 private:
  TileDrawQuad();
};

}

#endif  // CC_TILE_DRAW_QUAD_H_