summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2015-10-29 19:33:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-30 02:34:40 +0000
commitce45e11f6759070f4f35f9a3f9d2ea33cb765c69 (patch)
treec01bcc7c0b91c0b0f9c1a9e9217b6edcb81a68c6
parent2779a2559c0bd8b3dec859d98951a968c54fe0db (diff)
downloadchromium_src-ce45e11f6759070f4f35f9a3f9d2ea33cb765c69.zip
chromium_src-ce45e11f6759070f4f35f9a3f9d2ea33cb765c69.tar.gz
chromium_src-ce45e11f6759070f4f35f9a3f9d2ea33cb765c69.tar.bz2
GLES2CmdDecoder should resize GLSurface using GLSurface::Resize
A special resize callback is unnecessary because the decoder has access to the GLSurface and can call Resize on that. Review URL: https://codereview.chromium.org/1420503011 Cr-Commit-Position: refs/heads/master@{#357029}
-rw-r--r--components/mus/gles2/command_buffer_driver.cc6
-rw-r--r--components/mus/gles2/command_buffer_driver.h1
-rw-r--r--components/mus/gles2/command_buffer_local.cc6
-rw-r--r--components/mus/gles2/command_buffer_local.h1
-rw-r--r--content/common/gpu/image_transport_surface.cc17
-rw-r--r--content/common/gpu/image_transport_surface.h2
-rw-r--r--content/common/gpu/image_transport_surface_overlay_mac.h2
-rw-r--r--content/common/gpu/image_transport_surface_overlay_mac.mm5
-rw-r--r--content/common/gpu/media/rendering_helper.cc2
-rw-r--r--gpu/command_buffer/service/gl_surface_mock.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc19
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h5
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc10
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.h1
-rw-r--r--ui/gl/gl_surface.cc6
-rw-r--r--ui/gl/gl_surface.h4
-rw-r--r--ui/gl/gl_surface_egl.cc6
-rw-r--r--ui/gl/gl_surface_egl.h6
-rw-r--r--ui/gl/gl_surface_glx.cc2
-rw-r--r--ui/gl/gl_surface_glx.h2
-rw-r--r--ui/gl/gl_surface_osmesa.cc4
-rw-r--r--ui/gl/gl_surface_osmesa.h2
-rw-r--r--ui/gl/gl_surface_ozone.cc21
-rw-r--r--ui/gl/gl_surface_x11.cc7
-rw-r--r--ui/ozone/demo/gl_renderer.cc2
25 files changed, 44 insertions, 97 deletions
diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc
index 1eb4930..ba13464 100644
--- a/components/mus/gles2/command_buffer_driver.cc
+++ b/components/mus/gles2/command_buffer_driver.cc
@@ -113,8 +113,6 @@ bool CommandBufferDriver::DoInitialize(
scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(),
decoder_.get()));
decoder_->set_engine(scheduler_.get());
- decoder_->SetResizeCallback(
- base::Bind(&CommandBufferDriver::OnResize, base::Unretained(this)));
decoder_->SetWaitSyncPointCallback(base::Bind(
&CommandBufferDriver::OnWaitSyncPoint, base::Unretained(this)));
decoder_->SetFenceSyncReleaseCallback(base::Bind(
@@ -276,10 +274,6 @@ void CommandBufferDriver::OnParseError() {
OnContextLost(state.context_lost_reason);
}
-void CommandBufferDriver::OnResize(gfx::Size size, float scale_factor) {
- surface_->Resize(size);
-}
-
bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) {
if (!sync_point)
return true;
diff --git a/components/mus/gles2/command_buffer_driver.h b/components/mus/gles2/command_buffer_driver.h
index 47d25a5..eccf13a 100644
--- a/components/mus/gles2/command_buffer_driver.h
+++ b/components/mus/gles2/command_buffer_driver.h
@@ -74,7 +74,6 @@ class CommandBufferDriver {
bool MakeCurrent();
bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state,
mojo::Array<int32_t> attribs);
- void OnResize(gfx::Size size, float scale_factor);
bool OnWaitSyncPoint(uint32_t sync_point);
void OnFenceSyncRelease(uint64_t release);
bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id,
diff --git a/components/mus/gles2/command_buffer_local.cc b/components/mus/gles2/command_buffer_local.cc
index 429db04..4bdad2f 100644
--- a/components/mus/gles2/command_buffer_local.cc
+++ b/components/mus/gles2/command_buffer_local.cc
@@ -90,8 +90,6 @@ bool CommandBufferLocal::Initialize() {
scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(),
decoder_.get()));
decoder_->set_engine(scheduler_.get());
- decoder_->SetResizeCallback(
- base::Bind(&CommandBufferLocal::OnResize, base::Unretained(this)));
decoder_->SetWaitSyncPointCallback(
base::Bind(&CommandBufferLocal::OnWaitSyncPoint, base::Unretained(this)));
decoder_->SetFenceSyncReleaseCallback(base::Bind(
@@ -263,10 +261,6 @@ void CommandBufferLocal::PumpCommands() {
scheduler_->PutChanged();
}
-void CommandBufferLocal::OnResize(gfx::Size size, float scale_factor) {
- surface_->Resize(size);
-}
-
void CommandBufferLocal::OnUpdateVSyncParameters(
const base::TimeTicks timebase,
const base::TimeDelta interval) {
diff --git a/components/mus/gles2/command_buffer_local.h b/components/mus/gles2/command_buffer_local.h
index b400663..02ed8ea 100644
--- a/components/mus/gles2/command_buffer_local.h
+++ b/components/mus/gles2/command_buffer_local.h
@@ -84,7 +84,6 @@ class CommandBufferLocal : public gpu::GpuControl {
private:
void PumpCommands();
- void OnResize(gfx::Size size, float scale_factor);
void OnUpdateVSyncParameters(const base::TimeTicks timebase,
const base::TimeDelta interval);
bool OnWaitSyncPoint(uint32_t sync_point);
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index 1cdbd80..2702d8c 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -66,9 +66,6 @@ bool ImageTransportHelper::Initialize() {
if (!decoder)
return false;
- decoder->SetResizeCallback(
- base::Bind(&ImageTransportHelper::Resize, base::Unretained(this)));
-
stub_->SetLatencyInfoCallback(
base::Bind(&ImageTransportHelper::SetLatencyInfo,
base::Unretained(this)));
@@ -135,15 +132,6 @@ void ImageTransportHelper::OnBufferPresented(
}
#endif
-void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) {
- surface_->OnResize(size, scale_factor);
-
-#if defined(OS_ANDROID)
- manager_->gpu_memory_manager()->ScheduleManage(
- GpuMemoryManager::kScheduleManageNow);
-#endif
-}
-
void ImageTransportHelper::SetLatencyInfo(
const std::vector<ui::LatencyInfo>& latency_info) {
surface_->SetLatencyInfo(latency_info);
@@ -258,11 +246,6 @@ void PassThroughImageTransportSurface::OnBufferPresented(
}
#endif
-void PassThroughImageTransportSurface::OnResize(gfx::Size size,
- float scale_factor) {
- Resize(size);
-}
-
gfx::Size PassThroughImageTransportSurface::GetSize() {
return GLSurfaceAdapter::GetSize();
}
diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h
index 263f833..f119cd9 100644
--- a/content/common/gpu/image_transport_surface.h
+++ b/content/common/gpu/image_transport_surface.h
@@ -63,7 +63,6 @@ class ImageTransportSurface {
virtual void OnBufferPresented(
const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0;
#endif
- virtual void OnResize(gfx::Size size, float scale_factor) = 0;
virtual void SetLatencyInfo(
const std::vector<ui::LatencyInfo>& latency_info) = 0;
@@ -177,7 +176,6 @@ class PassThroughImageTransportSurface
void OnBufferPresented(
const AcceleratedSurfaceMsg_BufferPresented_Params& params) override;
#endif
- void OnResize(gfx::Size size, float scale_factor) override;
gfx::Size GetSize() override;
void SetLatencyInfo(
const std::vector<ui::LatencyInfo>& latency_info) override;
diff --git a/content/common/gpu/image_transport_surface_overlay_mac.h b/content/common/gpu/image_transport_surface_overlay_mac.h
index 9da4adf..3dcf9e8 100644
--- a/content/common/gpu/image_transport_surface_overlay_mac.h
+++ b/content/common/gpu/image_transport_surface_overlay_mac.h
@@ -32,6 +32,7 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
// GLSurface implementation
bool Initialize() override;
void Destroy() override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
@@ -50,7 +51,6 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
// ImageTransportSurface implementation
void OnBufferPresented(
const AcceleratedSurfaceMsg_BufferPresented_Params& params) override;
- void OnResize(gfx::Size pixel_size, float scale_factor) override;
void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override;
// ui::GpuSwitchingObserver implementation.
diff --git a/content/common/gpu/image_transport_surface_overlay_mac.mm b/content/common/gpu/image_transport_surface_overlay_mac.mm
index 000fa59..298baa3 100644
--- a/content/common/gpu/image_transport_surface_overlay_mac.mm
+++ b/content/common/gpu/image_transport_surface_overlay_mac.mm
@@ -708,12 +708,13 @@ void ImageTransportSurfaceOverlayMac::OnBufferPresented(
}
}
-void ImageTransportSurfaceOverlayMac::OnResize(gfx::Size pixel_size,
- float scale_factor) {
+bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size,
+ float scale_factor) {
// Flush through any pending frames.
DisplayAndClearAllPendingSwaps();
pixel_size_ = pixel_size;
scale_factor_ = scale_factor;
+ return true;
}
void ImageTransportSurfaceOverlayMac::SetLatencyInfo(
diff --git a/content/common/gpu/media/rendering_helper.cc b/content/common/gpu/media/rendering_helper.cc
index e6d124b..6358de9 100644
--- a/content/common/gpu/media/rendering_helper.cc
+++ b/content/common/gpu/media/rendering_helper.cc
@@ -339,7 +339,7 @@ void RenderingHelper::Initialize(const RenderingHelperParams& params,
gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_);
#if defined(USE_OZONE)
- gl_surface_->Resize(platform_window_delegate_->GetSize());
+ gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f);
#endif // defined(USE_OZONE)
screen_size_ = gl_surface_->GetSize();
diff --git a/gpu/command_buffer/service/gl_surface_mock.h b/gpu/command_buffer/service/gl_surface_mock.h
index 1d756d4..44cbcdd 100644
--- a/gpu/command_buffer/service/gl_surface_mock.h
+++ b/gpu/command_buffer/service/gl_surface_mock.h
@@ -17,7 +17,7 @@ class GLSurfaceMock : public gfx::GLSurface {
MOCK_METHOD0(Initialize, bool());
MOCK_METHOD0(Destroy, void());
- MOCK_METHOD1(Resize, bool(const gfx::Size& size));
+ MOCK_METHOD2(Resize, bool(const gfx::Size& size, float scale_factor));
MOCK_METHOD0(IsOffscreen, bool());
MOCK_METHOD0(SwapBuffers, gfx::SwapResult());
MOCK_METHOD4(PostSubBuffer,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 34ae829..4b618c6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -877,9 +877,6 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
void WaitForReadPixels(base::Closure callback) override;
- void SetResizeCallback(
- const base::Callback<void(gfx::Size, float)>& callback) override;
-
Logger* GetLogger() override;
void BeginDecoding() override;
@@ -2194,8 +2191,6 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
scoped_ptr<ImageManager> image_manager_;
- base::Callback<void(gfx::Size, float)> resize_callback_;
-
WaitSyncPointCallback wait_sync_point_callback_;
FenceSyncReleaseCallback fence_sync_release_callback_;
WaitFenceSyncCallback wait_fence_sync_callback_;
@@ -4135,11 +4130,6 @@ void GLES2DecoderImpl::UpdateParentTextureInfo() {
glBindTexture(target, texture_ref ? texture_ref->service_id() : 0);
}
-void GLES2DecoderImpl::SetResizeCallback(
- const base::Callback<void(gfx::Size, float)>& callback) {
- resize_callback_ = callback;
-}
-
Logger* GLES2DecoderImpl::GetLogger() {
return &logger_;
}
@@ -4536,10 +4526,11 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(uint32 immediate_data_size,
<< "ResizeOffscreenFrameBuffer failed.";
return error::kLostContext;
}
- }
-
- if (!resize_callback_.is_null()) {
- resize_callback_.Run(gfx::Size(width, height), scale_factor);
+ } else {
+ if (!surface_->Resize(gfx::Size(width, height), scale_factor)) {
+ LOG(ERROR) << "GLES2DecoderImpl: Context lost because resize failed.";
+ return error::kLostContext;
+ }
DCHECK(context_->IsCurrent(surface_.get()));
if (!context_->IsCurrent(surface_.get())) {
LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer "
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 60ca384..ec870bf 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -203,11 +203,6 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>,
// Perform any idle work that needs to be made.
virtual void PerformIdleWork() = 0;
- // Sets a callback which is called when a glResizeCHROMIUM command
- // is processed.
- virtual void SetResizeCallback(
- const base::Callback<void(gfx::Size, float)>& callback) = 0;
-
// Get the service texture ID corresponding to a client texture ID.
// If no such record is found then return false.
virtual bool GetServiceTextureId(uint32 client_texture_id,
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 3b5f9d0..5401a48 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -198,12 +198,6 @@ InProcessCommandBuffer::~InProcessCommandBuffer() {
Destroy();
}
-void InProcessCommandBuffer::OnResizeView(gfx::Size size, float scale_factor) {
- CheckSequencedThread();
- DCHECK(!surface_->IsOffscreen());
- surface_->Resize(size);
-}
-
bool InProcessCommandBuffer::MakeCurrent() {
CheckSequencedThread();
command_buffer_lock_.AssertAcquired();
@@ -411,10 +405,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
}
*params.capabilities = decoder_->GetCapabilities();
- if (!params.is_offscreen) {
- decoder_->SetResizeCallback(base::Bind(
- &InProcessCommandBuffer::OnResizeView, gpu_thread_weak_ptr_));
- }
decoder_->SetWaitSyncPointCallback(
base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread,
base::Unretained(this)));
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index dc33c35..83318b5 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -236,7 +236,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
// Callbacks:
void OnContextLost();
- void OnResizeView(gfx::Size size, float scale_factor);
bool GetBufferChanged(int32 transfer_buffer_id);
void PumpCommands();
void PerformDelayedWork();
diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc
index 941b06b..d29f944 100644
--- a/ui/gl/gl_surface.cc
+++ b/ui/gl/gl_surface.cc
@@ -99,7 +99,7 @@ bool GLSurface::Initialize() {
return true;
}
-bool GLSurface::Resize(const gfx::Size& size) {
+bool GLSurface::Resize(const gfx::Size& size, float scale_factor) {
NOTIMPLEMENTED();
return false;
}
@@ -232,8 +232,8 @@ void GLSurfaceAdapter::Destroy() {
surface_->Destroy();
}
-bool GLSurfaceAdapter::Resize(const gfx::Size& size) {
- return surface_->Resize(size);
+bool GLSurfaceAdapter::Resize(const gfx::Size& size, float scale_factor) {
+ return surface_->Resize(size, scale_factor);
}
bool GLSurfaceAdapter::Recreate() {
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h
index b928c67..7fc65f7 100644
--- a/ui/gl/gl_surface.h
+++ b/ui/gl/gl_surface.h
@@ -43,7 +43,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
// Destroys the surface.
virtual void Destroy() = 0;
- virtual bool Resize(const gfx::Size& size);
+ virtual bool Resize(const gfx::Size& size, float scale_factor);
// Recreate the surface without changing the size.
virtual bool Recreate();
@@ -195,7 +195,7 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
bool Initialize() override;
void Destroy() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
bool Recreate() override;
bool DeferDraws() override;
bool IsOffscreen() override;
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index f85258f..778e0c5 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -672,7 +672,7 @@ gfx::Size NativeViewGLSurfaceEGL::GetSize() {
return gfx::Size(width, height);
}
-bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) {
+bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size, float scale_factor) {
if (size == GetSize())
return true;
@@ -815,7 +815,7 @@ gfx::Size PbufferGLSurfaceEGL::GetSize() {
return size_;
}
-bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) {
+bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size, float scale_factor) {
if (size == size_)
return true;
@@ -901,7 +901,7 @@ gfx::Size SurfacelessEGL::GetSize() {
return size_;
}
-bool SurfacelessEGL::Resize(const gfx::Size& size) {
+bool SurfacelessEGL::Resize(const gfx::Size& size, float scale_factor) {
size_ = size;
return true;
}
diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h
index c8c7ddf..41cc0b2 100644
--- a/ui/gl/gl_surface_egl.h
+++ b/ui/gl/gl_surface_egl.h
@@ -76,7 +76,7 @@ class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL {
EGLConfig GetConfig() override;
bool Initialize() override;
void Destroy() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
bool Recreate() override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
@@ -131,7 +131,7 @@ class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL {
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
gfx::Size GetSize() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
EGLSurface GetHandle() override;
void* GetShareHandle() override;
@@ -160,7 +160,7 @@ class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL {
bool IsSurfaceless() const override;
gfx::SwapResult SwapBuffers() override;
gfx::Size GetSize() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
EGLSurface GetHandle() override;
void* GetShareHandle() override;
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 3f82e27..e66e637 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -526,7 +526,7 @@ uint32_t NativeViewGLSurfaceGLX::DispatchEvent(const ui::PlatformEvent& event) {
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
-bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size) {
+bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size, float scale_factor) {
size_ = size;
glXWaitGL();
XResizeWindow(g_display, window_, size.width(), size.height());
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h
index 1db5e4c..727004b 100644
--- a/ui/gl/gl_surface_glx.h
+++ b/ui/gl/gl_surface_glx.h
@@ -59,7 +59,7 @@ class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX,
// Implement GLSurfaceGLX.
bool Initialize() override;
void Destroy() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
gfx::Size GetSize() override;
diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc
index 00acc95..f488274 100644
--- a/ui/gl/gl_surface_osmesa.cc
+++ b/ui/gl/gl_surface_osmesa.cc
@@ -30,14 +30,14 @@ GLSurfaceOSMesa::GLSurfaceOSMesa(OSMesaSurfaceFormat format,
}
bool GLSurfaceOSMesa::Initialize() {
- return Resize(size_);
+ return Resize(size_, 1.f);
}
void GLSurfaceOSMesa::Destroy() {
buffer_.reset();
}
-bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
+bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size, float scale_factor) {
scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
GLContext* current_context = GLContext::GetCurrent();
bool was_current =
diff --git a/ui/gl/gl_surface_osmesa.h b/ui/gl/gl_surface_osmesa.h
index 1aa90bd..4589f1a 100644
--- a/ui/gl/gl_surface_osmesa.h
+++ b/ui/gl/gl_surface_osmesa.h
@@ -23,7 +23,7 @@ class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
// Implement GLSurface.
bool Initialize() override;
void Destroy() override;
- bool Resize(const gfx::Size& new_size) override;
+ bool Resize(const gfx::Size& new_size, float scale_factor) override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
gfx::Size GetSize() override;
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
index 0e3f8b9..eead3b2 100644
--- a/ui/gl/gl_surface_ozone.cc
+++ b/ui/gl/gl_surface_ozone.cc
@@ -46,7 +46,7 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL {
// GLSurface:
bool Initialize() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
gfx::SwapResult SwapBuffers() override;
bool ScheduleOverlayPlane(int z_order,
OverlayTransform transform,
@@ -79,14 +79,14 @@ bool GLSurfaceOzoneEGL::Initialize() {
return Initialize(ozone_surface_->CreateVSyncProvider());
}
-bool GLSurfaceOzoneEGL::Resize(const gfx::Size& size) {
+bool GLSurfaceOzoneEGL::Resize(const gfx::Size& size, float scale_factor) {
if (!ozone_surface_->ResizeNativeWindow(size)) {
if (!ReinitializeNativeSurface() ||
!ozone_surface_->ResizeNativeWindow(size))
return false;
}
- return NativeViewGLSurfaceEGL::Resize(size);
+ return NativeViewGLSurfaceEGL::Resize(size, scale_factor);
}
gfx::SwapResult GLSurfaceOzoneEGL::SwapBuffers() {
@@ -144,7 +144,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
// GLSurface:
bool Initialize() override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
gfx::SwapResult SwapBuffers() override;
bool ScheduleOverlayPlane(int z_order,
OverlayTransform transform,
@@ -263,11 +263,12 @@ bool GLSurfaceOzoneSurfaceless::Initialize() {
return true;
}
-bool GLSurfaceOzoneSurfaceless::Resize(const gfx::Size& size) {
+bool GLSurfaceOzoneSurfaceless::Resize(const gfx::Size& size,
+ float scale_factor) {
if (!ozone_surface_->ResizeNativeWindow(size))
return false;
- return SurfacelessEGL::Resize(size);
+ return SurfacelessEGL::Resize(size, scale_factor);
}
gfx::SwapResult GLSurfaceOzoneSurfaceless::SwapBuffers() {
@@ -428,7 +429,7 @@ class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl
// GLSurface:
unsigned int GetBackingFrameBufferObject() override;
bool OnMakeCurrent(GLContext* context) override;
- bool Resize(const gfx::Size& size) override;
+ bool Resize(const gfx::Size& size, float scale_factor) override;
bool SupportsPostSubBuffer() override;
gfx::SwapResult SwapBuffers() override;
bool SwapBuffersAsync(const SwapCompletionCallback& callback) override;
@@ -481,10 +482,12 @@ bool GLSurfaceOzoneSurfacelessSurfaceImpl::OnMakeCurrent(GLContext* context) {
return SurfacelessEGL::OnMakeCurrent(context);
}
-bool GLSurfaceOzoneSurfacelessSurfaceImpl::Resize(const gfx::Size& size) {
+bool GLSurfaceOzoneSurfacelessSurfaceImpl::Resize(const gfx::Size& size,
+ float scale_factor) {
if (size == GetSize())
return true;
- return GLSurfaceOzoneSurfaceless::Resize(size) && CreatePixmaps();
+ return GLSurfaceOzoneSurfaceless::Resize(size, scale_factor) &&
+ CreatePixmaps();
}
bool GLSurfaceOzoneSurfacelessSurfaceImpl::SupportsPostSubBuffer() {
diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc
index 4e14a43..5e8429f 100644
--- a/ui/gl/gl_surface_x11.cc
+++ b/ui/gl/gl_surface_x11.cc
@@ -30,7 +30,7 @@ class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
// Implement a subset of GLSurface.
bool Initialize() override;
void Destroy() override;
- bool Resize(const gfx::Size& new_size) override;
+ bool Resize(const gfx::Size& new_size, float scale_factor) override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
bool SupportsPostSubBuffer() override;
@@ -136,8 +136,9 @@ void NativeViewGLSurfaceOSMesa::Destroy() {
XSync(xdisplay_, False);
}
-bool NativeViewGLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
- if (!GLSurfaceOSMesa::Resize(new_size))
+bool NativeViewGLSurfaceOSMesa::Resize(const gfx::Size& new_size,
+ float scale_factor) {
+ if (!GLSurfaceOSMesa::Resize(new_size, scale_factor))
return false;
XWindowAttributes attributes;
diff --git a/ui/ozone/demo/gl_renderer.cc b/ui/ozone/demo/gl_renderer.cc
index 015bbde..d675b5c 100644
--- a/ui/ozone/demo/gl_renderer.cc
+++ b/ui/ozone/demo/gl_renderer.cc
@@ -29,7 +29,7 @@ bool GlRenderer::Initialize() {
return false;
}
- surface_->Resize(size_);
+ surface_->Resize(size_, 1.f);
if (!context_->MakeCurrent(surface_.get())) {
LOG(ERROR) << "Failed to make GL context current";