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 |
| 5 #ifndef CCOcclusionTrackerTestCommon_h |
| 6 #define CCOcclusionTrackerTestCommon_h |
| 7 |
| 8 #include "CCOcclusionTracker.h" |
| 9 #include "CCRenderSurface.h" |
| 10 #include "IntRect.h" |
| 11 #include "Region.h" |
| 12 #include "RenderSurfaceChromium.h" |
| 13 |
| 14 namespace WebKitTests { |
| 15 |
| 16 // A subclass to expose the total current occlusion. |
| 17 template<typename LayerType, typename RenderSurfaceType> |
| 18 class TestCCOcclusionTrackerBase : public cc::CCOcclusionTrackerBase<LayerType,
RenderSurfaceType> { |
| 19 public: |
| 20 TestCCOcclusionTrackerBase(cc::IntRect screenScissorRect, bool recordMetrics
ForFrame = false) |
| 21 : cc::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissor
Rect, recordMetricsForFrame) |
| 22 { |
| 23 } |
| 24 |
| 25 cc::Region occlusionInScreenSpace() const { return cc::CCOcclusionTrackerBas
e<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; } |
| 26 cc::Region occlusionInTargetSurface() const { return cc::CCOcclusionTrackerB
ase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; } |
| 27 |
| 28 void setOcclusionInScreenSpace(const cc::Region& region) { cc::CCOcclusionTr
ackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = regi
on; } |
| 29 void setOcclusionInTargetSurface(const cc::Region& region) { cc::CCOcclusion
TrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = re
gion; } |
| 30 }; |
| 31 |
| 32 typedef TestCCOcclusionTrackerBase<cc::LayerChromium, cc::RenderSurfaceChromium>
TestCCOcclusionTracker; |
| 33 typedef TestCCOcclusionTrackerBase<cc::CCLayerImpl, cc::CCRenderSurface> TestCCO
cclusionTrackerImpl; |
| 34 |
| 35 } |
| 36 |
| 37 #endif // CCOcclusionTrackerTestCommon_h |
OLD | NEW |