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

Unified 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: Introduce device_scale_factor to ui::Texture 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/image_transport_factory.cc
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc
index 190673021bf51c8db21f5e7713a999fb89fdbeb1..a01dc6745c2a1ce5a44a0291974593239ee09141 100644
--- a/content/browser/renderer_host/image_transport_factory.cc
+++ b/content/browser/renderer_host/image_transport_factory.cc
@@ -79,6 +79,9 @@ class DefaultTransportFactory
return 0;
}
+ virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE {
+ }
+
// We don't generate lost context events, so we don't need to keep track of
// observers
virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE {
@@ -97,8 +100,9 @@ class ImageTransportClientTexture : public ui::Texture {
ImageTransportClientTexture(
WebKit::WebGraphicsContext3D* host_context,
const gfx::Size& size,
+ float device_scale_factor,
uint64 surface_id)
- : ui::Texture(true, size),
+ : ui::Texture(true, size, device_scale_factor),
host_context_(host_context) {
set_texture_id(surface_id);
}
@@ -123,8 +127,9 @@ class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver {
public:
OwnedTexture(WebKit::WebGraphicsContext3D* host_context,
const gfx::Size& size,
+ float device_scale_factor,
unsigned int texture_id)
- : ui::Texture(true, size),
+ : ui::Texture(true, size, device_scale_factor),
host_context_(host_context) {
ImageTransportFactory::GetInstance()->AddObserver(this);
set_texture_id(texture_id);
@@ -207,7 +212,8 @@ class GpuProcessTransportFactory :
public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
public:
GpuProcessTransportFactory()
- : ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
+ : ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
+ device_scale_factor_(1.0f) {
}
virtual ~GpuProcessTransportFactory() {
@@ -286,7 +292,8 @@ class GpuProcessTransportFactory :
return NULL;
scoped_refptr<ImageTransportClientTexture> image(
new ImageTransportClientTexture(shared_context_.get(),
- size, transport_handle));
+ size, device_scale_factor_,
+ transport_handle));
return image;
}
@@ -296,7 +303,8 @@ class GpuProcessTransportFactory :
if (!shared_context_.get())
return NULL;
scoped_refptr<OwnedTexture> image(
- new OwnedTexture(shared_context_.get(), size, texture_id));
+ new OwnedTexture(shared_context_.get(), size, device_scale_factor_,
+ texture_id));
return image;
}
@@ -319,6 +327,10 @@ class GpuProcessTransportFactory :
return shared_context_->insertSyncPoint();
}
+ virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE {
+ device_scale_factor_ = device_scale_factor;
+ }
+
virtual void AddObserver(ImageTransportFactoryObserver* observer) {
observer_list_.AddObserver(observer);
}
@@ -444,6 +456,7 @@ class GpuProcessTransportFactory :
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> shared_context_;
ObserverList<ImageTransportFactoryObserver> observer_list_;
base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_;
+ float device_scale_factor_;
DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory);
};

Powered by Google App Engine
This is Rietveld 408576698