| 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/test/render_pass_test_common.h" | 5 #include "cc/test/render_pass_test_common.h" |
| 6 | 6 |
| 7 #include "cc/checkerboard_draw_quad.h" | 7 #include "cc/checkerboard_draw_quad.h" |
| 8 #include "cc/debug_border_draw_quad.h" | 8 #include "cc/debug_border_draw_quad.h" |
| 9 #include "cc/io_surface_draw_quad.h" | 9 #include "cc/io_surface_draw_quad.h" |
| 10 #include "cc/render_pass_draw_quad.h" | 10 #include "cc/render_pass_draw_quad.h" |
| 11 #include "cc/solid_color_draw_quad.h" | 11 #include "cc/solid_color_draw_quad.h" |
| 12 #include "cc/shared_quad_state.h" | 12 #include "cc/shared_quad_state.h" |
| 13 #include "cc/stream_video_draw_quad.h" | 13 #include "cc/stream_video_draw_quad.h" |
| 14 #include "cc/texture_draw_quad.h" | 14 #include "cc/texture_draw_quad.h" |
| 15 #include "cc/tile_draw_quad.h" | 15 #include "cc/tile_draw_quad.h" |
| 16 #include "cc/yuv_video_draw_quad.h" | 16 #include "cc/yuv_video_draw_quad.h" |
| 17 #include "cc/resource_provider.h" | 17 #include "cc/resource_provider.h" |
| 18 #include <public/WebTransformationMatrix.h> | 18 #include <public/WebTransformationMatrix.h> |
| 19 | 19 |
| 20 namespace WebKitTests { | 20 namespace WebKitTests { |
| 21 | 21 |
| 22 using cc::DrawQuad; | 22 using cc::DrawQuad; |
| 23 using WebKit::WebTransformationMatrix; | 23 using WebKit::WebTransformationMatrix; |
| 24 | 24 |
| 25 void TestRenderPass::appendOneOfEveryQuadType(cc::ResourceProvider* resourceProv
ider) | 25 void TestRenderPass::appendOneOfEveryQuadType(cc::ResourceProvider* resourceProv
ider) |
| 26 { | 26 { |
| 27 gfx::Rect rect(0, 0, 100, 100); | 27 gfx::Rect rect(0, 0, 100, 100); |
| 28 gfx::Rect opaqueRect(10, 10, 80, 80); |
| 28 cc::ResourceProvider::ResourceId textureResource = resourceProvider->createR
esourceFromExternalTexture(1); | 29 cc::ResourceProvider::ResourceId textureResource = resourceProvider->createR
esourceFromExternalTexture(1); |
| 29 scoped_ptr<cc::SharedQuadState> sharedState = cc::SharedQuadState::create(We
bTransformationMatrix(), rect, rect, 1, false); | 30 scoped_ptr<cc::SharedQuadState> sharedState = cc::SharedQuadState::create(We
bTransformationMatrix(), rect, rect, 1); |
| 30 | 31 |
| 31 appendQuad(cc::CheckerboardDrawQuad::create(sharedState.get(), rect, SK_Colo
rRED).PassAs<DrawQuad>()); | 32 appendQuad(cc::CheckerboardDrawQuad::create(sharedState.get(), rect, SK_Colo
rRED).PassAs<DrawQuad>()); |
| 32 appendQuad(cc::DebugBorderDrawQuad::create(sharedState.get(), rect, SK_Color
RED, 1).Pass().PassAs<DrawQuad>()); | 33 appendQuad(cc::DebugBorderDrawQuad::create(sharedState.get(), rect, SK_Color
RED, 1).Pass().PassAs<DrawQuad>()); |
| 33 appendQuad(cc::IOSurfaceDrawQuad::create(sharedState.get(), rect, gfx::Size(
50, 50), 1, cc::IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>()); | 34 appendQuad(cc::IOSurfaceDrawQuad::create(sharedState.get(), rect, opaqueRect
, gfx::Size(50, 50), 1, cc::IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>()); |
| 34 | 35 |
| 35 cc::RenderPass::Id passId(1, 1); | 36 cc::RenderPass::Id passId(1, 1); |
| 36 appendQuad(cc::RenderPassDrawQuad::create(sharedState.get(), rect, passId, f
alse, 0, rect, 0, 0, 0, 0).PassAs<DrawQuad>()); | 37 appendQuad(cc::RenderPassDrawQuad::create(sharedState.get(), rect, passId, f
alse, 0, rect, 0, 0, 0, 0).PassAs<DrawQuad>()); |
| 37 | 38 |
| 38 appendQuad(cc::SolidColorDrawQuad::create(sharedState.get(), rect, SK_ColorR
ED).PassAs<DrawQuad>()); | 39 appendQuad(cc::SolidColorDrawQuad::create(sharedState.get(), rect, SK_ColorR
ED).PassAs<DrawQuad>()); |
| 39 appendQuad(cc::StreamVideoDrawQuad::create(sharedState.get(), rect, 1, WebKi
t::WebTransformationMatrix()).PassAs<DrawQuad>()); | 40 appendQuad(cc::StreamVideoDrawQuad::create(sharedState.get(), rect, opaqueRe
ct, 1, WebKit::WebTransformationMatrix()).PassAs<DrawQuad>()); |
| 40 appendQuad(cc::TextureDrawQuad::create(sharedState.get(), rect, textureResou
rce, false, rect, false).PassAs<DrawQuad>()); | 41 appendQuad(cc::TextureDrawQuad::create(sharedState.get(), rect, opaqueRect,
textureResource, false, rect, false).PassAs<DrawQuad>()); |
| 41 | 42 |
| 42 appendQuad(cc::TileDrawQuad::create(sharedState.get(), rect, rect, textureRe
source, gfx::Vector2d(), gfx::Size(100, 100), false, false, false, false, false)
.PassAs<DrawQuad>()); | 43 appendQuad(cc::TileDrawQuad::create(sharedState.get(), rect, opaqueRect, tex
tureResource, gfx::Vector2d(), gfx::Size(100, 100), false, false, false, false,
false).PassAs<DrawQuad>()); |
| 43 | 44 |
| 44 cc::VideoLayerImpl::FramePlane planes[3]; | 45 cc::VideoLayerImpl::FramePlane planes[3]; |
| 45 for (int i = 0; i < 3; ++i) { | 46 for (int i = 0; i < 3; ++i) { |
| 46 planes[i].resourceId = resourceProvider->createResourceFromExternalTextu
re(1); | 47 planes[i].resourceId = resourceProvider->createResourceFromExternalTextu
re(1); |
| 47 planes[i].size = gfx::Size(100, 100); | 48 planes[i].size = gfx::Size(100, 100); |
| 48 planes[i].format = GL_LUMINANCE; | 49 planes[i].format = GL_LUMINANCE; |
| 49 } | 50 } |
| 50 appendQuad(cc::YUVVideoDrawQuad::create(sharedState.get(), rect, gfx::Size(1
00, 100), planes[0], planes[1], planes[2]).PassAs<DrawQuad>()); | 51 appendQuad(cc::YUVVideoDrawQuad::create(sharedState.get(), rect, opaqueRect,
gfx::Size(100, 100), planes[0], planes[1], planes[2]).PassAs<DrawQuad>()); |
| 51 appendSharedQuadState(sharedState.Pass()); | 52 appendSharedQuadState(sharedState.Pass()); |
| 52 } | 53 } |
| 53 | 54 |
| 54 } // namespace WebKitTests | 55 } // namespace WebKitTests |
| OLD | NEW |