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

Side by Side Diff: ui/gfx/compositor/compositor_gl.cc

Issue 8418035: Fix gl context change on dropping a texture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as recommended as per backer Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/compositor/compositor_gl.h" 5 #include "ui/gfx/compositor/compositor_gl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 TextureGL::TextureGL() : texture_id_(0) { 321 TextureGL::TextureGL() : texture_id_(0) {
322 } 322 }
323 323
324 TextureGL::TextureGL(const gfx::Size& size) : texture_id_(0), size_(size) { 324 TextureGL::TextureGL(const gfx::Size& size) : texture_id_(0), size_(size) {
325 } 325 }
326 326
327 TextureGL::~TextureGL() { 327 TextureGL::~TextureGL() {
328 if (texture_id_) { 328 if (texture_id_) {
329 SharedResourcesGL* instance = SharedResourcesGL::GetInstance(); 329 SharedResourcesGL* instance = SharedResourcesGL::GetInstance();
330 DCHECK(instance); 330 DCHECK(instance);
331 instance->MakeSharedContextCurrent(); 331 scoped_refptr<gfx::ScopedMakeCurrent> bind =
332 instance->ScopedMakeCurrent();
332 glDeleteTextures(1, &texture_id_); 333 glDeleteTextures(1, &texture_id_);
333 } 334 }
334 } 335 }
335 336
336 void TextureGL::SetCanvas(const SkCanvas& canvas, 337 void TextureGL::SetCanvas(const SkCanvas& canvas,
337 const gfx::Point& origin, 338 const gfx::Point& origin,
338 const gfx::Size& overall_size) { 339 const gfx::Size& overall_size) {
339 const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false); 340 const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false);
340 // Verify bitmap pixels are contiguous. 341 // Verify bitmap pixels are contiguous.
341 DCHECK_EQ(bitmap.rowBytes(), 342 DCHECK_EQ(bitmap.rowBytes(),
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 Compositor* Compositor::Create(CompositorDelegate* owner, 549 Compositor* Compositor::Create(CompositorDelegate* owner,
549 gfx::AcceleratedWidget widget, 550 gfx::AcceleratedWidget widget,
550 const gfx::Size& size) { 551 const gfx::Size& size) {
551 if (SharedResourcesGL::GetInstance() == NULL) 552 if (SharedResourcesGL::GetInstance() == NULL)
552 return NULL; 553 return NULL;
553 else 554 else
554 return new CompositorGL(owner, widget, size); 555 return new CompositorGL(owner, widget, size);
555 } 556 }
556 557
557 } // namespace ui 558 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698