1// Copyright 2013 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 CC_QUADS_PICTURE_DRAW_QUAD_H_
6#define CC_QUADS_PICTURE_DRAW_QUAD_H_
7
8#include "base/memory/ref_counted.h"
9#include "base/memory/scoped_ptr.h"
10#include "cc/base/cc_export.h"
11#include "cc/quads/content_draw_quad_base.h"
12#include "cc/resources/picture_pile_impl.h"
13#include "ui/gfx/rect.h"
14#include "ui/gfx/rect_f.h"
15#include "ui/gfx/size.h"
16
17namespace cc {
18
19// Used for on-demand tile rasterization.
20class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
21 public:
22  static scoped_ptr<PictureDrawQuad> Create();
23  virtual ~PictureDrawQuad();
24
25  void SetNew(const SharedQuadState* shared_quad_state,
26              const gfx::Rect& rect,
27              const gfx::Rect& opaque_rect,
28              const gfx::Rect& visible_rect,
29              const gfx::RectF& tex_coord_rect,
30              const gfx::Size& texture_size,
31              ResourceFormat texture_format,
32              const gfx::Rect& content_rect,
33              float contents_scale,
34              scoped_refptr<PicturePileImpl> picture_pile);
35
36  void SetAll(const SharedQuadState* shared_quad_state,
37              const gfx::Rect& rect,
38              const gfx::Rect& opaque_rect,
39              const gfx::Rect& visible_rect,
40              bool needs_blending,
41              const gfx::RectF& tex_coord_rect,
42              const gfx::Size& texture_size,
43              ResourceFormat texture_format,
44              const gfx::Rect& content_rect,
45              float contents_scale,
46              scoped_refptr<PicturePileImpl> picture_pile);
47
48  gfx::Rect content_rect;
49  float contents_scale;
50  scoped_refptr<PicturePileImpl> picture_pile;
51  ResourceFormat texture_format;
52
53  virtual void IterateResources(const ResourceIteratorCallback& callback)
54      OVERRIDE;
55
56  static const PictureDrawQuad* MaterialCast(const DrawQuad* quad);
57
58 private:
59  PictureDrawQuad();
60  virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE;
61};
62
63}  // namespace cc
64
65#endif  // CC_QUADS_PICTURE_DRAW_QUAD_H_
66