Add ICU message format support
[chromium-blink-merge.git] / cc / quads / io_surface_draw_quad.cc
blob0ad70fcc6b8a6fe064111e42e15a4409b64c30eb
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() : orientation(FLIPPED) {
17 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
18 const gfx::Rect& rect,
19 const gfx::Rect& opaque_rect,
20 const gfx::Rect& visible_rect,
21 const gfx::Size& io_surface_size,
22 unsigned io_surface_resource_id,
23 Orientation orientation) {
24 bool needs_blending = false;
25 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
26 opaque_rect, visible_rect, needs_blending);
27 this->io_surface_size = io_surface_size;
28 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
29 resources.count = 1;
30 this->orientation = orientation;
33 void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
34 const gfx::Rect& rect,
35 const gfx::Rect& opaque_rect,
36 const gfx::Rect& visible_rect,
37 bool needs_blending,
38 const gfx::Size& io_surface_size,
39 unsigned io_surface_resource_id,
40 Orientation orientation) {
41 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
42 opaque_rect, visible_rect, needs_blending);
43 this->io_surface_size = io_surface_size;
44 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
45 resources.count = 1;
46 this->orientation = orientation;
49 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast(
50 const DrawQuad* quad) {
51 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT);
52 return static_cast<const IOSurfaceDrawQuad*>(quad);
55 void IOSurfaceDrawQuad::ExtendValue(
56 base::trace_event::TracedValue* value) const {
57 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value);
59 value->SetInteger("io_surface_resource_id",
60 resources.ids[kIOSurfaceResourceIdIndex]);
61 const char* orientation_string = NULL;
62 switch (orientation) {
63 case FLIPPED:
64 orientation_string = "flipped";
65 break;
66 case UNFLIPPED:
67 orientation_string = "unflipped";
68 break;
71 value->SetString("orientation", orientation_string);
74 } // namespace cc