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/content_draw_quad_base.h"
7 #include "base/debug/trace_event_argument.h"
8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "cc/base/math_util.h"
14 ContentDrawQuadBase::ContentDrawQuadBase()
15 : swizzle_contents(false) {
18 ContentDrawQuadBase::~ContentDrawQuadBase() {
21 void ContentDrawQuadBase::SetNew(const SharedQuadState
* shared_quad_state
,
22 DrawQuad::Material material
,
23 const gfx::Rect
& rect
,
24 const gfx::Rect
& opaque_rect
,
25 const gfx::Rect
& visible_rect
,
26 const gfx::RectF
& tex_coord_rect
,
27 const gfx::Size
& texture_size
,
28 bool swizzle_contents
,
29 bool nearest_neighbor
) {
30 bool needs_blending
= false;
31 DrawQuad::SetAll(shared_quad_state
, material
, rect
, opaque_rect
,
32 visible_rect
, needs_blending
);
33 this->tex_coord_rect
= tex_coord_rect
;
34 this->texture_size
= texture_size
;
35 this->swizzle_contents
= swizzle_contents
;
36 this->nearest_neighbor
= nearest_neighbor
;
39 void ContentDrawQuadBase::SetAll(const SharedQuadState
* shared_quad_state
,
40 DrawQuad::Material material
,
41 const gfx::Rect
& rect
,
42 const gfx::Rect
& opaque_rect
,
43 const gfx::Rect
& visible_rect
,
45 const gfx::RectF
& tex_coord_rect
,
46 const gfx::Size
& texture_size
,
47 bool swizzle_contents
,
48 bool nearest_neighbor
) {
49 DrawQuad::SetAll(shared_quad_state
, material
, rect
, opaque_rect
,
50 visible_rect
, needs_blending
);
51 this->tex_coord_rect
= tex_coord_rect
;
52 this->texture_size
= texture_size
;
53 this->swizzle_contents
= swizzle_contents
;
54 this->nearest_neighbor
= nearest_neighbor
;
57 void ContentDrawQuadBase::ExtendValue(base::debug::TracedValue
* value
) const {
58 value
->BeginArray("tex_coord_rect");
59 MathUtil::AddToTracedValue(tex_coord_rect
, value
);
62 value
->BeginDictionary("texture_size");
63 MathUtil::AddToTracedValue(texture_size
, value
);
64 value
->EndDictionary();
66 value
->SetBoolean("swizzle_contents", swizzle_contents
);
67 value
->SetBoolean("nearest_neighbor", nearest_neighbor
);