[cc] Route LayerImpl::layerTreeHostImpl() calls through LayerTreeImpl
Pulled settings & debugstate to their own files to reduce header coupling, which bit me a few times on this patch [lthi needs lth, lti needs lthi for settings, etc]. NOTRY=true BUG=155209 R=enne Review URL: https://chromiumcodereview.appspot.com/11529003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172635 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
cc
cc.gypdebug_colors.ccdebug_colors.hdebug_rect_history.hheads_up_display_layer_impl.ccio_surface_layer_impl.cclayer_impl.cclayer_impl.hlayer_tree_debug_state.cclayer_tree_debug_state.hlayer_tree_host.cclayer_tree_host.hlayer_tree_host_impl.cclayer_tree_host_impl.hlayer_tree_host_unittest.cclayer_tree_impl.cclayer_tree_impl.hlayer_tree_settings.cclayer_tree_settings.hpicture_layer_impl.ccquad_culler.ccrender_surface_impl.cctiled_layer_impl.ccvideo_layer_impl.cc
@ -97,6 +97,8 @@
|
||||
'layer_sorter.h',
|
||||
'layer_tiling_data.cc',
|
||||
'layer_tiling_data.h',
|
||||
'layer_tree_debug_state.cc',
|
||||
'layer_tree_debug_state.h',
|
||||
'layer_tree_host.cc',
|
||||
'layer_tree_host.h',
|
||||
'layer_tree_host_client.h',
|
||||
@ -106,6 +108,8 @@
|
||||
'layer_tree_host_impl.h',
|
||||
'layer_tree_impl.cc',
|
||||
'layer_tree_impl.h',
|
||||
'layer_tree_settings.cc',
|
||||
'layer_tree_settings.h',
|
||||
'layer_updater.cc',
|
||||
'layer_updater.h',
|
||||
'managed_memory_policy.cc',
|
||||
|
@ -4,53 +4,53 @@
|
||||
|
||||
#include "cc/debug_colors.h"
|
||||
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
static const float Scale(float width, const LayerTreeHostImpl* host_impl) {
|
||||
return width * (host_impl ? host_impl->deviceScaleFactor() : 1);
|
||||
static const float Scale(float width, const LayerTreeImpl* tree_impl) {
|
||||
return width * (tree_impl ? tree_impl->device_scale_factor() : 1);
|
||||
}
|
||||
|
||||
// ======= Layer border colors =======
|
||||
|
||||
// Tiled content layers are orange.
|
||||
SkColor DebugColors::TiledContentLayerBorderColor() { return SkColorSetARGB(128, 255, 128, 0); }
|
||||
int DebugColors::TiledContentLayerBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
|
||||
// Non-tiled content layers area green.
|
||||
SkColor DebugColors::ContentLayerBorderColor() { return SkColorSetARGB(128, 0, 128, 32); }
|
||||
int DebugColors::ContentLayerBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
|
||||
// Masking layers are pale blue and wide.
|
||||
SkColor DebugColors::MaskingLayerBorderColor() { return SkColorSetARGB(48, 128, 255, 255); }
|
||||
int DebugColors::MaskingLayerBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(20, host_impl); }
|
||||
int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(20, tree_impl); }
|
||||
|
||||
// Other container layers are yellow.
|
||||
SkColor DebugColors::ContainerLayerBorderColor() { return SkColorSetARGB(192, 255, 255, 0); }
|
||||
int DebugColors::ContainerLayerBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
|
||||
// Render surfaces are blue.
|
||||
SkColor DebugColors::SurfaceBorderColor() { return SkColorSetARGB(100, 0, 0, 255); }
|
||||
int DebugColors::SurfaceBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
|
||||
// Replicas of render surfaces are purple.
|
||||
SkColor DebugColors::SurfaceReplicaBorderColor() { return SkColorSetARGB(100, 160, 0, 255); }
|
||||
int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
|
||||
// Tile borders are cyan.
|
||||
SkColor DebugColors::TileBorderColor() { return SkColorSetARGB(100, 80, 200, 200); }
|
||||
int DebugColors::TileBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(1, host_impl); }
|
||||
int DebugColors::TileBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(1, tree_impl); }
|
||||
|
||||
// ======= Tile colors =======
|
||||
|
||||
// Missing tile borders are red.
|
||||
SkColor DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255, 0, 0); }
|
||||
int DebugColors::MissingTileBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(1, host_impl); }
|
||||
int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(1, tree_impl); }
|
||||
|
||||
// Culled tile borders are brown.
|
||||
SkColor DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 100, 0); }
|
||||
int DebugColors::CulledTileBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(1, host_impl); }
|
||||
int DebugColors::CulledTileBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(1, tree_impl); }
|
||||
|
||||
// ======= Checkerboard colors =======
|
||||
|
||||
@ -67,37 +67,37 @@ SkColor DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255,
|
||||
|
||||
// Paint rects in red.
|
||||
SkColor DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0, 0); }
|
||||
int DebugColors::PaintRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::PaintRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0); }
|
||||
|
||||
// Property-changed rects in blue.
|
||||
SkColor DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(255, 0, 0, 255); }
|
||||
int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30, 0, 0, 255); }
|
||||
|
||||
// Surface damage rects in yellow-orange.
|
||||
SkColor DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255, 200, 100, 0); }
|
||||
int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 200, 100, 0); }
|
||||
|
||||
// Surface replica screen space rects in green.
|
||||
SkColor DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(255, 100, 200, 0); }
|
||||
int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30, 100, 200, 0); }
|
||||
|
||||
// Layer screen space rects in purple.
|
||||
SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColorSetARGB(255, 100, 0, 200); }
|
||||
int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSetARGB(10, 100, 0, 200); }
|
||||
|
||||
// Occluding rects in pink.
|
||||
SkColor DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245, 136, 255); }
|
||||
int DebugColors::OccludingRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 136, 255); }
|
||||
|
||||
// Non-Occluding rects in a reddish color.
|
||||
SkColor DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255, 200, 0, 100); }
|
||||
int DebugColors::NonOccludingRectBorderWidth(const LayerTreeHostImpl* host_impl) { return Scale(2, host_impl); }
|
||||
int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(2, tree_impl); }
|
||||
SkColor DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200, 0, 100); }
|
||||
|
||||
} // namespace cc
|
||||
|
@ -10,67 +10,67 @@
|
||||
|
||||
namespace cc {
|
||||
|
||||
class LayerTreeHostImpl;
|
||||
class LayerTreeImpl;
|
||||
|
||||
class DebugColors {
|
||||
public:
|
||||
static SkColor TiledContentLayerBorderColor();
|
||||
static int TiledContentLayerBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor ContentLayerBorderColor();
|
||||
static int ContentLayerBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int ContentLayerBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor MaskingLayerBorderColor();
|
||||
static int MaskingLayerBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor ContainerLayerBorderColor();
|
||||
static int ContainerLayerBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor SurfaceBorderColor();
|
||||
static int SurfaceBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int SurfaceBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor SurfaceReplicaBorderColor();
|
||||
static int SurfaceReplicaBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor TileBorderColor();
|
||||
static int TileBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int TileBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor MissingTileBorderColor();
|
||||
static int MissingTileBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int MissingTileBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor CulledTileBorderColor();
|
||||
static int CulledTileBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int CulledTileBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
|
||||
static SkColor DefaultCheckerboardColor();
|
||||
static SkColor EvictedTileCheckerboardColor();
|
||||
static SkColor InvalidatedTileCheckerboardColor();
|
||||
|
||||
static SkColor PaintRectBorderColor();
|
||||
static int PaintRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int PaintRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor PaintRectFillColor();
|
||||
|
||||
static SkColor PropertyChangedRectBorderColor();
|
||||
static int PropertyChangedRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int PropertyChangedRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor PropertyChangedRectFillColor();
|
||||
|
||||
static SkColor SurfaceDamageRectBorderColor();
|
||||
static int SurfaceDamageRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int SurfaceDamageRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor SurfaceDamageRectFillColor();
|
||||
|
||||
static SkColor ScreenSpaceLayerRectBorderColor();
|
||||
static int ScreenSpaceLayerRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor ScreenSpaceLayerRectFillColor();
|
||||
|
||||
static SkColor ScreenSpaceSurfaceReplicaRectBorderColor();
|
||||
static int ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor ScreenSpaceSurfaceReplicaRectFillColor();
|
||||
|
||||
static SkColor OccludingRectBorderColor();
|
||||
static int OccludingRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int OccludingRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor OccludingRectFillColor();
|
||||
|
||||
static SkColor NonOccludingRectBorderColor();
|
||||
static int NonOccludingRectBorderWidth(const LayerTreeHostImpl* host_impl);
|
||||
static int NonOccludingRectBorderWidth(const LayerTreeImpl* tree_impl);
|
||||
static SkColor NonOccludingRectFillColor();
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(DebugColors);
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace cc {
|
||||
|
||||
class LayerImpl;
|
||||
struct LayerTreeDebugState;
|
||||
class LayerTreeDebugState;
|
||||
|
||||
// There are currently six types of debug rects:
|
||||
//
|
||||
|
@ -11,8 +11,9 @@
|
||||
#include "cc/debug_rect_history.h"
|
||||
#include "cc/font_atlas.h"
|
||||
#include "cc/frame_rate_counter.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
#include "cc/quad_sink.h"
|
||||
#include "cc/renderer.h"
|
||||
#include "cc/texture_draw_quad.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
@ -146,7 +147,7 @@ bool HeadsUpDisplayLayerImpl::layerIsAlwaysDamaged() const
|
||||
|
||||
void HeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas)
|
||||
{
|
||||
const LayerTreeDebugState& debugState = layerTreeHostImpl()->debugState();
|
||||
const LayerTreeDebugState& debugState = layerTreeImpl()->debug_state();
|
||||
|
||||
if (debugState.showPlatformLayerTree) {
|
||||
SkPaint paint = createPaint();
|
||||
@ -157,15 +158,15 @@ void HeadsUpDisplayLayerImpl::drawHudContents(SkCanvas* canvas)
|
||||
int platformLayerTreeTop = 0;
|
||||
|
||||
if (debugState.showFPSCounter)
|
||||
platformLayerTreeTop = drawFPSCounter(canvas, layerTreeHostImpl()->fpsCounter());
|
||||
platformLayerTreeTop = drawFPSCounter(canvas, layerTreeImpl()->frame_rate_counter());
|
||||
|
||||
if (debugState.showPlatformLayerTree && m_fontAtlas) {
|
||||
std::string layerTree = layerTreeHostImpl()->layerTreeAsText();
|
||||
std::string layerTree = layerTreeImpl()->layer_tree_as_text();
|
||||
m_fontAtlas->drawText(canvas, createPaint(), layerTree, gfx::Point(2, platformLayerTreeTop), bounds());
|
||||
}
|
||||
|
||||
if (debugState.showHudRects())
|
||||
drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory());
|
||||
drawDebugRects(canvas, layerTreeImpl()->debug_rect_history());
|
||||
}
|
||||
|
||||
int HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter* fpsCounter)
|
||||
@ -312,7 +313,7 @@ void HeadsUpDisplayLayerImpl::drawFPSCounterGraphAndHistogram(SkCanvas* canvas,
|
||||
void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory)
|
||||
{
|
||||
const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects();
|
||||
float rectScale = 1 / layerTreeHostImpl()->deviceScaleFactor();
|
||||
float rectScale = 1 / layerTreeImpl()->device_scale_factor();
|
||||
|
||||
canvas->save();
|
||||
canvas->scale(rectScale, rectScale);
|
||||
@ -326,37 +327,37 @@ void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory*
|
||||
case PaintRectType:
|
||||
strokeColor = DebugColors::PaintRectBorderColor();
|
||||
fillColor = DebugColors::PaintRectFillColor();
|
||||
strokeWidth = DebugColors::PaintRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::PaintRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case PropertyChangedRectType:
|
||||
strokeColor = DebugColors::PropertyChangedRectBorderColor();
|
||||
fillColor = DebugColors::PropertyChangedRectFillColor();
|
||||
strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case SurfaceDamageRectType:
|
||||
strokeColor = DebugColors::SurfaceDamageRectBorderColor();
|
||||
fillColor = DebugColors::SurfaceDamageRectFillColor();
|
||||
strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case ReplicaScreenSpaceRectType:
|
||||
strokeColor = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor();
|
||||
fillColor = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor();
|
||||
strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case ScreenSpaceRectType:
|
||||
strokeColor = DebugColors::ScreenSpaceLayerRectBorderColor();
|
||||
fillColor = DebugColors::ScreenSpaceLayerRectFillColor();
|
||||
strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case OccludingRectType:
|
||||
strokeColor = DebugColors::OccludingRectBorderColor();
|
||||
fillColor = DebugColors::OccludingRectFillColor();
|
||||
strokeWidth = DebugColors::OccludingRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::OccludingRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
case NonOccludingRectType:
|
||||
strokeColor = DebugColors::NonOccludingRectBorderColor();
|
||||
fillColor = DebugColors::NonOccludingRectFillColor();
|
||||
strokeWidth = DebugColors::NonOccludingRectBorderWidth(layerTreeHostImpl());
|
||||
strokeWidth = DebugColors::NonOccludingRectBorderWidth(layerTreeImpl());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "base/stringprintf.h"
|
||||
#include "cc/gl_renderer.h" // For the GLC() macro.
|
||||
#include "cc/io_surface_draw_quad.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/quad_sink.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
||||
@ -29,7 +29,7 @@ IOSurfaceLayerImpl::~IOSurfaceLayerImpl()
|
||||
if (!m_ioSurfaceTextureId)
|
||||
return;
|
||||
|
||||
OutputSurface* outputSurface = layerTreeHostImpl()->outputSurface();
|
||||
OutputSurface* outputSurface = layerTreeImpl()->output_surface();
|
||||
// FIXME: Implement this path for software compositing.
|
||||
WebKit::WebGraphicsContext3D* context3d = outputSurface->Context3D();
|
||||
if (context3d)
|
||||
|
@ -9,8 +9,9 @@
|
||||
#include "base/values.h"
|
||||
#include "cc/debug_border_draw_quad.h"
|
||||
#include "cc/debug_colors.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_debug_state.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
#include "cc/layer_tree_settings.h"
|
||||
#include "cc/math_util.h"
|
||||
#include "cc/proxy.h"
|
||||
#include "cc/quad_sink.h"
|
||||
@ -68,9 +69,9 @@ LayerImpl::~LayerImpl()
|
||||
void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
|
||||
{
|
||||
child->setParent(this);
|
||||
DCHECK_EQ(layerTreeHostImpl(), child->layerTreeHostImpl());
|
||||
DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl());
|
||||
m_children.append(child.Pass());
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child)
|
||||
@ -79,7 +80,7 @@ scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child)
|
||||
if (m_children[i] == child) {
|
||||
scoped_ptr<LayerImpl> ret = m_children.take(i);
|
||||
m_children.remove(i);
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
return ret.Pass();
|
||||
}
|
||||
}
|
||||
@ -89,7 +90,7 @@ scoped_ptr<LayerImpl> LayerImpl::removeChild(LayerImpl* child)
|
||||
void LayerImpl::removeAllChildren()
|
||||
{
|
||||
m_children.clear();
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
void LayerImpl::clearChildList()
|
||||
@ -98,7 +99,7 @@ void LayerImpl::clearChildList()
|
||||
return;
|
||||
|
||||
m_children.clear();
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
void LayerImpl::createRenderSurface()
|
||||
@ -121,10 +122,6 @@ int LayerImpl::descendantsDrawContent()
|
||||
return result;
|
||||
}
|
||||
|
||||
LayerTreeHostImpl* LayerImpl::layerTreeHostImpl() const {
|
||||
return m_layerTreeImpl->layer_tree_host_impl();
|
||||
}
|
||||
|
||||
scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
|
||||
{
|
||||
scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
|
||||
@ -156,25 +153,25 @@ void LayerImpl::didDraw(ResourceProvider*)
|
||||
|
||||
bool LayerImpl::showDebugBorders() const
|
||||
{
|
||||
return layerTreeHostImpl()->debugState().showDebugBorders;
|
||||
return layerTreeImpl()->debug_state().showDebugBorders;
|
||||
}
|
||||
|
||||
void LayerImpl::getDebugBorderProperties(SkColor* color, float* width) const
|
||||
{
|
||||
if (m_drawsContent) {
|
||||
*color = DebugColors::ContentLayerBorderColor();
|
||||
*width = DebugColors::ContentLayerBorderWidth(layerTreeHostImpl());
|
||||
*width = DebugColors::ContentLayerBorderWidth(layerTreeImpl());
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_masksToBounds) {
|
||||
*color = DebugColors::MaskingLayerBorderColor();
|
||||
*width = DebugColors::MaskingLayerBorderWidth(layerTreeHostImpl());
|
||||
*width = DebugColors::MaskingLayerBorderWidth(layerTreeImpl());
|
||||
return;
|
||||
}
|
||||
|
||||
*color = DebugColors::ContainerLayerBorderColor();
|
||||
*width = DebugColors::ContainerLayerBorderWidth(layerTreeHostImpl());
|
||||
*width = DebugColors::ContainerLayerBorderWidth(layerTreeImpl());
|
||||
}
|
||||
|
||||
void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState* sharedQuadState, AppendQuadsData& appendQuadsData) const
|
||||
@ -271,7 +268,7 @@ InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const gfx::PointF& screenS
|
||||
|
||||
bool LayerImpl::drawCheckerboardForMissingTiles() const
|
||||
{
|
||||
return m_drawCheckerboardForMissingTiles && !layerTreeHostImpl()->settings().backgroundColorInsteadOfCheckerboard;
|
||||
return m_drawCheckerboardForMissingTiles && !layerTreeImpl()->settings().backgroundColorInsteadOfCheckerboard;
|
||||
}
|
||||
|
||||
gfx::Rect LayerImpl::layerRectToContentRect(const gfx::RectF& layerRect) const
|
||||
@ -414,13 +411,13 @@ bool LayerImpl::layerSurfacePropertyChanged() const
|
||||
void LayerImpl::noteLayerSurfacePropertyChanged()
|
||||
{
|
||||
m_layerSurfacePropertyChanged = true;
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
void LayerImpl::noteLayerPropertyChanged()
|
||||
{
|
||||
m_layerPropertyChanged = true;
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
void LayerImpl::noteLayerPropertyChangedForSubtree()
|
||||
@ -431,7 +428,7 @@ void LayerImpl::noteLayerPropertyChangedForSubtree()
|
||||
|
||||
void LayerImpl::noteLayerPropertyChangedForDescendants()
|
||||
{
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
for (size_t i = 0; i < m_children.size(); ++i)
|
||||
m_children[i]->noteLayerPropertyChangedForSubtree();
|
||||
}
|
||||
@ -507,7 +504,7 @@ void LayerImpl::setBounds(const gfx::Size& bounds)
|
||||
void LayerImpl::setMaskLayer(scoped_ptr<LayerImpl> maskLayer)
|
||||
{
|
||||
if (maskLayer)
|
||||
DCHECK_EQ(layerTreeHostImpl(), maskLayer->layerTreeHostImpl());
|
||||
DCHECK_EQ(layerTreeImpl(), maskLayer->layerTreeImpl());
|
||||
m_maskLayer = maskLayer.Pass();
|
||||
|
||||
int newLayerId = m_maskLayer ? m_maskLayer->id() : -1;
|
||||
@ -521,7 +518,7 @@ void LayerImpl::setMaskLayer(scoped_ptr<LayerImpl> maskLayer)
|
||||
void LayerImpl::setReplicaLayer(scoped_ptr<LayerImpl> replicaLayer)
|
||||
{
|
||||
if (replicaLayer)
|
||||
DCHECK_EQ(layerTreeHostImpl(), replicaLayer->layerTreeHostImpl());
|
||||
DCHECK_EQ(layerTreeImpl(), replicaLayer->layerTreeImpl());
|
||||
m_replicaLayer = replicaLayer.Pass();
|
||||
|
||||
int newLayerId = m_replicaLayer ? m_replicaLayer->id() : -1;
|
||||
@ -743,7 +740,7 @@ void LayerImpl::setMaxScrollOffset(gfx::Vector2d maxScrollOffset)
|
||||
return;
|
||||
m_maxScrollOffset = maxScrollOffset;
|
||||
|
||||
layerTreeHostImpl()->setNeedsUpdateDrawProperties();
|
||||
layerTreeImpl()->SetNeedsUpdateDrawProperties();
|
||||
|
||||
if (!m_scrollbarAnimationController)
|
||||
return;
|
||||
|
@ -82,7 +82,6 @@ public:
|
||||
bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
|
||||
|
||||
LayerTreeImpl* layerTreeImpl() const { return m_layerTreeImpl; }
|
||||
LayerTreeHostImpl* layerTreeHostImpl() const;
|
||||
|
||||
scoped_ptr<SharedQuadState> createSharedQuadState() const;
|
||||
// willDraw must be called before appendQuads. If willDraw is called,
|
||||
|
60
cc/layer_tree_debug_state.cc
Normal file
60
cc/layer_tree_debug_state.cc
Normal file
@ -0,0 +1,60 @@
|
||||
// Copyright 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cc/layer_tree_debug_state.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
LayerTreeDebugState::LayerTreeDebugState()
|
||||
: showFPSCounter(false)
|
||||
, showPlatformLayerTree(false)
|
||||
, showDebugBorders(false)
|
||||
, showPaintRects(false)
|
||||
, showPropertyChangedRects(false)
|
||||
, showSurfaceDamageRects(false)
|
||||
, showScreenSpaceRects(false)
|
||||
, showReplicaScreenSpaceRects(false)
|
||||
, showOccludingRects(false)
|
||||
, showNonOccludingRects(false) { }
|
||||
|
||||
LayerTreeDebugState::~LayerTreeDebugState() {
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::showHudInfo() const {
|
||||
return showFPSCounter || showPlatformLayerTree || showHudRects();
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::showHudRects() const {
|
||||
return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::hudNeedsFont() const {
|
||||
return showFPSCounter || showPlatformLayerTree;
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b) {
|
||||
return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0;
|
||||
}
|
||||
|
||||
LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, const LayerTreeDebugState& b) {
|
||||
LayerTreeDebugState r(a);
|
||||
|
||||
r.showFPSCounter |= b.showFPSCounter;
|
||||
r.showPlatformLayerTree |= b.showPlatformLayerTree;
|
||||
r.showDebugBorders |= b.showDebugBorders;
|
||||
|
||||
r.showPaintRects |= b.showPaintRects;
|
||||
r.showPropertyChangedRects |= b.showPropertyChangedRects;
|
||||
r.showSurfaceDamageRects |= b.showSurfaceDamageRects;
|
||||
r.showScreenSpaceRects |= b.showScreenSpaceRects;
|
||||
r.showReplicaScreenSpaceRects |= b.showReplicaScreenSpaceRects;
|
||||
r.showOccludingRects |= b.showOccludingRects;
|
||||
r.showNonOccludingRects |= b.showNonOccludingRects;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace cc
|
39
cc/layer_tree_debug_state.h
Normal file
39
cc/layer_tree_debug_state.h
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CC_LAYER_TREE_DEBUG_STATE_H_
|
||||
#define CC_LAYER_TREE_DEBUG_STATE_H_
|
||||
|
||||
#include "cc/cc_export.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
class CC_EXPORT LayerTreeDebugState {
|
||||
public:
|
||||
LayerTreeDebugState();
|
||||
~LayerTreeDebugState();
|
||||
|
||||
bool showFPSCounter;
|
||||
bool showPlatformLayerTree;
|
||||
bool showDebugBorders;
|
||||
|
||||
bool showPaintRects;
|
||||
bool showPropertyChangedRects;
|
||||
bool showSurfaceDamageRects;
|
||||
bool showScreenSpaceRects;
|
||||
bool showReplicaScreenSpaceRects;
|
||||
bool showOccludingRects;
|
||||
bool showNonOccludingRects;
|
||||
|
||||
bool showHudInfo() const;
|
||||
bool showHudRects() const;
|
||||
bool hudNeedsFont() const;
|
||||
|
||||
static bool equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b);
|
||||
static LayerTreeDebugState unite(const LayerTreeDebugState& a, const LayerTreeDebugState& b);
|
||||
};
|
||||
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_LAYER_TREE_DEBUG_STATE_H_
|
@ -37,114 +37,6 @@ namespace cc {
|
||||
|
||||
bool LayerTreeHost::s_needsFilterContext = false;
|
||||
|
||||
LayerTreeDebugState::LayerTreeDebugState()
|
||||
: showFPSCounter(false)
|
||||
, showPlatformLayerTree(false)
|
||||
, showDebugBorders(false)
|
||||
, showPaintRects(false)
|
||||
, showPropertyChangedRects(false)
|
||||
, showSurfaceDamageRects(false)
|
||||
, showScreenSpaceRects(false)
|
||||
, showReplicaScreenSpaceRects(false)
|
||||
, showOccludingRects(false)
|
||||
, showNonOccludingRects(false)
|
||||
{
|
||||
}
|
||||
|
||||
LayerTreeDebugState::~LayerTreeDebugState()
|
||||
{
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::showHudInfo() const
|
||||
{
|
||||
return showFPSCounter || showPlatformLayerTree || showHudRects();
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::showHudRects() const
|
||||
{
|
||||
return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::hudNeedsFont() const
|
||||
{
|
||||
return showFPSCounter || showPlatformLayerTree;
|
||||
}
|
||||
|
||||
bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b)
|
||||
{
|
||||
return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0;
|
||||
}
|
||||
|
||||
LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, const LayerTreeDebugState& b)
|
||||
{
|
||||
LayerTreeDebugState r(a);
|
||||
|
||||
r.showFPSCounter |= b.showFPSCounter;
|
||||
r.showPlatformLayerTree |= b.showPlatformLayerTree;
|
||||
r.showDebugBorders |= b.showDebugBorders;
|
||||
|
||||
r.showPaintRects |= b.showPaintRects;
|
||||
r.showPropertyChangedRects |= b.showPropertyChangedRects;
|
||||
r.showSurfaceDamageRects |= b.showSurfaceDamageRects;
|
||||
r.showScreenSpaceRects |= b.showScreenSpaceRects;
|
||||
r.showReplicaScreenSpaceRects |= b.showReplicaScreenSpaceRects;
|
||||
r.showOccludingRects |= b.showOccludingRects;
|
||||
r.showNonOccludingRects |= b.showNonOccludingRects;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
LayerTreeSettings::LayerTreeSettings()
|
||||
: acceleratePainting(false)
|
||||
, implSidePainting(false)
|
||||
, renderVSyncEnabled(true)
|
||||
, perTilePaintingEnabled(false)
|
||||
, partialSwapEnabled(false)
|
||||
, acceleratedAnimationEnabled(true)
|
||||
, pageScalePinchZoomEnabled(false)
|
||||
, backgroundColorInsteadOfCheckerboard(false)
|
||||
, showOverdrawInTracing(false)
|
||||
, refreshRate(0)
|
||||
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
|
||||
, numRasterThreads(1)
|
||||
, defaultTileSize(gfx::Size(256, 256))
|
||||
, maxUntiledLayerSize(gfx::Size(512, 512))
|
||||
, minimumOcclusionTrackingSize(gfx::Size(160, 160))
|
||||
{
|
||||
// TODO(danakj): Move this to chromium when we don't go through the WebKit API anymore.
|
||||
implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kEnableImplSidePainting);
|
||||
partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePartialSwap);
|
||||
backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(switches::kBackgroundColorInsteadOfCheckerboard);
|
||||
showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches::kTraceOverdraw);
|
||||
|
||||
initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
|
||||
initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
|
||||
initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
|
||||
initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
|
||||
initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
|
||||
initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
|
||||
|
||||
if (CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kNumRasterThreads)) {
|
||||
const size_t kMaxRasterThreads = 64;
|
||||
std::string num_raster_threads =
|
||||
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
||||
switches::kNumRasterThreads);
|
||||
int num_threads;
|
||||
if (base::StringToInt(num_raster_threads, &num_threads) &&
|
||||
num_threads > 0 && num_threads <= kMaxRasterThreads) {
|
||||
numRasterThreads = num_threads;
|
||||
} else {
|
||||
LOG(WARNING) << "Bad number of raster threads: " <<
|
||||
num_raster_threads;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LayerTreeSettings::~LayerTreeSettings()
|
||||
{
|
||||
}
|
||||
|
||||
RendererCapabilities::RendererCapabilities()
|
||||
: bestTextureFormat(0)
|
||||
, usingPartialSwap(false)
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "cc/cc_export.h"
|
||||
#include "cc/layer_tree_host_client.h"
|
||||
#include "cc/layer_tree_host_common.h"
|
||||
#include "cc/layer_tree_settings.h"
|
||||
#include "cc/occlusion_tracker.h"
|
||||
#include "cc/output_surface.h"
|
||||
#include "cc/prioritized_resource_manager.h"
|
||||
@ -49,52 +50,6 @@ class HeadsUpDisplayLayer;
|
||||
class Region;
|
||||
struct ScrollAndScaleSet;
|
||||
|
||||
struct CC_EXPORT LayerTreeDebugState {
|
||||
LayerTreeDebugState();
|
||||
~LayerTreeDebugState();
|
||||
|
||||
bool showFPSCounter;
|
||||
bool showPlatformLayerTree;
|
||||
bool showDebugBorders;
|
||||
|
||||
bool showPaintRects;
|
||||
bool showPropertyChangedRects;
|
||||
bool showSurfaceDamageRects;
|
||||
bool showScreenSpaceRects;
|
||||
bool showReplicaScreenSpaceRects;
|
||||
bool showOccludingRects;
|
||||
bool showNonOccludingRects;
|
||||
|
||||
bool showHudInfo() const;
|
||||
bool showHudRects() const;
|
||||
bool hudNeedsFont() const;
|
||||
|
||||
static bool equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b);
|
||||
static LayerTreeDebugState unite(const LayerTreeDebugState& a, const LayerTreeDebugState& b);
|
||||
};
|
||||
|
||||
struct CC_EXPORT LayerTreeSettings {
|
||||
LayerTreeSettings();
|
||||
~LayerTreeSettings();
|
||||
|
||||
bool acceleratePainting;
|
||||
bool implSidePainting;
|
||||
bool renderVSyncEnabled;
|
||||
bool perTilePaintingEnabled;
|
||||
bool partialSwapEnabled;
|
||||
bool acceleratedAnimationEnabled;
|
||||
bool pageScalePinchZoomEnabled;
|
||||
bool backgroundColorInsteadOfCheckerboard;
|
||||
bool showOverdrawInTracing;
|
||||
double refreshRate;
|
||||
size_t maxPartialTextureUpdates;
|
||||
size_t numRasterThreads;
|
||||
gfx::Size defaultTileSize;
|
||||
gfx::Size maxUntiledLayerSize;
|
||||
gfx::Size minimumOcclusionTrackingSize;
|
||||
|
||||
LayerTreeDebugState initialDebugState;
|
||||
};
|
||||
|
||||
// Provides information on an Impl's rendering capabilities back to the LayerTreeHost
|
||||
struct CC_EXPORT RendererCapabilities {
|
||||
|
@ -558,7 +558,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
|
||||
if (occlusionTracker.occluded(it->renderTarget(), it->visibleContentRect(), it->drawTransform(), implDrawTransformIsUnknown, it->drawableContentRect(), &hasOcclusionFromOutsideTargetSurface))
|
||||
appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
|
||||
else {
|
||||
DCHECK_EQ(this, it->layerTreeHostImpl());
|
||||
DCHECK_EQ(this->activeTree(), it->layerTreeImpl());
|
||||
it->willDraw(m_resourceProvider.get());
|
||||
frame.willDrawLayers.push_back(*it);
|
||||
|
||||
|
@ -265,6 +265,7 @@ public:
|
||||
FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
|
||||
DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
|
||||
ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
|
||||
|
||||
Proxy* proxy() const { return m_proxy; }
|
||||
|
||||
void setDebugState(const LayerTreeDebugState& debugState) { m_debugState = debugState; }
|
||||
|
@ -2653,7 +2653,7 @@ public:
|
||||
virtual void appendQuads(QuadSink& quadSink, AppendQuadsData&) OVERRIDE
|
||||
{
|
||||
ASSERT_TRUE(m_hasTexture);
|
||||
ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources());
|
||||
ASSERT_NE(0u, layerTreeImpl()->resource_provider()->numResources());
|
||||
}
|
||||
|
||||
void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; }
|
||||
|
@ -68,4 +68,57 @@ void LayerTreeImpl::ClearCurrentlyScrollingLayer() {
|
||||
scrolling_layer_id_from_previous_tree_ = 0;
|
||||
}
|
||||
|
||||
const LayerTreeSettings& LayerTreeImpl::settings() const {
|
||||
return layer_tree_host_impl_->settings();
|
||||
}
|
||||
|
||||
OutputSurface* LayerTreeImpl::output_surface() const {
|
||||
return layer_tree_host_impl_->outputSurface();
|
||||
}
|
||||
|
||||
ResourceProvider* LayerTreeImpl::resource_provider() const {
|
||||
return layer_tree_host_impl_->resourceProvider();
|
||||
}
|
||||
|
||||
TileManager* LayerTreeImpl::tile_manager() const {
|
||||
return layer_tree_host_impl_->tileManager();
|
||||
}
|
||||
|
||||
FrameRateCounter* LayerTreeImpl::frame_rate_counter() const {
|
||||
return layer_tree_host_impl_->fpsCounter();
|
||||
}
|
||||
|
||||
void LayerTreeImpl::SetNeedsRedraw() {
|
||||
layer_tree_host_impl_->setNeedsRedraw();
|
||||
}
|
||||
|
||||
void LayerTreeImpl::SetNeedsUpdateDrawProperties() {
|
||||
layer_tree_host_impl_->setNeedsUpdateDrawProperties();
|
||||
}
|
||||
|
||||
const LayerTreeDebugState& LayerTreeImpl::debug_state() const {
|
||||
return layer_tree_host_impl_->debugState();
|
||||
}
|
||||
|
||||
float LayerTreeImpl::device_scale_factor() const {
|
||||
return layer_tree_host_impl_->deviceScaleFactor();
|
||||
}
|
||||
|
||||
const gfx::Size& LayerTreeImpl::device_viewport_size() const {
|
||||
return layer_tree_host_impl_->deviceViewportSize();
|
||||
}
|
||||
|
||||
const gfx::Size& LayerTreeImpl::layout_viewport_size() const {
|
||||
return layer_tree_host_impl_->layoutViewportSize();
|
||||
}
|
||||
|
||||
std::string LayerTreeImpl::layer_tree_as_text() const {
|
||||
return layer_tree_host_impl_->layerTreeAsText();
|
||||
}
|
||||
|
||||
DebugRectHistory* LayerTreeImpl::debug_rect_history() const {
|
||||
return layer_tree_host_impl_->debugRectHistory();
|
||||
}
|
||||
|
||||
|
||||
} // namespace cc
|
||||
|
@ -9,9 +9,16 @@
|
||||
|
||||
namespace cc {
|
||||
|
||||
class DebugRectHistory;
|
||||
class FrameRateCounter;
|
||||
class HeadsUpDisplayLayerImpl;
|
||||
class LayerTreeDebugState;
|
||||
class LayerTreeHostImpl;
|
||||
class LayerTreeImpl;
|
||||
class HeadsUpDisplayLayerImpl;
|
||||
class LayerTreeSettings;
|
||||
class OutputSurface;
|
||||
class ResourceProvider;
|
||||
class TileManager;
|
||||
|
||||
class CC_EXPORT LayerTreeImpl {
|
||||
public:
|
||||
@ -21,10 +28,27 @@ class CC_EXPORT LayerTreeImpl {
|
||||
}
|
||||
virtual ~LayerTreeImpl();
|
||||
|
||||
// Methods called by the layer tree.
|
||||
// Methods called by the layer tree that pass-through to LHTI.
|
||||
// ---------------------------------------------------------------------------
|
||||
// TODO(nduca): Remove this and have layers call through this class.
|
||||
LayerTreeHostImpl* layer_tree_host_impl() const { return layer_tree_host_impl_; }
|
||||
const LayerTreeSettings& settings() const;
|
||||
OutputSurface* output_surface() const;
|
||||
ResourceProvider* resource_provider() const;
|
||||
TileManager* tile_manager() const;
|
||||
FrameRateCounter* frame_rate_counter() const;
|
||||
|
||||
// Tree specific methods exposed to layer-impl tree.
|
||||
// ---------------------------------------------------------------------------
|
||||
void SetNeedsRedraw();
|
||||
void SetNeedsUpdateDrawProperties();
|
||||
|
||||
// TODO(nduca): These are implemented in cc files temporarily, but will become
|
||||
// trivial accessors in a followup patch.
|
||||
const LayerTreeDebugState& debug_state() const;
|
||||
float device_scale_factor() const;
|
||||
const gfx::Size& device_viewport_size() const;
|
||||
const gfx::Size& layout_viewport_size() const;
|
||||
std::string layer_tree_as_text() const;
|
||||
DebugRectHistory* debug_rect_history() const;
|
||||
|
||||
// Other public methods
|
||||
// ---------------------------------------------------------------------------
|
||||
|
67
cc/layer_tree_settings.cc
Normal file
67
cc/layer_tree_settings.cc
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cc/layer_tree_settings.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/string_number_conversions.h"
|
||||
#include "cc/switches.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
LayerTreeSettings::LayerTreeSettings()
|
||||
: acceleratePainting(false)
|
||||
, implSidePainting(false)
|
||||
, renderVSyncEnabled(true)
|
||||
, perTilePaintingEnabled(false)
|
||||
, partialSwapEnabled(false)
|
||||
, acceleratedAnimationEnabled(true)
|
||||
, pageScalePinchZoomEnabled(false)
|
||||
, backgroundColorInsteadOfCheckerboard(false)
|
||||
, showOverdrawInTracing(false)
|
||||
, refreshRate(0)
|
||||
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
|
||||
, numRasterThreads(1)
|
||||
, defaultTileSize(gfx::Size(256, 256))
|
||||
, maxUntiledLayerSize(gfx::Size(512, 512))
|
||||
, minimumOcclusionTrackingSize(gfx::Size(160, 160))
|
||||
{
|
||||
// TODO(danakj): Move this to chromium when we don't go through the WebKit API anymore.
|
||||
implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kEnableImplSidePainting);
|
||||
partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePartialSwap);
|
||||
backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(switches::kBackgroundColorInsteadOfCheckerboard);
|
||||
showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches::kTraceOverdraw);
|
||||
|
||||
initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
|
||||
initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
|
||||
initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
|
||||
initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
|
||||
initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
|
||||
initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
|
||||
|
||||
if (CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kNumRasterThreads)) {
|
||||
const size_t kMaxRasterThreads = 64;
|
||||
std::string num_raster_threads =
|
||||
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
||||
switches::kNumRasterThreads);
|
||||
int num_threads;
|
||||
if (base::StringToInt(num_raster_threads, &num_threads) &&
|
||||
num_threads > 0 && num_threads <= kMaxRasterThreads) {
|
||||
numRasterThreads = num_threads;
|
||||
} else {
|
||||
LOG(WARNING) << "Bad number of raster threads: " <<
|
||||
num_raster_threads;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LayerTreeSettings::~LayerTreeSettings()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace cc
|
41
cc/layer_tree_settings.h
Normal file
41
cc/layer_tree_settings.h
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CC_LAYER_TREE_SETTINGS_H_
|
||||
#define CC_LAYER_TREE_SETTINGS_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "cc/cc_export.h"
|
||||
#include "cc/layer_tree_debug_state.h"
|
||||
#include "ui/gfx/size.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
class CC_EXPORT LayerTreeSettings {
|
||||
public:
|
||||
LayerTreeSettings();
|
||||
~LayerTreeSettings();
|
||||
|
||||
bool acceleratePainting;
|
||||
bool implSidePainting;
|
||||
bool renderVSyncEnabled;
|
||||
bool perTilePaintingEnabled;
|
||||
bool partialSwapEnabled;
|
||||
bool acceleratedAnimationEnabled;
|
||||
bool pageScalePinchZoomEnabled;
|
||||
bool backgroundColorInsteadOfCheckerboard;
|
||||
bool showOverdrawInTracing;
|
||||
double refreshRate;
|
||||
size_t maxPartialTextureUpdates;
|
||||
size_t numRasterThreads;
|
||||
gfx::Size defaultTileSize;
|
||||
gfx::Size maxUntiledLayerSize;
|
||||
gfx::Size minimumOcclusionTrackingSize;
|
||||
|
||||
LayerTreeDebugState initialDebugState;
|
||||
};
|
||||
|
||||
} // namespace cc
|
||||
|
||||
#endif // CC_LAYER_TREE_SETTINGS_H_
|
@ -9,7 +9,7 @@
|
||||
#include "cc/checkerboard_draw_quad.h"
|
||||
#include "cc/debug_border_draw_quad.h"
|
||||
#include "cc/debug_colors.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
#include "cc/math_util.h"
|
||||
#include "cc/quad_sink.h"
|
||||
#include "cc/solid_color_draw_quad.h"
|
||||
@ -58,10 +58,10 @@ void PictureLayerImpl::appendQuads(QuadSink& quadSink,
|
||||
float width;
|
||||
if (*iter && iter->GetResourceId()) {
|
||||
color = DebugColors::TileBorderColor();
|
||||
width = DebugColors::TileBorderWidth(layerTreeHostImpl());
|
||||
width = DebugColors::TileBorderWidth(layerTreeImpl());
|
||||
} else {
|
||||
color = DebugColors::MissingTileBorderColor();
|
||||
width = DebugColors::MissingTileBorderWidth(layerTreeHostImpl());
|
||||
width = DebugColors::MissingTileBorderWidth(layerTreeImpl());
|
||||
}
|
||||
|
||||
scoped_ptr<DebugBorderDrawQuad> debugBorderQuad =
|
||||
@ -131,7 +131,7 @@ void PictureLayerImpl::didUpdateTransforms() {
|
||||
if (drawsContent()) {
|
||||
// TODO(enne): Add more tilings during pinch zoom.
|
||||
if (!tilings_.num_tilings()) {
|
||||
gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize;
|
||||
gfx::Size tile_size = layerTreeImpl()->settings().defaultTileSize;
|
||||
tilings_.AddTiling(contentsScaleX(), tile_size);
|
||||
// TODO(enne): handle invalidations, create new tiles
|
||||
}
|
||||
@ -149,7 +149,7 @@ void PictureLayerImpl::didUpdateTransforms() {
|
||||
last_content_scale_y_ == contentsScaleY()) {
|
||||
time_delta = current_time - last_update_time_;
|
||||
}
|
||||
tilings_.UpdateTilePriorities(layerTreeHostImpl()->deviceViewportSize(),
|
||||
tilings_.UpdateTilePriorities(layerTreeImpl()->device_viewport_size(),
|
||||
contentsScaleX(),
|
||||
contentsScaleY(),
|
||||
last_screen_space_transform_,
|
||||
@ -170,7 +170,7 @@ void PictureLayerImpl::didUpdateBounds() {
|
||||
|
||||
scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
|
||||
gfx::Rect rect) {
|
||||
TileManager* tile_manager = layerTreeHostImpl()->tileManager();
|
||||
TileManager* tile_manager = layerTreeImpl()->tile_manager();
|
||||
|
||||
return make_scoped_refptr(new Tile(
|
||||
tile_manager,
|
||||
|
@ -50,7 +50,7 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx::
|
||||
if (keepQuad) {
|
||||
if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visible_rect != drawQuad->rect) {
|
||||
SkColor color = DebugColors::CulledTileBorderColor();
|
||||
float width = DebugColors::CulledTileBorderWidth(layer ? layer->layerTreeHostImpl() : NULL);
|
||||
float width = DebugColors::CulledTileBorderWidth(layer ? layer->layerTreeImpl() : NULL);
|
||||
scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQuad::Create();
|
||||
debugBorderQuad->SetNew(drawQuad->shared_quad_state, drawQuad->visible_rect, color, width);
|
||||
quadList.append(debugBorderQuad.PassAs<DrawQuad>());
|
||||
|
@ -203,7 +203,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
|
||||
|
||||
if (m_owningLayer->showDebugBorders()) {
|
||||
SkColor color = forReplica ? DebugColors::SurfaceReplicaBorderColor() : DebugColors::SurfaceBorderColor();
|
||||
float width = forReplica ? DebugColors::SurfaceReplicaBorderWidth(m_owningLayer->layerTreeHostImpl()) : DebugColors::SurfaceBorderWidth(m_owningLayer->layerTreeHostImpl());
|
||||
float width = forReplica ? DebugColors::SurfaceReplicaBorderWidth(m_owningLayer->layerTreeImpl()) : DebugColors::SurfaceBorderWidth(m_owningLayer->layerTreeImpl());
|
||||
scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQuad::Create();
|
||||
debugBorderQuad->SetNew(sharedQuadState, contentRect(), color, width);
|
||||
quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsData);
|
||||
|
@ -112,7 +112,7 @@ DrawableTile* TiledLayerImpl::createTile(int i, int j)
|
||||
void TiledLayerImpl::getDebugBorderProperties(SkColor* color, float* width) const
|
||||
{
|
||||
*color = DebugColors::TiledContentLayerBorderColor();
|
||||
*width = DebugColors::TiledContentLayerBorderWidth(layerTreeHostImpl());
|
||||
*width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl());
|
||||
}
|
||||
|
||||
void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData)
|
||||
@ -138,10 +138,10 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
|
||||
|
||||
if (m_skipsDraw || !tile || !tile->resourceId()) {
|
||||
borderColor = DebugColors::MissingTileBorderColor();
|
||||
borderWidth = DebugColors::MissingTileBorderWidth(layerTreeHostImpl());
|
||||
borderWidth = DebugColors::MissingTileBorderWidth(layerTreeImpl());
|
||||
} else {
|
||||
borderColor = DebugColors::TileBorderColor();
|
||||
borderWidth = DebugColors::TileBorderWidth(layerTreeHostImpl());
|
||||
borderWidth = DebugColors::TileBorderWidth(layerTreeImpl());
|
||||
}
|
||||
scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQuad::Create();
|
||||
debugBorderQuad->SetNew(sharedQuadState, tileRect, borderColor, borderWidth);
|
||||
|
@ -6,9 +6,10 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "cc/io_surface_draw_quad.h"
|
||||
#include "cc/layer_tree_host_impl.h"
|
||||
#include "cc/layer_tree_impl.h"
|
||||
#include "cc/math_util.h"
|
||||
#include "cc/quad_sink.h"
|
||||
#include "cc/renderer.h"
|
||||
#include "cc/resource_provider.h"
|
||||
#include "cc/stream_video_draw_quad.h"
|
||||
#include "cc/texture_draw_quad.h"
|
||||
@ -51,7 +52,7 @@ VideoLayerImpl::~VideoLayerImpl()
|
||||
m_provider->setVideoFrameProviderClient(0);
|
||||
m_provider = 0;
|
||||
}
|
||||
freePlaneData(layerTreeHostImpl()->resourceProvider());
|
||||
freePlaneData(layerTreeImpl()->resource_provider());
|
||||
|
||||
#ifndef NDEBUG
|
||||
for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; ++i)
|
||||
@ -412,12 +413,12 @@ void VideoLayerImpl::didUpdateMatrix(const float matrix[16])
|
||||
|
||||
void VideoLayerImpl::didLoseOutputSurface()
|
||||
{
|
||||
freePlaneData(layerTreeHostImpl()->resourceProvider());
|
||||
freePlaneData(layerTreeImpl()->resource_provider());
|
||||
}
|
||||
|
||||
void VideoLayerImpl::setNeedsRedraw()
|
||||
{
|
||||
layerTreeHostImpl()->setNeedsRedraw();
|
||||
layerTreeImpl()->SetNeedsRedraw();
|
||||
}
|
||||
|
||||
const char* VideoLayerImpl::layerTypeAsString() const
|
||||
|
Reference in New Issue
Block a user