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

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_surface.cc

Issue 2449993005: Remove GLImage::Destroy(). (Closed)
Patch Set: One more Destroy() call on Mac. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/gl/gl_image_ozone_native_pixmap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ozone/platform/drm/gpu/gbm_surface.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gl/gl_surface_egl.h" 10 #include "ui/gl/gl_surface_egl.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 glBindFramebufferEXT(GL_FRAMEBUFFER, 0); 87 glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
88 if (fbo_) { 88 if (fbo_) {
89 glDeleteTextures(arraysize(textures_), textures_); 89 glDeleteTextures(arraysize(textures_), textures_);
90 for (auto& texture : textures_) 90 for (auto& texture : textures_)
91 texture = 0; 91 texture = 0;
92 glDeleteFramebuffersEXT(1, &fbo_); 92 glDeleteFramebuffersEXT(1, &fbo_);
93 fbo_ = 0; 93 fbo_ = 0;
94 } 94 }
95 for (auto image : images_) { 95 for (auto& image : images_)
96 if (image) 96 image = nullptr;
97 image->Destroy(true);
98 }
99 97
100 if (!was_current) { 98 if (!was_current) {
101 if (previous_context) { 99 if (previous_context) {
102 previous_context->MakeCurrent(previous_surface.get()); 100 previous_context->MakeCurrent(previous_surface.get());
103 } else { 101 } else {
104 context_->ReleaseCurrent(this); 102 context_->ReleaseCurrent(this);
105 } 103 }
106 } 104 }
107 } 105 }
108 106
(...skipping 17 matching lines...) Expand all
126 for (size_t i = 0; i < arraysize(textures_); i++) { 124 for (size_t i = 0; i < arraysize(textures_); i++) {
127 scoped_refptr<NativePixmap> pixmap = surface_factory()->CreateNativePixmap( 125 scoped_refptr<NativePixmap> pixmap = surface_factory()->CreateNativePixmap(
128 widget(), GetSize(), gfx::BufferFormat::BGRA_8888, 126 widget(), GetSize(), gfx::BufferFormat::BGRA_8888,
129 gfx::BufferUsage::SCANOUT); 127 gfx::BufferUsage::SCANOUT);
130 if (!pixmap) 128 if (!pixmap)
131 return false; 129 return false;
132 scoped_refptr<GLImageOzoneNativePixmap> image = 130 scoped_refptr<GLImageOzoneNativePixmap> image =
133 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); 131 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT);
134 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) 132 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888))
135 return false; 133 return false;
136 // GLImage must have Destroy() called before destructor is called.
137 if (images_[i])
138 images_[i]->Destroy(true);
139 images_[i] = image; 134 images_[i] = image;
140 // Bind image to texture. 135 // Bind image to texture.
141 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); 136 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]);
142 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) 137 if (!images_[i]->BindTexImage(GL_TEXTURE_2D))
143 return false; 138 return false;
144 } 139 }
145 return true; 140 return true;
146 } 141 }
147 142
148 } // namespace ui 143 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/gl/gl_image_ozone_native_pixmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698