| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/gl/gl_image_io_surface.h" | 5 #include "ui/gl/gl_image_io_surface.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 using gfx::BufferFormat; | 21 using gfx::BufferFormat; |
| 22 | 22 |
| 23 namespace gl { | 23 namespace gl { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 using WidgetToLayerMap = std::map<gfx::AcceleratedWidget, CALayer*>; | 26 using WidgetToLayerMap = std::map<gfx::AcceleratedWidget, CALayer*>; |
| 27 base::LazyInstance<WidgetToLayerMap> g_widget_to_layer_map; | 27 base::LazyInstance<WidgetToLayerMap> g_widget_to_layer_map; |
| 28 | 28 |
| 29 bool ValidInternalFormat(unsigned internalformat) { | 29 bool ValidInternalFormat(unsigned internalformat) { |
| 30 switch (internalformat) { | 30 switch (internalformat) { |
| 31 case GL_R8: | 31 case GL_RED: |
| 32 case GL_BGRA_EXT: | 32 case GL_BGRA_EXT: |
| 33 case GL_RGB: | 33 case GL_RGB: |
| 34 case GL_RGB_YCBCR_422_CHROMIUM: | 34 case GL_RGB_YCBCR_422_CHROMIUM: |
| 35 case GL_RGBA: | 35 case GL_RGBA: |
| 36 return true; | 36 return true; |
| 37 default: | 37 default: |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // static | 262 // static |
| 263 void GLImageIOSurface::SetLayerForWidget(gfx::AcceleratedWidget widget, | 263 void GLImageIOSurface::SetLayerForWidget(gfx::AcceleratedWidget widget, |
| 264 CALayer* layer) { | 264 CALayer* layer) { |
| 265 if (layer) | 265 if (layer) |
| 266 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); | 266 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); |
| 267 else | 267 else |
| 268 g_widget_to_layer_map.Pointer()->erase(widget); | 268 g_widget_to_layer_map.Pointer()->erase(widget); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace gfx | 271 } // namespace gfx |
| OLD | NEW |