Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: cc/tiled_layer.cc

Issue 11143027: cc: Remove wtf includes from *LayerTextureUpdater headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Out of line CBCLTU dtor Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/tiled_layer_test_common.cc ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 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 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 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "TiledLayerChromium.h" 7 #include "TiledLayerChromium.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "CCLayerImpl.h" 10 #include "CCLayerImpl.h"
11 #include "CCLayerTreeHost.h" 11 #include "CCLayerTreeHost.h"
12 #include "CCOverdrawMetrics.h" 12 #include "CCOverdrawMetrics.h"
13 #include "CCTextureUpdateQueue.h" 13 #include "CCTextureUpdateQueue.h"
14 #include "CCTiledLayerImpl.h" 14 #include "CCTiledLayerImpl.h"
15 #include "Region.h" 15 #include "Region.h"
16 16
17 using namespace std; 17 using namespace std;
18 using WebKit::WebTransformationMatrix; 18 using WebKit::WebTransformationMatrix;
19 19
20 namespace cc { 20 namespace cc {
21 21
22 class UpdatableTile : public CCLayerTilingData::Tile { 22 class UpdatableTile : public CCLayerTilingData::Tile {
23 public: 23 public:
24 static scoped_ptr<UpdatableTile> create(PassOwnPtr<LayerTextureUpdater::Text ure> texture) 24 static scoped_ptr<UpdatableTile> create(scoped_ptr<LayerTextureUpdater::Text ure> texture)
25 { 25 {
26 return make_scoped_ptr(new UpdatableTile(texture)); 26 return make_scoped_ptr(new UpdatableTile(texture.Pass()));
27 } 27 }
28 28
29 LayerTextureUpdater::Texture* texture() { return m_texture.get(); } 29 LayerTextureUpdater::Texture* texture() { return m_texture.get(); }
30 CCPrioritizedTexture* managedTexture() { return m_texture->texture(); } 30 CCPrioritizedTexture* managedTexture() { return m_texture->texture(); }
31 31
32 bool isDirty() const { return !dirtyRect.isEmpty(); } 32 bool isDirty() const { return !dirtyRect.isEmpty(); }
33 33
34 // Reset update state for the current frame. This should occur before painti ng 34 // Reset update state for the current frame. This should occur before painti ng
35 // for all layers. Since painting one layer can invalidate another layer 35 // for all layers. Since painting one layer can invalidate another layer
36 // after it has already painted, mark all non-dirty tiles as valid before pa inting 36 // after it has already painted, mark all non-dirty tiles as valid before pa inting
(...skipping 15 matching lines...) Expand all
52 updateRect = dirtyRect; 52 updateRect = dirtyRect;
53 dirtyRect = IntRect(); 53 dirtyRect = IntRect();
54 } 54 }
55 55
56 IntRect dirtyRect; 56 IntRect dirtyRect;
57 IntRect updateRect; 57 IntRect updateRect;
58 bool partialUpdate; 58 bool partialUpdate;
59 bool validForFrame; 59 bool validForFrame;
60 bool occluded; 60 bool occluded;
61 bool isInUseOnImpl; 61 bool isInUseOnImpl;
62
62 private: 63 private:
63 explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) 64 explicit UpdatableTile(scoped_ptr<LayerTextureUpdater::Texture> texture)
64 : partialUpdate(false) 65 : partialUpdate(false)
65 , validForFrame(false) 66 , validForFrame(false)
66 , occluded(false) 67 , occluded(false)
67 , isInUseOnImpl(false) 68 , isInUseOnImpl(false)
68 , m_texture(texture) 69 , m_texture(texture.Pass())
69 { 70 {
70 } 71 }
71 72
72 OwnPtr<LayerTextureUpdater::Texture> m_texture; 73 scoped_ptr<LayerTextureUpdater::Texture> m_texture;
73 74
74 DISALLOW_COPY_AND_ASSIGN(UpdatableTile); 75 DISALLOW_COPY_AND_ASSIGN(UpdatableTile);
75 }; 76 };
76 77
77 TiledLayerChromium::TiledLayerChromium() 78 TiledLayerChromium::TiledLayerChromium()
78 : LayerChromium() 79 : LayerChromium()
79 , m_textureFormat(GraphicsContext3D::INVALID_ENUM) 80 , m_textureFormat(GraphicsContext3D::INVALID_ENUM)
80 , m_skipsDraw(false) 81 , m_skipsDraw(false)
81 , m_failedUpdate(false) 82 , m_failedUpdate(false)
82 , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid) 83 , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid)
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // The updateRect should be in layer space. So we have to convert the paintR ect from content space to layer space. 452 // The updateRect should be in layer space. So we have to convert the paintR ect from content space to layer space.
452 m_updateRect = FloatRect(paintRect); 453 m_updateRect = FloatRect(paintRect);
453 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid th()); 454 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid th());
454 float heightScale = bounds().height() / static_cast<float>(contentBounds().h eight()); 455 float heightScale = bounds().height() / static_cast<float>(contentBounds().h eight());
455 m_updateRect.scale(widthScale, heightScale); 456 m_updateRect.scale(widthScale, heightScale);
456 457
457 // Calling prepareToUpdate() calls into WebKit to paint, which may have the side 458 // Calling prepareToUpdate() calls into WebKit to paint, which may have the side
458 // effect of disabling compositing, which causes our reference to the textur e updater to be deleted. 459 // effect of disabling compositing, which causes our reference to the textur e updater to be deleted.
459 // However, we can't free the memory backing the SkCanvas until the paint fi nishes, 460 // However, we can't free the memory backing the SkCanvas until the paint fi nishes,
460 // so we grab a local reference here to hold the updater alive until the pai nt completes. 461 // so we grab a local reference here to hold the updater alive until the pai nt completes.
461 RefPtr<LayerTextureUpdater> protector(textureUpdater()); 462 scoped_refptr<LayerTextureUpdater> protector(textureUpdater());
462 IntRect paintedOpaqueRect; 463 IntRect paintedOpaqueRect;
463 textureUpdater()->prepareToUpdate(paintRect, m_tiler->tileSize(), 1 / widthS cale, 1 / heightScale, paintedOpaqueRect, stats); 464 textureUpdater()->prepareToUpdate(paintRect, m_tiler->tileSize(), 1 / widthS cale, 1 / heightScale, paintedOpaqueRect, stats);
464 465
465 for (int j = top; j <= bottom; ++j) { 466 for (int j = top; j <= bottom; ++j) {
466 for (int i = left; i <= right; ++i) { 467 for (int i = left; i <= right; ++i) {
467 UpdatableTile* tile = tileAt(i, j); 468 UpdatableTile* tile = tileAt(i, j);
468 ASSERT(tile); // Did setTexturePriorites get skipped? 469 ASSERT(tile); // Did setTexturePriorites get skipped?
469 // FIXME: This should not ever be null. 470 // FIXME: This should not ever be null.
470 if (!tile) 471 if (!tile)
471 continue; 472 continue;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 IntRect prepaintRect = visibleContentRect(); 779 IntRect prepaintRect = visibleContentRect();
779 prepaintRect.inflateX(m_tiler->tileSize().width()); 780 prepaintRect.inflateX(m_tiler->tileSize().width());
780 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); 781 prepaintRect.inflateY(m_tiler->tileSize().height() * 2);
781 IntRect contentRect(IntPoint::zero(), contentBounds()); 782 IntRect contentRect(IntPoint::zero(), contentBounds());
782 prepaintRect.intersect(contentRect); 783 prepaintRect.intersect(contentRect);
783 784
784 return prepaintRect; 785 return prepaintRect;
785 } 786 }
786 787
787 } 788 }
OLDNEW
« no previous file with comments | « cc/test/tiled_layer_test_common.cc ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698