OLD | NEW |
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/compositing_iosurface_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
6 | 6 |
7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
8 #include <OpenGL/OpenGL.h> | 8 #include <OpenGL/OpenGL.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 if (io_surface_.get() && io_surface_handle == io_surface_handle_) | 566 if (io_surface_.get() && io_surface_handle == io_surface_handle_) |
567 return true; | 567 return true; |
568 | 568 |
569 TRACE_EVENT0("browser", "CompositingIOSurfaceMac::MapIOSurfaceToTexture"); | 569 TRACE_EVENT0("browser", "CompositingIOSurfaceMac::MapIOSurfaceToTexture"); |
570 UnrefIOSurfaceWithContextCurrent(); | 570 UnrefIOSurfaceWithContextCurrent(); |
571 | 571 |
572 io_surface_.reset(io_surface_support_->IOSurfaceLookup( | 572 io_surface_.reset(io_surface_support_->IOSurfaceLookup( |
573 static_cast<uint32>(io_surface_handle))); | 573 static_cast<uint32>(io_surface_handle))); |
574 // Can fail if IOSurface with that ID was already released by the gpu | 574 // Can fail if IOSurface with that ID was already released by the gpu |
575 // process. | 575 // process. |
576 if (!io_surface_.get()) { | 576 if (!io_surface_) { |
577 io_surface_handle_ = 0; | 577 io_surface_handle_ = 0; |
578 return false; | 578 return false; |
579 } | 579 } |
580 | 580 |
581 io_surface_handle_ = io_surface_handle; | 581 io_surface_handle_ = io_surface_handle; |
582 | 582 |
583 // Actual IOSurface size is rounded up to reduce reallocations during window | 583 // Actual IOSurface size is rounded up to reduce reallocations during window |
584 // resize. Get the actual size to properly map the texture. | 584 // resize. Get the actual size to properly map the texture. |
585 gfx::Size rounded_size( | 585 gfx::Size rounded_size( |
586 io_surface_support_->IOSurfaceGetWidth(io_surface_), | 586 io_surface_support_->IOSurfaceGetWidth(io_surface_), |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 } | 1034 } |
1035 | 1035 |
1036 gfx::Rect CompositingIOSurfaceMac::IntersectWithIOSurface( | 1036 gfx::Rect CompositingIOSurfaceMac::IntersectWithIOSurface( |
1037 const gfx::Rect& rect, float scale_factor) const { | 1037 const gfx::Rect& rect, float scale_factor) const { |
1038 return gfx::IntersectRects(rect, | 1038 return gfx::IntersectRects(rect, |
1039 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(io_surface_size_), | 1039 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(io_surface_size_), |
1040 scale_factor))); | 1040 scale_factor))); |
1041 } | 1041 } |
1042 | 1042 |
1043 } // namespace content | 1043 } // namespace content |
OLD | NEW |