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

Side by Side Diff: cc/io_surface_layer_impl.cc

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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/io_surface_layer_impl.h ('k') | cc/layer.h » ('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 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 4
5 #include "cc/io_surface_layer_impl.h" 5 #include "cc/io_surface_layer_impl.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "cc/gl_renderer.h" // For the GLC() macro. 8 #include "cc/gl_renderer.h" // For the GLC() macro.
9 #include "cc/io_surface_draw_quad.h" 9 #include "cc/io_surface_draw_quad.h"
10 #include "cc/layer_tree_impl.h" 10 #include "cc/layer_tree_impl.h"
(...skipping 12 matching lines...) Expand all
23 , m_ioSurfaceChanged(false) 23 , m_ioSurfaceChanged(false)
24 , m_ioSurfaceTextureId(0) 24 , m_ioSurfaceTextureId(0)
25 { 25 {
26 } 26 }
27 27
28 IOSurfaceLayerImpl::~IOSurfaceLayerImpl() 28 IOSurfaceLayerImpl::~IOSurfaceLayerImpl()
29 { 29 {
30 if (!m_ioSurfaceTextureId) 30 if (!m_ioSurfaceTextureId)
31 return; 31 return;
32 32
33 OutputSurface* outputSurface = layerTreeImpl()->output_surface(); 33 OutputSurface* outputSurface = layer_tree_impl()->output_surface();
34 // FIXME: Implement this path for software compositing. 34 // FIXME: Implement this path for software compositing.
35 WebKit::WebGraphicsContext3D* context3d = outputSurface->context3d(); 35 WebKit::WebGraphicsContext3D* context3d = outputSurface->context3d();
36 if (context3d) 36 if (context3d)
37 context3d->deleteTexture(m_ioSurfaceTextureId); 37 context3d->deleteTexture(m_ioSurfaceTextureId);
38 } 38 }
39 39
40 scoped_ptr<LayerImpl> IOSurfaceLayerImpl::createLayerImpl(LayerTreeImpl* treeImp l) 40 scoped_ptr<LayerImpl> IOSurfaceLayerImpl::CreateLayerImpl(LayerTreeImpl* treeImp l)
41 { 41 {
42 return IOSurfaceLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); 42 return IOSurfaceLayerImpl::Create(treeImpl, id()).PassAs<LayerImpl>();
43 } 43 }
44 44
45 void IOSurfaceLayerImpl::pushPropertiesTo(LayerImpl* layer) 45 void IOSurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer)
46 { 46 {
47 LayerImpl::pushPropertiesTo(layer); 47 LayerImpl::PushPropertiesTo(layer);
48 48
49 IOSurfaceLayerImpl* ioSurfaceLayer = static_cast<IOSurfaceLayerImpl*>(layer) ; 49 IOSurfaceLayerImpl* ioSurfaceLayer = static_cast<IOSurfaceLayerImpl*>(layer) ;
50 ioSurfaceLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); 50 ioSurfaceLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize);
51 } 51 }
52 52
53 void IOSurfaceLayerImpl::willDraw(ResourceProvider* resourceProvider) 53 void IOSurfaceLayerImpl::WillDraw(ResourceProvider* resourceProvider)
54 { 54 {
55 LayerImpl::willDraw(resourceProvider); 55 LayerImpl::WillDraw(resourceProvider);
56 56
57 if (m_ioSurfaceChanged) { 57 if (m_ioSurfaceChanged) {
58 WebKit::WebGraphicsContext3D* context3d = resourceProvider->GraphicsCont ext3D(); 58 WebKit::WebGraphicsContext3D* context3d = resourceProvider->GraphicsCont ext3D();
59 if (!context3d) { 59 if (!context3d) {
60 // FIXME: Implement this path for software compositing. 60 // FIXME: Implement this path for software compositing.
61 return; 61 return;
62 } 62 }
63 63
64 // FIXME: Do this in a way that we can track memory usage. 64 // FIXME: Do this in a way that we can track memory usage.
65 if (!m_ioSurfaceTextureId) 65 if (!m_ioSurfaceTextureId)
(...skipping 13 matching lines...) Expand all
79 // Do not check for error conditions. texImageIOSurface2DCHROMIUM is sup posed to hold on to 79 // Do not check for error conditions. texImageIOSurface2DCHROMIUM is sup posed to hold on to
80 // the last good IOSurface if the new one is already closed. This is onl y a possibility 80 // the last good IOSurface if the new one is already closed. This is onl y a possibility
81 // during live resizing of plugins. However, it seems that this is not s ufficient to 81 // during live resizing of plugins. However, it seems that this is not s ufficient to
82 // completely guard against garbage being drawn. If this is found to be a significant issue, 82 // completely guard against garbage being drawn. If this is found to be a significant issue,
83 // it may be necessary to explicitly tell the embedder when to free the surfaces it has 83 // it may be necessary to explicitly tell the embedder when to free the surfaces it has
84 // allocated. 84 // allocated.
85 m_ioSurfaceChanged = false; 85 m_ioSurfaceChanged = false;
86 } 86 }
87 } 87 }
88 88
89 void IOSurfaceLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append QuadsData) 89 void IOSurfaceLayerImpl::AppendQuads(QuadSink* quadSink, AppendQuadsData* append QuadsData)
90 { 90 {
91 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState()); 91 SharedQuadState* sharedQuadState = quadSink->useSharedQuadState(CreateShared QuadState());
92 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); 92 AppendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
93 93
94 gfx::Rect quadRect(gfx::Point(), contentBounds()); 94 gfx::Rect quadRect(gfx::Point(), content_bounds());
95 gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect()); 95 gfx::Rect opaqueRect(contents_opaque() ? quadRect : gfx::Rect());
96 scoped_ptr<IOSurfaceDrawQuad> quad = IOSurfaceDrawQuad::Create(); 96 scoped_ptr<IOSurfaceDrawQuad> quad = IOSurfaceDrawQuad::Create();
97 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_ioSurfaceSize, m_ioSur faceTextureId, IOSurfaceDrawQuad::FLIPPED); 97 quad->SetNew(sharedQuadState, quadRect, opaqueRect, m_ioSurfaceSize, m_ioSur faceTextureId, IOSurfaceDrawQuad::FLIPPED);
98 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); 98 quadSink->append(quad.PassAs<DrawQuad>(), appendQuadsData);
99 } 99 }
100 100
101 void IOSurfaceLayerImpl::dumpLayerProperties(std::string* str, int indent) const 101 void IOSurfaceLayerImpl::DumpLayerProperties(std::string* str, int indent) const
102 { 102 {
103 str->append(indentString(indent)); 103 str->append(IndentString(indent));
104 base::StringAppendF(str, "iosurface id: %u texture id: %u\n", m_ioSurfaceId, m_ioSurfaceTextureId); 104 base::StringAppendF(str, "iosurface id: %u texture id: %u\n", m_ioSurfaceId, m_ioSurfaceTextureId);
105 LayerImpl::dumpLayerProperties(str, indent); 105 LayerImpl::DumpLayerProperties(str, indent);
106 } 106 }
107 107
108 void IOSurfaceLayerImpl::didLoseOutputSurface() 108 void IOSurfaceLayerImpl::DidLoseOutputSurface()
109 { 109 {
110 // We don't have a valid texture ID in the new context; however, 110 // We don't have a valid texture ID in the new context; however,
111 // the IOSurface is still valid. 111 // the IOSurface is still valid.
112 m_ioSurfaceTextureId = 0; 112 m_ioSurfaceTextureId = 0;
113 m_ioSurfaceChanged = true; 113 m_ioSurfaceChanged = true;
114 } 114 }
115 115
116 void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const gfx: :Size& size) 116 void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const gfx: :Size& size)
117 { 117 {
118 if (m_ioSurfaceId != ioSurfaceId) 118 if (m_ioSurfaceId != ioSurfaceId)
119 m_ioSurfaceChanged = true; 119 m_ioSurfaceChanged = true;
120 120
121 m_ioSurfaceId = ioSurfaceId; 121 m_ioSurfaceId = ioSurfaceId;
122 m_ioSurfaceSize = size; 122 m_ioSurfaceSize = size;
123 } 123 }
124 124
125 const char* IOSurfaceLayerImpl::layerTypeAsString() const 125 const char* IOSurfaceLayerImpl::LayerTypeAsString() const
126 { 126 {
127 return "IOSurfaceLayer"; 127 return "IOSurfaceLayer";
128 } 128 }
129 129
130 } // namespace cc 130 } // namespace cc
OLDNEW
« no previous file with comments | « cc/io_surface_layer_impl.h ('k') | cc/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698