• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "cc/quads/content_draw_quad_base.h"
6 
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "cc/base/math_util.h"
10 
11 namespace cc {
12 
ContentDrawQuadBase()13 ContentDrawQuadBase::ContentDrawQuadBase()
14     : swizzle_contents(false) {
15 }
16 
~ContentDrawQuadBase()17 ContentDrawQuadBase::~ContentDrawQuadBase() {
18 }
19 
SetNew(const SharedQuadState * shared_quad_state,DrawQuad::Material material,gfx::Rect rect,gfx::Rect opaque_rect,const gfx::RectF & tex_coord_rect,gfx::Size texture_size,bool swizzle_contents)20 void ContentDrawQuadBase::SetNew(const SharedQuadState* shared_quad_state,
21                                  DrawQuad::Material material,
22                                  gfx::Rect rect,
23                                  gfx::Rect opaque_rect,
24                                  const gfx::RectF& tex_coord_rect,
25                                  gfx::Size texture_size,
26                                  bool swizzle_contents) {
27   gfx::Rect visible_rect = rect;
28   bool needs_blending = false;
29   DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect,
30                    visible_rect, needs_blending);
31   this->tex_coord_rect = tex_coord_rect;
32   this->texture_size = texture_size;
33   this->swizzle_contents = swizzle_contents;
34 }
35 
SetAll(const SharedQuadState * shared_quad_state,DrawQuad::Material material,gfx::Rect rect,gfx::Rect opaque_rect,gfx::Rect visible_rect,bool needs_blending,const gfx::RectF & tex_coord_rect,gfx::Size texture_size,bool swizzle_contents)36 void ContentDrawQuadBase::SetAll(const SharedQuadState* shared_quad_state,
37                                  DrawQuad::Material material,
38                                  gfx::Rect rect,
39                                  gfx::Rect opaque_rect,
40                                  gfx::Rect visible_rect,
41                                  bool needs_blending,
42                                  const gfx::RectF& tex_coord_rect,
43                                  gfx::Size texture_size,
44                                  bool swizzle_contents) {
45   DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect,
46                    visible_rect, needs_blending);
47   this->tex_coord_rect = tex_coord_rect;
48   this->texture_size = texture_size;
49   this->swizzle_contents = swizzle_contents;
50 }
51 
ExtendValue(base::DictionaryValue * value) const52 void ContentDrawQuadBase::ExtendValue(base::DictionaryValue* value) const {
53   value->Set("tex_coord_rect", MathUtil::AsValue(tex_coord_rect).release());
54   value->Set("texture_size", MathUtil::AsValue(texture_size).release());
55   value->SetBoolean("swizzle_contents", swizzle_contents);
56 }
57 
58 }  // namespace cc
59