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/logging.h"
8 #include "base/trace_event/trace_event_argument.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(
58 base::trace_event::TracedValue
* value
) const {
59 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect
, value
);
60 MathUtil::AddToTracedValue("texture_size", texture_size
, value
);
62 value
->SetBoolean("swizzle_contents", swizzle_contents
);
63 value
->SetBoolean("nearest_neighbor", nearest_neighbor
);