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

Side by Side Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 10941017: Change the scale factor of texture_size from the layer's one to an estimation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/renderer_host/image_transport_factory.h" 5 #include "content/browser/renderer_host/image_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE { 54 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE {
55 return gfx::GLSurfaceHandle(); 55 return gfx::GLSurfaceHandle();
56 } 56 }
57 57
58 virtual void DestroySharedSurfaceHandle( 58 virtual void DestroySharedSurfaceHandle(
59 gfx::GLSurfaceHandle surface) OVERRIDE { 59 gfx::GLSurfaceHandle surface) OVERRIDE {
60 } 60 }
61 61
62 virtual scoped_refptr<ui::Texture> CreateTransportClient( 62 virtual scoped_refptr<ui::Texture> CreateTransportClient(
63 const gfx::Size& size, 63 const gfx::Size& size,
64 float device_scale_factor,
64 uint64 transport_handle) OVERRIDE { 65 uint64 transport_handle) OVERRIDE {
65 return NULL; 66 return NULL;
66 } 67 }
67 68
68 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( 69 virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
69 const gfx::Size& size, 70 const gfx::Size& size,
71 float device_scale_factor,
70 unsigned int texture_id) OVERRIDE { 72 unsigned int texture_id) OVERRIDE {
71 return NULL; 73 return NULL;
72 } 74 }
73 75
74 virtual GLHelper* GetGLHelper() OVERRIDE { 76 virtual GLHelper* GetGLHelper() OVERRIDE {
75 return NULL; 77 return NULL;
76 } 78 }
77 79
78 virtual uint32 InsertSyncPoint() OVERRIDE { 80 virtual uint32 InsertSyncPoint() OVERRIDE {
79 return 0; 81 return 0;
(...skipping 10 matching lines...) Expand all
90 92
91 private: 93 private:
92 DISALLOW_COPY_AND_ASSIGN(DefaultTransportFactory); 94 DISALLOW_COPY_AND_ASSIGN(DefaultTransportFactory);
93 }; 95 };
94 96
95 class ImageTransportClientTexture : public ui::Texture { 97 class ImageTransportClientTexture : public ui::Texture {
96 public: 98 public:
97 ImageTransportClientTexture( 99 ImageTransportClientTexture(
98 WebKit::WebGraphicsContext3D* host_context, 100 WebKit::WebGraphicsContext3D* host_context,
99 const gfx::Size& size, 101 const gfx::Size& size,
102 float device_scale_factor,
100 uint64 surface_id) 103 uint64 surface_id)
101 : ui::Texture(true, size), 104 : ui::Texture(true, size, device_scale_factor),
102 host_context_(host_context) { 105 host_context_(host_context) {
103 set_texture_id(surface_id); 106 set_texture_id(surface_id);
104 } 107 }
105 108
106 virtual WebKit::WebGraphicsContext3D* HostContext3D() { 109 virtual WebKit::WebGraphicsContext3D* HostContext3D() {
107 return host_context_; 110 return host_context_;
108 } 111 }
109 112
110 protected: 113 protected:
111 virtual ~ImageTransportClientTexture() {} 114 virtual ~ImageTransportClientTexture() {}
112 115
113 private: 116 private:
114 // A raw pointer. This |ImageTransportClientTexture| will be destroyed 117 // A raw pointer. This |ImageTransportClientTexture| will be destroyed
115 // before the |host_context_| via 118 // before the |host_context_| via
116 // |ImageTransportFactoryObserver::OnLostContext()| handlers. 119 // |ImageTransportFactoryObserver::OnLostContext()| handlers.
117 WebKit::WebGraphicsContext3D* host_context_; 120 WebKit::WebGraphicsContext3D* host_context_;
118 121
119 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); 122 DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture);
120 }; 123 };
121 124
122 class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver { 125 class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver {
123 public: 126 public:
124 OwnedTexture(WebKit::WebGraphicsContext3D* host_context, 127 OwnedTexture(WebKit::WebGraphicsContext3D* host_context,
125 const gfx::Size& size, 128 const gfx::Size& size,
129 float device_scale_factor,
126 unsigned int texture_id) 130 unsigned int texture_id)
127 : ui::Texture(true, size), 131 : ui::Texture(true, size, device_scale_factor),
128 host_context_(host_context) { 132 host_context_(host_context) {
129 ImageTransportFactory::GetInstance()->AddObserver(this); 133 ImageTransportFactory::GetInstance()->AddObserver(this);
130 set_texture_id(texture_id); 134 set_texture_id(texture_id);
131 } 135 }
132 136
133 // ui::Texture overrides: 137 // ui::Texture overrides:
134 virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE { 138 virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE {
135 return host_context_; 139 return host_context_;
136 } 140 }
137 141
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 surface.parent_context_id != context_id) 278 surface.parent_context_id != context_id)
275 return; 279 return;
276 280
277 shared_context_->deleteTexture(surface.parent_texture_id[0]); 281 shared_context_->deleteTexture(surface.parent_texture_id[0]);
278 shared_context_->deleteTexture(surface.parent_texture_id[1]); 282 shared_context_->deleteTexture(surface.parent_texture_id[1]);
279 shared_context_->flush(); 283 shared_context_->flush();
280 } 284 }
281 285
282 virtual scoped_refptr<ui::Texture> CreateTransportClient( 286 virtual scoped_refptr<ui::Texture> CreateTransportClient(
283 const gfx::Size& size, 287 const gfx::Size& size,
288 float device_scale_factor,
284 uint64 transport_handle) { 289 uint64 transport_handle) {
285 if (!shared_context_.get()) 290 if (!shared_context_.get())
286 return NULL; 291 return NULL;
287 scoped_refptr<ImageTransportClientTexture> image( 292 scoped_refptr<ImageTransportClientTexture> image(
288 new ImageTransportClientTexture(shared_context_.get(), 293 new ImageTransportClientTexture(shared_context_.get(),
289 size, transport_handle)); 294 size, device_scale_factor,
295 transport_handle));
290 return image; 296 return image;
291 } 297 }
292 298
293 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( 299 virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
294 const gfx::Size& size, 300 const gfx::Size& size,
301 float device_scale_factor,
295 unsigned int texture_id) OVERRIDE { 302 unsigned int texture_id) OVERRIDE {
296 if (!shared_context_.get()) 303 if (!shared_context_.get())
297 return NULL; 304 return NULL;
298 scoped_refptr<OwnedTexture> image( 305 scoped_refptr<OwnedTexture> image(
299 new OwnedTexture(shared_context_.get(), size, texture_id)); 306 new OwnedTexture(shared_context_.get(), size, device_scale_factor,
307 texture_id));
300 return image; 308 return image;
301 } 309 }
302 310
303 virtual GLHelper* GetGLHelper() { 311 virtual GLHelper* GetGLHelper() {
304 if (!gl_helper_.get()) { 312 if (!gl_helper_.get()) {
305 CreateSharedContextLazy(); 313 CreateSharedContextLazy();
306 WebKit::WebGraphicsContext3D* context_for_thread = 314 WebKit::WebGraphicsContext3D* context_for_thread =
307 CreateOffscreenContext(); 315 CreateOffscreenContext();
308 if (!context_for_thread) 316 if (!context_for_thread)
309 return NULL; 317 return NULL;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 void ImageTransportFactory::Terminate() { 490 void ImageTransportFactory::Terminate() {
483 ui::ContextFactory::SetInstance(NULL); 491 ui::ContextFactory::SetInstance(NULL);
484 delete g_factory; 492 delete g_factory;
485 g_factory = NULL; 493 g_factory = NULL;
486 } 494 }
487 495
488 // static 496 // static
489 ImageTransportFactory* ImageTransportFactory::GetInstance() { 497 ImageTransportFactory* ImageTransportFactory::GetInstance() {
490 return g_factory; 498 return g_factory;
491 } 499 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698