| Index: cc/render_pass.cc
|
| diff --git a/cc/render_pass.cc b/cc/render_pass.cc
|
| index bbb36e5a629250d83100214c67e5b77c3f19b97c..0a8dc488f66e8b23415af19929977d2eec7cd84c 100644
|
| --- a/cc/render_pass.cc
|
| +++ b/cc/render_pass.cc
|
| @@ -4,113 +4,84 @@
|
|
|
| #include "cc/render_pass.h"
|
|
|
| -#include "cc/layer_impl.h"
|
| -#include "cc/math_util.h"
|
| -#include "cc/occlusion_tracker.h"
|
| -#include "cc/quad_culler.h"
|
| -#include "cc/shared_quad_state.h"
|
| -#include "cc/solid_color_draw_quad.h"
|
| #include "third_party/skia/include/core/SkImageFilter.h"
|
|
|
| using WebKit::WebTransformationMatrix;
|
|
|
| namespace cc {
|
|
|
| -scoped_ptr<RenderPass> RenderPass::create(Id id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget)
|
| -{
|
| - return make_scoped_ptr(new RenderPass(id, outputRect, transformToRootTarget));
|
| +scoped_ptr<RenderPass> RenderPass::Create() {
|
| + return make_scoped_ptr(new RenderPass);
|
| }
|
|
|
| -RenderPass::RenderPass(Id id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget)
|
| - : m_id(id)
|
| - , m_transformToRootTarget(transformToRootTarget)
|
| - , m_outputRect(outputRect)
|
| - , m_hasTransparentBackground(true)
|
| - , m_hasOcclusionFromOutsideTargetSurface(false)
|
| - , m_filter(0)
|
| -{
|
| - DCHECK(id.layerId > 0);
|
| - DCHECK(id.index >= 0);
|
| +RenderPass::RenderPass()
|
| + : id(Id(-1, -1)),
|
| + has_transparent_background(true),
|
| + has_occlusion_from_outside_target_surface(false),
|
| + filter(NULL) {
|
| }
|
|
|
| -RenderPass::~RenderPass()
|
| -{
|
| - SkSafeUnref(m_filter);
|
| +RenderPass::~RenderPass() {
|
| + SkSafeUnref(filter);
|
| }
|
|
|
| -scoped_ptr<RenderPass> RenderPass::copy(Id newId) const
|
| -{
|
| - DCHECK(newId != m_id);
|
| -
|
| - scoped_ptr<RenderPass> copyPass(create(newId, m_outputRect, m_transformToRootTarget));
|
| - copyPass->setDamageRect(m_damageRect);
|
| - copyPass->setHasTransparentBackground(m_hasTransparentBackground);
|
| - copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideTargetSurface);
|
| - copyPass->setFilters(m_filters);
|
| - copyPass->setBackgroundFilters(m_backgroundFilters);
|
| - copyPass->setFilter(m_filter);
|
| - return copyPass.Pass();
|
| +scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const {
|
| + DCHECK(new_id != id);
|
| +
|
| + scoped_ptr<RenderPass> copy_pass(Create());
|
| + copy_pass->SetAll(new_id,
|
| + output_rect,
|
| + damage_rect,
|
| + transform_to_root_target,
|
| + has_transparent_background,
|
| + has_occlusion_from_outside_target_surface,
|
| + filters,
|
| + filter,
|
| + background_filters);
|
| + return copy_pass.Pass();
|
| }
|
|
|
| -void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occlusionTracker, AppendQuadsData& appendQuadsData)
|
| -{
|
| - bool forSurface = false;
|
| - QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->showDebugBorders(), forSurface);
|
| +void RenderPass::SetNew(Id id,
|
| + gfx::Rect output_rect,
|
| + gfx::RectF damage_rect,
|
| + const WebKit::WebTransformationMatrix& transform_to_root_target) {
|
| + DCHECK_GT(id.layer_id, 0);
|
| + DCHECK_GE(id.index, 0);
|
|
|
| - layer->appendQuads(quadCuller, appendQuadsData);
|
| -}
|
| -
|
| -void RenderPass::appendQuadsForRenderSurfaceLayer(LayerImpl* layer, const RenderPass* contributingRenderPass, OcclusionTrackerImpl* occlusionTracker, AppendQuadsData& appendQuadsData)
|
| -{
|
| - bool forSurface = true;
|
| - QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->showDebugBorders(), forSurface);
|
| -
|
| - bool isReplica = false;
|
| - layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica, contributingRenderPass->id());
|
| -
|
| - // Add replica after the surface so that it appears below the surface.
|
| - if (layer->hasReplica()) {
|
| - isReplica = true;
|
| - layer->renderSurface()->appendQuads(quadCuller, appendQuadsData, isReplica, contributingRenderPass->id());
|
| - }
|
| -}
|
| + this->id = id;
|
| + this->output_rect = output_rect;
|
| + this->damage_rect = damage_rect;
|
| + this->transform_to_root_target = transform_to_root_target;
|
|
|
| -void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBackgroundColor, const OcclusionTrackerImpl& occlusionTracker)
|
| -{
|
| - if (!rootLayer || !screenBackgroundColor)
|
| - return;
|
| -
|
| - Region fillRegion = occlusionTracker.computeVisibleRegionInScreen();
|
| - if (fillRegion.IsEmpty())
|
| - return;
|
| -
|
| - bool forSurface = false;
|
| - QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusionTracker, rootLayer->showDebugBorders(), forSurface);
|
| -
|
| - // Manually create the quad state for the gutter quads, as the root layer
|
| - // doesn't have any bounds and so can't generate this itself.
|
| - // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
|
| -
|
| - DCHECK(rootLayer->screenSpaceTransform().isInvertible());
|
| -
|
| - gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
|
| - float opacity = 1;
|
| - SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::Create());
|
| - sharedQuadState->SetAll(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity);
|
| -
|
| - WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse();
|
| - for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects.next()) {
|
| - // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
|
| - gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fillRects.rect());
|
| - // Skip the quad culler and just append the quads directly to avoid occlusion checks.
|
| - scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
|
| - quad->SetNew(sharedQuadState, layerRect, screenBackgroundColor);
|
| - m_quadList.append(quad.PassAs<DrawQuad>());
|
| - }
|
| + DCHECK(quad_list.isEmpty());
|
| + DCHECK(shared_quad_state_list.isEmpty());
|
| }
|
|
|
| -void RenderPass::setFilter(SkImageFilter* filter) {
|
| - SkRefCnt_SafeAssign(m_filter, filter);
|
| +void RenderPass::SetAll(Id id,
|
| + gfx::Rect output_rect,
|
| + gfx::RectF damage_rect,
|
| + const WebKit::WebTransformationMatrix& transform_to_root_target,
|
| + bool has_transparent_background,
|
| + bool has_occlusion_from_outside_target_surface,
|
| + const WebKit::WebFilterOperations& filters,
|
| + SkImageFilter* filter,
|
| + const WebKit::WebFilterOperations& background_filters) {
|
| + DCHECK_GT(id.layer_id, 0);
|
| + DCHECK_GE(id.index, 0);
|
| +
|
| + this->id = id;
|
| + this->output_rect = output_rect;
|
| + this->damage_rect = damage_rect;
|
| + this->transform_to_root_target = transform_to_root_target;
|
| + this->has_transparent_background = has_transparent_background;
|
| + this->has_occlusion_from_outside_target_surface =
|
| + has_occlusion_from_outside_target_surface;
|
| + this->filters = filters;
|
| + SkRefCnt_SafeAssign(this->filter, filter);
|
| + this->background_filters = background_filters;
|
| +
|
| + DCHECK(quad_list.isEmpty());
|
| + DCHECK(shared_quad_state_list.isEmpty());
|
| }
|
|
|
| } // namespace cc
|
|
|