Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: cc/quads/io_surface_draw_quad.cc

Issue 1152473006: cc: Remove DrawQuad::IterateResoruces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mkwst review Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/quads/io_surface_draw_quad.h" 5 #include "cc/quads/io_surface_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 IOSurfaceDrawQuad::IOSurfaceDrawQuad() 14 IOSurfaceDrawQuad::IOSurfaceDrawQuad() : orientation(FLIPPED) {
15 : io_surface_resource_id(0),
16 orientation(FLIPPED) {
17 } 15 }
18 16
19 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 17 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
20 const gfx::Rect& rect, 18 const gfx::Rect& rect,
21 const gfx::Rect& opaque_rect, 19 const gfx::Rect& opaque_rect,
22 const gfx::Rect& visible_rect, 20 const gfx::Rect& visible_rect,
23 const gfx::Size& io_surface_size, 21 const gfx::Size& io_surface_size,
24 unsigned io_surface_resource_id, 22 unsigned io_surface_resource_id,
25 Orientation orientation) { 23 Orientation orientation) {
26 bool needs_blending = false; 24 bool needs_blending = false;
27 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, 25 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
28 opaque_rect, visible_rect, needs_blending); 26 opaque_rect, visible_rect, needs_blending);
29 this->io_surface_size = io_surface_size; 27 this->io_surface_size = io_surface_size;
30 this->io_surface_resource_id = io_surface_resource_id; 28 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
29 resources.count = 1;
31 this->orientation = orientation; 30 this->orientation = orientation;
32 } 31 }
33 32
34 void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 33 void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
35 const gfx::Rect& rect, 34 const gfx::Rect& rect,
36 const gfx::Rect& opaque_rect, 35 const gfx::Rect& opaque_rect,
37 const gfx::Rect& visible_rect, 36 const gfx::Rect& visible_rect,
38 bool needs_blending, 37 bool needs_blending,
39 const gfx::Size& io_surface_size, 38 const gfx::Size& io_surface_size,
40 unsigned io_surface_resource_id, 39 unsigned io_surface_resource_id,
41 Orientation orientation) { 40 Orientation orientation) {
42 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, 41 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
43 opaque_rect, visible_rect, needs_blending); 42 opaque_rect, visible_rect, needs_blending);
44 this->io_surface_size = io_surface_size; 43 this->io_surface_size = io_surface_size;
45 this->io_surface_resource_id = io_surface_resource_id; 44 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
45 resources.count = 1;
46 this->orientation = orientation; 46 this->orientation = orientation;
47 } 47 }
48 48
49 void IOSurfaceDrawQuad::IterateResources(
50 const ResourceIteratorCallback& callback) {
51 io_surface_resource_id = callback.Run(io_surface_resource_id);
52 }
53
54 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast( 49 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast(
55 const DrawQuad* quad) { 50 const DrawQuad* quad) {
56 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT); 51 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT);
57 return static_cast<const IOSurfaceDrawQuad*>(quad); 52 return static_cast<const IOSurfaceDrawQuad*>(quad);
58 } 53 }
59 54
60 void IOSurfaceDrawQuad::ExtendValue( 55 void IOSurfaceDrawQuad::ExtendValue(
61 base::trace_event::TracedValue* value) const { 56 base::trace_event::TracedValue* value) const {
62 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value); 57 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value);
63 58
64 value->SetInteger("io_surface_resource_id", io_surface_resource_id); 59 value->SetInteger("io_surface_resource_id",
60 resources.ids[kIOSurfaceResourceIdIndex]);
65 const char* orientation_string = NULL; 61 const char* orientation_string = NULL;
66 switch (orientation) { 62 switch (orientation) {
67 case FLIPPED: 63 case FLIPPED:
68 orientation_string = "flipped"; 64 orientation_string = "flipped";
69 break; 65 break;
70 case UNFLIPPED: 66 case UNFLIPPED:
71 orientation_string = "unflipped"; 67 orientation_string = "unflipped";
72 break; 68 break;
73 } 69 }
74 70
75 value->SetString("orientation", orientation_string); 71 value->SetString("orientation", orientation_string);
76 } 72 }
77 73
78 } // namespace cc 74 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698