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

Side by Side Diff: cc/tile_draw_quad.cc

Issue 12642010: Implement on demand quad rasterization for PicturePiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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/tile_draw_quad.h" 5 #include "cc/tile_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/khronos/GLES2/gl2.h" 8 #include "third_party/khronos/GLES2/gl2.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 TileDrawQuad::TileDrawQuad() 12 TileDrawQuad::TileDrawQuad()
13 : resource_id(0), 13 : resource_id(0),
14 swizzle_contents(false) { 14 swizzle_contents(false) {
15 } 15 }
16 16
17 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { 17 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() {
18 return make_scoped_ptr(new TileDrawQuad); 18 return make_scoped_ptr(new TileDrawQuad);
19 } 19 }
20 20
21 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 21 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 gfx::Rect rect, 22 gfx::Rect rect,
23 gfx::Rect opaque_rect, 23 gfx::Rect opaque_rect,
24 unsigned resource_id, 24 unsigned resource_id,
25 const gfx::RectF& tex_coord_rect, 25 const gfx::RectF& tex_coord_rect,
26 gfx::Size texture_size, 26 gfx::Size texture_size,
27 bool swizzle_contents) { 27 bool swizzle_contents) {
28 gfx::Rect visible_rect = rect; 28 gfx::Rect visible_rect = rect;
29 bool needs_blending = false; 29 bool needs_blending = false;
30 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, 30 DrawQuad::SetAll(shared_quad_state, material(), rect,
31 opaque_rect, visible_rect, needs_blending); 31 opaque_rect, visible_rect, needs_blending);
32 this->resource_id = resource_id; 32 this->resource_id = resource_id;
33 this->tex_coord_rect = tex_coord_rect; 33 this->tex_coord_rect = tex_coord_rect;
34 this->texture_size = texture_size; 34 this->texture_size = texture_size;
35 this->swizzle_contents = swizzle_contents; 35 this->swizzle_contents = swizzle_contents;
36 } 36 }
37 37
38 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 38 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
39 gfx::Rect rect, 39 gfx::Rect rect,
40 gfx::Rect opaque_rect, 40 gfx::Rect opaque_rect,
41 gfx::Rect visible_rect, 41 gfx::Rect visible_rect,
42 bool needs_blending, 42 bool needs_blending,
43 unsigned resource_id, 43 unsigned resource_id,
44 const gfx::RectF& tex_coord_rect, 44 const gfx::RectF& tex_coord_rect,
45 gfx::Size texture_size, 45 gfx::Size texture_size,
46 bool swizzle_contents) { 46 bool swizzle_contents) {
47 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, 47 DrawQuad::SetAll(shared_quad_state, material(), rect,
48 opaque_rect, visible_rect, needs_blending); 48 opaque_rect, visible_rect, needs_blending);
49 this->resource_id = resource_id; 49 this->resource_id = resource_id;
50 this->tex_coord_rect = tex_coord_rect; 50 this->tex_coord_rect = tex_coord_rect;
51 this->texture_size = texture_size; 51 this->texture_size = texture_size;
52 this->swizzle_contents = swizzle_contents; 52 this->swizzle_contents = swizzle_contents;
53 } 53 }
54 54
55 bool TileDrawQuad::IsPictureQuad() const {
danakj 2013/03/14 18:00:56 this is redundant with the quad's |material| field
Leandro GraciĆ” Gil 2013/03/19 17:30:07 Removed.
56 return false;
57 }
58
59 DrawQuad::Material TileDrawQuad::material() const {
60 return DrawQuad::TILED_CONTENT;
61 }
62
55 void TileDrawQuad::IterateResources( 63 void TileDrawQuad::IterateResources(
56 const ResourceIteratorCallback& callback) { 64 const ResourceIteratorCallback& callback) {
57 resource_id = callback.Run(resource_id); 65 resource_id = callback.Run(resource_id);
58 } 66 }
59 67
60 const TileDrawQuad* TileDrawQuad::MaterialCast( 68 const TileDrawQuad* TileDrawQuad::MaterialCast(
61 const DrawQuad* quad) { 69 const DrawQuad* quad) {
62 DCHECK(quad->material == DrawQuad::TILED_CONTENT); 70 DCHECK(quad->material == DrawQuad::TILED_CONTENT);
63 return static_cast<const TileDrawQuad*>(quad); 71 return static_cast<const TileDrawQuad*>(quad);
64 } 72 }
65 73
66 } // namespace cc 74 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698