Remove extra line from unit_tests.isolate
[chromium-blink-merge.git] / cc / TiledLayerChromium.h
blob016ea1bed8c463896b50ca5ab5b8d9e55ade2568
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 #ifndef TiledLayerChromium_h
6 #define TiledLayerChromium_h
8 #if USE(ACCELERATED_COMPOSITING)
10 #include "CCLayerTilingData.h"
11 #include "LayerChromium.h"
12 #include "LayerTextureUpdater.h"
14 namespace cc {
15 class UpdatableTile;
17 class TiledLayerChromium : public LayerChromium {
18 public:
19 enum TilingOption { AlwaysTile, NeverTile, AutoTile };
21 virtual void setIsMask(bool) OVERRIDE;
23 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
25 virtual bool drawsContent() const OVERRIDE;
26 virtual bool needsContentsScale() const OVERRIDE;
28 virtual IntSize contentBounds() const OVERRIDE;
30 virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
32 virtual void setUseLCDText(bool) OVERRIDE;
34 virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
36 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
38 virtual Region visibleContentOpaqueRegion() const OVERRIDE;
40 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
42 protected:
43 TiledLayerChromium();
44 virtual ~TiledLayerChromium();
46 void updateTileSizeAndTilingOption();
47 void updateBounds();
49 // Exposed to subclasses for testing.
50 void setTileSize(const IntSize&);
51 void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFormat; }
52 void setBorderTexelOption(CCLayerTilingData::BorderTexelOption);
53 void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; }
54 size_t numPaintedTiles() { return m_tiler->tiles().size(); }
56 virtual LayerTextureUpdater* textureUpdater() const = 0;
57 virtual void createTextureUpdaterIfNeeded() = 0;
59 // Set invalidations to be potentially repainted during update().
60 void invalidateContentRect(const IntRect& contentRect);
62 // Reset state on tiles that will be used for updating the layer.
63 void resetUpdateState();
65 // After preparing an update, returns true if more painting is needed.
66 bool needsIdlePaint();
67 IntRect idlePaintRect();
69 bool skipsDraw() const { return m_skipsDraw; }
71 // Virtual for testing
72 virtual CCPrioritizedTextureManager* textureManager() const;
74 private:
75 virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
77 void createTilerIfNeeded();
78 void setTilingOption(TilingOption);
80 bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
81 bool tileNeedsBufferedUpdate(UpdatableTile*);
83 void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*);
85 bool updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&, bool& didPaint);
86 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
87 IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
88 void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&);
90 UpdatableTile* tileAt(int, int) const;
91 UpdatableTile* createTile(int, int);
93 GC3Denum m_textureFormat;
94 bool m_skipsDraw;
95 bool m_failedUpdate;
96 LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
98 TilingOption m_tilingOption;
99 OwnPtr<CCLayerTilingData> m_tiler;
103 #endif // USE(ACCELERATED_COMPOSITING)
105 #endif