Provide core API permissions to extensions_unittests
[chromium-blink-merge.git] / cc / quads / picture_draw_quad.cc
blobaf120a41e3951c7a9eb99e599acc05a88029c2e7
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.
5 #include "cc/quads/picture_draw_quad.h"
7 #include "base/debug/trace_event_argument.h"
8 #include "base/values.h"
9 #include "cc/base/math_util.h"
10 #include "cc/resources/platform_color.h"
12 namespace cc {
14 PictureDrawQuad::PictureDrawQuad() {
17 PictureDrawQuad::~PictureDrawQuad() {
20 void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
21 const gfx::Rect& rect,
22 const gfx::Rect& opaque_rect,
23 const gfx::Rect& visible_rect,
24 const gfx::RectF& tex_coord_rect,
25 const gfx::Size& texture_size,
26 ResourceFormat texture_format,
27 const gfx::Rect& content_rect,
28 float contents_scale,
29 scoped_refptr<PicturePileImpl> picture_pile) {
30 ContentDrawQuadBase::SetNew(
31 shared_quad_state,
32 DrawQuad::PICTURE_CONTENT,
33 rect,
34 opaque_rect,
35 visible_rect,
36 tex_coord_rect,
37 texture_size,
38 !PlatformColor::SameComponentOrder(texture_format));
39 this->content_rect = content_rect;
40 this->contents_scale = contents_scale;
41 this->picture_pile = picture_pile;
42 this->texture_format = texture_format;
45 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
46 const gfx::Rect& rect,
47 const gfx::Rect& opaque_rect,
48 const gfx::Rect& visible_rect,
49 bool needs_blending,
50 const gfx::RectF& tex_coord_rect,
51 const gfx::Size& texture_size,
52 ResourceFormat texture_format,
53 const gfx::Rect& content_rect,
54 float contents_scale,
55 scoped_refptr<PicturePileImpl> picture_pile) {
56 ContentDrawQuadBase::SetAll(shared_quad_state,
57 DrawQuad::PICTURE_CONTENT,
58 rect,
59 opaque_rect,
60 visible_rect,
61 needs_blending,
62 tex_coord_rect,
63 texture_size,
64 !PlatformColor::SameComponentOrder(
65 texture_format));
66 this->content_rect = content_rect;
67 this->contents_scale = contents_scale;
68 this->picture_pile = picture_pile;
69 this->texture_format = texture_format;
72 void PictureDrawQuad::IterateResources(
73 const ResourceIteratorCallback& callback) {
74 // TODO(danakj): Convert to TextureDrawQuad?
75 NOTIMPLEMENTED();
78 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) {
79 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT);
80 return static_cast<const PictureDrawQuad*>(quad);
83 void PictureDrawQuad::ExtendValue(base::debug::TracedValue* value) const {
84 ContentDrawQuadBase::ExtendValue(value);
85 value->BeginArray("content_rect");
86 MathUtil::AddToTracedValue(content_rect, value);
87 value->EndArray();
88 value->SetDouble("contents_scale", contents_scale);
89 value->SetInteger("texture_format", texture_format);
90 // TODO(piman): picture_pile?
93 } // namespace cc