OLD | NEW |
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/texture_draw_quad.h" | 5 #include "cc/texture_draw_quad.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 scoped_ptr<TextureDrawQuad> TextureDrawQuad::create(const SharedQuadState* share
dQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned res
ourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped) | 11 TextureDrawQuad::TextureDrawQuad() |
12 { | 12 : resource_id(0), |
13 return make_scoped_ptr(new TextureDrawQuad(sharedQuadState, quadRect, opaque
Rect, resourceId, premultipliedAlpha, uvRect, flipped)); | 13 premultiplied_alpha(false), |
| 14 flipped(false) { |
14 } | 15 } |
15 | 16 |
16 TextureDrawQuad::TextureDrawQuad(const SharedQuadState* sharedQuadState, const g
fx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, bool premu
ltipliedAlpha, const gfx::RectF& uvRect, bool flipped) | 17 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { |
17 : m_resourceId(resourceId) | 18 return make_scoped_ptr(new TextureDrawQuad); |
18 , m_premultipliedAlpha(premultipliedAlpha) | |
19 , m_uvRect(uvRect) | |
20 , m_flipped(flipped) | |
21 { | |
22 gfx::Rect visibleRect = quadRect; | |
23 bool needsBlending = false; | |
24 DrawQuad::SetAll(sharedQuadState, DrawQuad::TEXTURE_CONTENT, quadRect, opaqu
eRect, visibleRect, needsBlending); | |
25 } | 19 } |
26 | 20 |
27 const TextureDrawQuad* TextureDrawQuad::materialCast(const DrawQuad* quad) | 21 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
28 { | 22 gfx::Rect rect, |
29 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); | 23 gfx::Rect opaque_rect, |
30 return static_cast<const TextureDrawQuad*>(quad); | 24 unsigned resource_id, |
| 25 bool premultiplied_alpha, |
| 26 const gfx::RectF& uv_rect, |
| 27 bool flipped) { |
| 28 gfx::Rect visible_rect = rect; |
| 29 bool needs_blending = false; |
| 30 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, |
| 31 opaque_rect, visible_rect, needs_blending); |
| 32 this->resource_id = resource_id; |
| 33 this->premultiplied_alpha = premultiplied_alpha; |
| 34 this->uv_rect = uv_rect; |
| 35 this->flipped = flipped; |
| 36 } |
| 37 |
| 38 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 39 gfx::Rect rect, |
| 40 gfx::Rect opaque_rect, |
| 41 gfx::Rect visible_rect, |
| 42 bool needs_blending, |
| 43 unsigned resource_id, |
| 44 bool premultiplied_alpha, |
| 45 const gfx::RectF& uv_rect, |
| 46 bool flipped) { |
| 47 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, |
| 48 opaque_rect, visible_rect, needs_blending); |
| 49 this->resource_id = resource_id; |
| 50 this->premultiplied_alpha = premultiplied_alpha; |
| 51 this->uv_rect = uv_rect; |
| 52 this->flipped = flipped; |
| 53 } |
| 54 |
| 55 const TextureDrawQuad* TextureDrawQuad::MaterialCast( |
| 56 const DrawQuad* quad) { |
| 57 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); |
| 58 return static_cast<const TextureDrawQuad*>(quad); |
31 } | 59 } |
32 | 60 |
33 } // namespace cc | 61 } // namespace cc |
OLD | NEW |