Rename frame classes
[chromium-blink-merge.git] / cc / quads / io_surface_draw_quad.cc
blob32e2ffc42d443dae58f64a4474034c6f292a8743
1 // Copyright 2012 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/io_surface_draw_quad.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"
12 namespace cc {
14 IOSurfaceDrawQuad::IOSurfaceDrawQuad()
15 : orientation(FLIPPED), allow_overlay(false) {
18 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
19 const gfx::Rect& rect,
20 const gfx::Rect& opaque_rect,
21 const gfx::Rect& visible_rect,
22 const gfx::Size& io_surface_size,
23 unsigned io_surface_resource_id,
24 Orientation orientation,
25 bool allow_overlay) {
26 bool needs_blending = false;
27 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
28 opaque_rect, visible_rect, needs_blending);
29 this->io_surface_size = io_surface_size;
30 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
31 resources.count = 1;
32 this->orientation = orientation;
33 this->allow_overlay = allow_overlay;
36 void IOSurfaceDrawQuad::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::Size& io_surface_size,
42 unsigned io_surface_resource_id,
43 Orientation orientation,
44 bool allow_overlay) {
45 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
46 opaque_rect, visible_rect, needs_blending);
47 this->io_surface_size = io_surface_size;
48 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
49 resources.count = 1;
50 this->orientation = orientation;
51 this->allow_overlay = allow_overlay;
54 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast(
55 const DrawQuad* quad) {
56 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT);
57 return static_cast<const IOSurfaceDrawQuad*>(quad);
60 void IOSurfaceDrawQuad::ExtendValue(
61 base::trace_event::TracedValue* value) const {
62 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value);
64 value->SetInteger("io_surface_resource_id",
65 resources.ids[kIOSurfaceResourceIdIndex]);
66 const char* orientation_string = NULL;
67 switch (orientation) {
68 case FLIPPED:
69 orientation_string = "flipped";
70 break;
71 case UNFLIPPED:
72 orientation_string = "unflipped";
73 break;
76 value->SetString("orientation", orientation_string);
79 } // namespace cc