Experimental push messaging api reference docs.
[chromium-blink-merge.git] / cc / CCRenderPassDrawQuad.cpp
blob966640bd9af573d27c4af4039c7fdd92fa44cb4e
1 // Copyright 2011 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 "config.h"
7 #include "CCRenderPassDrawQuad.h"
9 namespace cc {
11 PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCRenderPass::Id renderPassId, bool isReplica, const CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY)
13 return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY));
16 CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY)
17 : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderPass, quadRect)
18 , m_renderPassId(renderPassId)
19 , m_isReplica(isReplica)
20 , m_maskResourceId(maskResourceId)
21 , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame)
22 , m_maskTexCoordScaleX(maskTexCoordScaleX)
23 , m_maskTexCoordScaleY(maskTexCoordScaleY)
24 , m_maskTexCoordOffsetX(maskTexCoordOffsetX)
25 , m_maskTexCoordOffsetY(maskTexCoordOffsetY)
27 ASSERT(m_renderPassId.layerId > 0);
28 ASSERT(m_renderPassId.index >= 0);
31 const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const CCDrawQuad* quad)
33 ASSERT(quad->material() == CCDrawQuad::RenderPass);
34 return static_cast<const CCRenderPassDrawQuad*>(quad);
37 PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const
39 unsigned bytes = size();
40 ASSERT(bytes);
42 OwnPtr<CCRenderPassDrawQuad> copyQuad(adoptPtr(reinterpret_cast<CCRenderPassDrawQuad*>(new char[bytes])));
43 memcpy(copyQuad.get(), this, bytes);
44 copyQuad->setSharedQuadState(copiedSharedQuadState);
45 copyQuad->m_renderPassId = copiedRenderPassId;
47 return copyQuad.release();