diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-26 02:05:07 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-26 02:05:07 +0000 |
commit | 729c0b4689ff2b37461dd90b36d2682f0177779f (patch) | |
tree | 27cd129511910d0886f2a99ef7d370ed40b63927 | |
parent | f22b94f4b86d1fb9f70ea006024d272c4350493f (diff) | |
download | chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.zip chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.tar.gz chromium_src-729c0b4689ff2b37461dd90b36d2682f0177779f.tar.bz2 |
Part 2/3 (GL) of adding with device scale factor to transport surfaces
Add a scale factor argument to glResizeCHROMIUM.
Pass the scale factor on to the resize callback in ImageTransportSurface,
and drop it on the floor there.
BUG=132714
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/15685003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202325 0039d316-1c4b-4281-b951-d872f2087c98
27 files changed, 75 insertions, 49 deletions
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 33f6ea1..ddb92d1 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -575,7 +575,7 @@ void WebGraphicsContext3DCommandBufferImpl::reshapeWithScaleFactor( cached_width_ = width; cached_height_ = height; - gl_->ResizeCHROMIUM(width, height); + gl_->ResizeCHROMIUM(width, height, scale_factor); } void WebGraphicsContext3DCommandBufferImpl::FlipVertically( diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index f8f0742..6775a29 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -191,8 +191,8 @@ void ImageTransportHelper::OnResizeViewACK() { surface_->OnResizeViewACK(); } -void ImageTransportHelper::Resize(gfx::Size size) { - surface_->OnResize(size); +void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) { + surface_->OnResize(size, scale_factor); #if defined(OS_ANDROID) manager_->gpu_memory_manager()->ScheduleManage( @@ -326,7 +326,8 @@ void PassThroughImageTransportSurface::OnResizeViewACK() { helper_->SetScheduled(true); } -void PassThroughImageTransportSurface::OnResize(gfx::Size size) { +void PassThroughImageTransportSurface::OnResize(gfx::Size size, + float scale_factor) { new_size_ = size; if (transport_) { diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 503a411..0a9b30b 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -63,7 +63,7 @@ class ImageTransportSurface { virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; virtual void OnResizeViewACK() = 0; - virtual void OnResize(gfx::Size size) = 0; + virtual void OnResize(gfx::Size size, float scale_factor) = 0; virtual void SetLatencyInfo( const cc::LatencyInfo& latency_info) = 0; @@ -158,7 +158,7 @@ class ImageTransportHelper void OnResizeViewACK(); // Backbuffer resize callback. - void Resize(gfx::Size size); + void Resize(gfx::Size size, float scale_factor); void SetLatencyInfo(const cc::LatencyInfo& latency_info); @@ -196,7 +196,7 @@ class PassThroughImageTransportSurface virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; - virtual void OnResize(gfx::Size size) OVERRIDE; + virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; virtual void SetLatencyInfo( const cc::LatencyInfo& latency_info) OVERRIDE; diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 62c3265..c27e47a 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -59,7 +59,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; - virtual void OnResize(gfx::Size size) OVERRIDE; + virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; private: @@ -86,6 +86,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, gfx::Size size_; gfx::Size rounded_size_; + float scale_factor_; // Whether or not we've successfully made the surface current once. bool made_current_; @@ -129,6 +130,7 @@ IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface( texture_id_(0), io_surface_handle_(0), context_(NULL), + scale_factor_(1), made_current_(false), is_swap_buffers_pending_(false), did_unschedule_(false) { @@ -184,7 +186,7 @@ bool IOSurfaceImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { if (made_current_) return true; - OnResize(gfx::Size(1, 1)); + OnResize(gfx::Size(1, 1), 1.f); made_current_ = true; return true; @@ -289,7 +291,8 @@ void IOSurfaceImageTransportSurface::OnResizeViewACK() { NOTREACHED(); } -void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { +void IOSurfaceImageTransportSurface::OnResize(gfx::Size size, + float scale_factor) { // This trace event is used in gpu_feature_browsertest.cc - the test will need // to be updated if this event is changed or moved. TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", @@ -298,6 +301,7 @@ void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { DCHECK(context_->IsCurrent(this)); size_ = size; + scale_factor_ = scale_factor; CreateIOSurface(); } diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index ba2cf42..c37e7d8 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -47,7 +47,7 @@ class PbufferImageTransportSurface virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; - virtual void OnResize(gfx::Size size) OVERRIDE; + virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; @@ -219,7 +219,8 @@ void PbufferImageTransportSurface::OnResizeViewACK() { NOTREACHED(); } -void PbufferImageTransportSurface::OnResize(gfx::Size size) { +void PbufferImageTransportSurface::OnResize(gfx::Size size, + float scale_factor) { DCHECK(backbuffer_suggested_allocation_); DCHECK(frontbuffer_suggested_allocation_); Resize(size); diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc index 858c023..eb419bc 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -31,6 +31,7 @@ TextureImageTransportSurface::TextureImageTransportSurface( const gfx::GLSurfaceHandle& handle) : fbo_id_(0), backbuffer_(CreateTextureDefinition(gfx::Size(), 0)), + scale_factor_(1.f), stub_destroyed_(false), backbuffer_suggested_allocation_(true), frontbuffer_suggested_allocation_(true), @@ -168,8 +169,10 @@ void* TextureImageTransportSurface::GetConfig() { return surface_.get() ? surface_->GetConfig() : NULL; } -void TextureImageTransportSurface::OnResize(gfx::Size size) { +void TextureImageTransportSurface::OnResize(gfx::Size size, + float scale_factor) { current_size_ = size; + scale_factor_ = scale_factor; CreateBackTexture(); } diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h index 9ab9abc..9510625 100644 --- a/content/common/gpu/texture_image_transport_surface.h +++ b/content/common/gpu/texture_image_transport_surface.h @@ -54,7 +54,7 @@ class TextureImageTransportSurface virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; - virtual void OnResize(gfx::Size size) OVERRIDE; + virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual void SetLatencyInfo( const cc::LatencyInfo& latency_info) OVERRIDE; @@ -93,6 +93,7 @@ class TextureImageTransportSurface // The current size of the GLSurface. Used to disambiguate from the current // texture size which might be outdated (since we use two buffers). gfx::Size current_size_; + float scale_factor_; // Whether or not the command buffer stub has been destroyed. bool stub_destroyed_; diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index d23191c..2568074 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -575,7 +575,8 @@ typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) ( #ifndef GL_CHROMIUM_resize #define GL_CHROMIUM_resize 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glResizeCHROMIUM(GLuint width, GLuint height); +GL_APICALL void GL_APIENTRY glResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor); #endif typedef void (GL_APIENTRYP PFNGLRESIZECHROMIUMPROC) ( GLuint width, GLuint height); diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 6df6060..f617163 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -618,8 +618,8 @@ void* GLES2MapTexSubImage2DCHROMIUM( void GLES2UnmapTexSubImage2DCHROMIUM(const void* mem) { gles2::GetGLContext()->UnmapTexSubImage2DCHROMIUM(mem); } -void GLES2ResizeCHROMIUM(GLuint width, GLuint height) { - gles2::GetGLContext()->ResizeCHROMIUM(width, height); +void GLES2ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { + gles2::GetGLContext()->ResizeCHROMIUM(width, height, scale_factor); } const GLchar* GLES2GetRequestableExtensionsCHROMIUM() { return gles2::GetGLContext()->GetRequestableExtensionsCHROMIUM(); diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 1a99879..a290365 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -1777,11 +1777,11 @@ } } - void ResizeCHROMIUM(GLuint width, GLuint height) { + void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { gles2::cmds::ResizeCHROMIUM* c = GetCmdSpace<gles2::cmds::ResizeCHROMIUM>(); if (c) { - c->Init(width, height); + c->Init(width, height, scale_factor); } } diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 3837424..b64c67b 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -2867,11 +2867,12 @@ void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { CheckGLError(); } -void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) { +void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height, + float scale_factor) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResizeCHROMIUM(" - << width << ", " << height << ")"); - helper_->ResizeCHROMIUM(width, height); + << width << ", " << height << ", " << scale_factor << ")"); + helper_->ResizeCHROMIUM(width, height, scale_factor); CheckGLError(); } diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 3123b59..b60730b 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -453,7 +453,8 @@ virtual void* MapTexSubImage2DCHROMIUM( virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index d783468..a93f8eb 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -1643,9 +1643,9 @@ TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { cmds::ResizeCHROMIUM cmd; }; Cmds expected; - expected.cmd.Init(1, 2); + expected.cmd.Init(1, 2, 3); - gl_->ResizeCHROMIUM(1, 2); + gl_->ResizeCHROMIUM(1, 2, 3); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index 0fca7e8..a933b81 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h @@ -260,7 +260,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) = 0; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) = 0; +virtual void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) = + 0; virtual const GLchar* GetRequestableExtensionsCHROMIUM() = 0; virtual void RequestExtensionCHROMIUM(const char* extension) = 0; virtual void RateLimitOffscreenContextCHROMIUM() = 0; diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index 00c3a90..a16fe5d 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -288,7 +288,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index 36ca9b8..ce4b53b 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -549,7 +549,7 @@ void* GLES2InterfaceStub::MapTexSubImage2DCHROMIUM( void GLES2InterfaceStub::UnmapTexSubImage2DCHROMIUM(const void* /* mem */) { } void GLES2InterfaceStub::ResizeCHROMIUM( - GLuint /* width */, GLuint /* height */) { + GLuint /* width */, GLuint /* height */, GLfloat /* scale_factor */) { } const GLchar* GLES2InterfaceStub::GetRequestableExtensionsCHROMIUM() { return 0; diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 9888a5d..bef6ce8c 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -288,7 +288,8 @@ virtual void* MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM(GLuint width, GLuint height) OVERRIDE; +virtual void ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index 40be4e9..a99a36a 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1013,9 +1013,10 @@ void GLES2TraceImplementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { gl_->UnmapTexSubImage2DCHROMIUM(mem); } -void GLES2TraceImplementation::ResizeCHROMIUM(GLuint width, GLuint height) { +void GLES2TraceImplementation::ResizeCHROMIUM( + GLuint width, GLuint height, GLfloat scale_factor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ResizeCHROMIUM"); - gl_->ResizeCHROMIUM(width, height); + gl_->ResizeCHROMIUM(width, height, scale_factor); } const GLchar* GLES2TraceImplementation::GetRequestableExtensionsCHROMIUM() { diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index ec68be4..ef56e5a 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt @@ -182,7 +182,7 @@ GL_APICALL void* GL_APIENTRY glMapBufferSubDataCHROMIUM (GLuint target, G GL_APICALL void GL_APIENTRY glUnmapBufferSubDataCHROMIUM (const void* mem); GL_APICALL void* GL_APIENTRY glMapTexSubImage2DCHROMIUM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access); GL_APICALL void GL_APIENTRY glUnmapTexSubImage2DCHROMIUM (const void* mem); -GL_APICALL void GL_APIENTRY glResizeCHROMIUM (GLuint width, GLuint height); +GL_APICALL void GL_APIENTRY glResizeCHROMIUM (GLuint width, GLuint height, GLfloat scale_factor); GL_APICALL const GLchar* GL_APIENTRY glGetRequestableExtensionsCHROMIUM (void); GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM (const char* extension); GL_APICALL void GL_APIENTRY glRateLimitOffscreenContextCHROMIUM (void); diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 2e2b736..12fc743 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -9449,30 +9449,34 @@ struct ResizeCHROMIUM { header.SetCmd<ValueType>(); } - void Init(GLuint _width, GLuint _height) { + void Init(GLuint _width, GLuint _height, GLfloat _scale_factor) { SetHeader(); width = _width; height = _height; + scale_factor = _scale_factor; } - void* Set(void* cmd, GLuint _width, GLuint _height) { - static_cast<ValueType*>(cmd)->Init(_width, _height); + void* Set(void* cmd, GLuint _width, GLuint _height, GLfloat _scale_factor) { + static_cast<ValueType*>(cmd)->Init(_width, _height, _scale_factor); return NextCmdAddress<ValueType>(cmd); } gpu::CommandHeader header; uint32 width; uint32 height; + float scale_factor; }; -COMPILE_ASSERT(sizeof(ResizeCHROMIUM) == 12, - Sizeof_ResizeCHROMIUM_is_not_12); +COMPILE_ASSERT(sizeof(ResizeCHROMIUM) == 16, + Sizeof_ResizeCHROMIUM_is_not_16); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, header) == 0, OffsetOf_ResizeCHROMIUM_header_not_0); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, width) == 4, OffsetOf_ResizeCHROMIUM_width_not_4); COMPILE_ASSERT(offsetof(ResizeCHROMIUM, height) == 8, OffsetOf_ResizeCHROMIUM_height_not_8); +COMPILE_ASSERT(offsetof(ResizeCHROMIUM, scale_factor) == 12, + OffsetOf_ResizeCHROMIUM_scale_factor_not_12); struct GetRequestableExtensionsCHROMIUM { typedef GetRequestableExtensionsCHROMIUM ValueType; diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index e11bc47..b23b569 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -3706,12 +3706,14 @@ TEST_F(GLES2FormatTest, ResizeCHROMIUM) { void* next_cmd = cmd.Set( &cmd, static_cast<GLuint>(11), - static_cast<GLuint>(12)); + static_cast<GLuint>(12), + static_cast<GLfloat>(13)); EXPECT_EQ(static_cast<uint32>(cmds::ResizeCHROMIUM::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLuint>(11), cmd.width); EXPECT_EQ(static_cast<GLuint>(12), cmd.height); + EXPECT_EQ(static_cast<GLfloat>(13), cmd.scale_factor); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd)); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index cdc83c8..2fad005 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -561,7 +561,7 @@ class GLES2DecoderImpl : public GLES2Decoder { virtual void PerformIdleWork() OVERRIDE; virtual void SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) OVERRIDE; + const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; virtual Logger* GetLogger() OVERRIDE; virtual ErrorState* GetErrorState() OVERRIDE; @@ -1626,7 +1626,7 @@ class GLES2DecoderImpl : public GLES2Decoder { scoped_ptr<VertexArrayManager> vertex_array_manager_; - base::Callback<void(gfx::Size)> resize_callback_; + base::Callback<void(gfx::Size, float)> resize_callback_; WaitSyncPointCallback wait_sync_point_callback_; @@ -3025,7 +3025,7 @@ void GLES2DecoderImpl::UpdateParentTextureInfo() { } void GLES2DecoderImpl::SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) { + const base::Callback<void(gfx::Size, float)>& callback) { resize_callback_ = callback; } @@ -3430,6 +3430,7 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( GLuint width = static_cast<GLuint>(c.width); GLuint height = static_cast<GLuint>(c.height); + GLfloat scale_factor = c.scale_factor; TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); width = std::max(1U, width); @@ -3450,7 +3451,7 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( } if (!resize_callback_.is_null()) { - resize_callback_.Run(gfx::Size(width, height)); + resize_callback_.Run(gfx::Size(width, height), scale_factor); 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 14c82f0..86d4801 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -173,7 +173,7 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, // Sets a callback which is called when a glResizeCHROMIUM command // is processed. virtual void SetResizeCallback( - const base::Callback<void(gfx::Size)>& callback) = 0; + const base::Callback<void(gfx::Size, float)>& callback) = 0; virtual void SetStreamTextureManager(StreamTextureManager* manager) = 0; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index 12d1cbd..3f714bd 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -68,7 +68,8 @@ class MockGLES2Decoder : public GLES2Decoder { MOCK_CONST_METHOD1(RestoreTextureUnitBindings, void(unsigned unit)); MOCK_METHOD0(GetQueryManager, gpu::gles2::QueryManager*()); MOCK_METHOD0(GetVertexArrayManager, gpu::gles2::VertexArrayManager*()); - MOCK_METHOD1(SetResizeCallback, void(const base::Callback<void(gfx::Size)>&)); + MOCK_METHOD1( + SetResizeCallback, void(const base::Callback<void(gfx::Size, float)>&)); MOCK_METHOD1(SetStreamTextureManager, void(StreamTextureManager*)); MOCK_METHOD0(GetAsyncPixelTransferDelegate, AsyncPixelTransferDelegate*()); diff --git a/ppapi/lib/gl/include/GLES2/gl2ext.h b/ppapi/lib/gl/include/GLES2/gl2ext.h index 8effd30..ce2cbf0 100644 --- a/ppapi/lib/gl/include/GLES2/gl2ext.h +++ b/ppapi/lib/gl/include/GLES2/gl2ext.h @@ -1748,7 +1748,8 @@ typedef void (GL_APIENTRYP PFNGLUNMAPTEXSUBIMAGE2DCHROMIUM) (const void* mem); #ifdef GL_GLEXT_PROTOTYPES #define glResizeCHROMIUM GLES2_GET_FUN(ResizeCHROMIUM) #if !defined(GLES2_USE_CPP_BINDINGS) -GL_APICALL void GL_APIENTRY glResizeCHROMIUM (GLuint width, GLuint height); +GL_APICALL void GL_APIENTRY glResizeCHROMIUM ( + GLuint width, GLuint height, GLfloat scale_factor); #endif #else typedef void (GL_APIENTRYP PFNGLRESIZECHROMIUM) (GLuint width, GLuint height); diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index fbe7221..4960db5 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -51,7 +51,7 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { return PP_ERROR_BADARGUMENT; ScopedNoLocking already_locked(this); - gles2_impl()->ResizeCHROMIUM(width, height); + gles2_impl()->ResizeCHROMIUM(width, height, 1.f); // TODO(alokp): Check if resize succeeded and return appropriate error code. return PP_OK; } diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 64dd273..5235e22 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -158,7 +158,7 @@ class GLInProcessContext { ::gpu::gles2::GLES2Decoder* GetDecoder(); - void OnResizeView(gfx::Size size); + void OnResizeView(gfx::Size size, float scale_factor); private: explicit GLInProcessContext(bool share_resources); @@ -489,7 +489,7 @@ CommandBufferService* GLInProcessContext::GetCommandBufferService() { return decoder_.get(); } -void GLInProcessContext::OnResizeView(gfx::Size size) { +void GLInProcessContext::OnResizeView(gfx::Size size, float scale_factor) { DCHECK(!surface_->IsOffscreen()); surface_->Resize(size); } @@ -972,7 +972,7 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::reshapeWithScaleFactor( // TODO(gmam): See if we can comment this in. // ClearContext(); - gl_->ResizeCHROMIUM(width, height); + gl_->ResizeCHROMIUM(width, height, scale_factor); } WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createCompositorTexture( |