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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 15579002: Implement transform/clip support for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add GL support and clean up Created 7 years, 7 months 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
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 make_scoped_ptr(new ResourceProvider::ScopedWriteLockGL( 2367 make_scoped_ptr(new ResourceProvider::ScopedWriteLockGL(
2368 resource_provider_, texture->id())); 2368 resource_provider_, texture->id()));
2369 unsigned texture_id = current_framebuffer_lock_->texture_id(); 2369 unsigned texture_id = current_framebuffer_lock_->texture_id();
2370 GLC(context_, 2370 GLC(context_,
2371 context_->framebufferTexture2D( 2371 context_->framebufferTexture2D(
2372 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_id, 0)); 2372 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_id, 0));
2373 2373
2374 DCHECK(context_->checkFramebufferStatus(GL_FRAMEBUFFER) == 2374 DCHECK(context_->checkFramebufferStatus(GL_FRAMEBUFFER) ==
2375 GL_FRAMEBUFFER_COMPLETE || IsContextLost()); 2375 GL_FRAMEBUFFER_COMPLETE || IsContextLost());
2376 2376
2377 InitializeMatrices(frame, framebuffer_rect, false); 2377 InitializeMatrices(frame, gfx::Vector2d(), framebuffer_rect, false);
2378 SetDrawViewportSize(framebuffer_rect.size()); 2378 SetDrawViewportSize(framebuffer_rect.size());
2379 2379
2380 return true; 2380 return true;
2381 } 2381 }
2382 2382
2383 void GLRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { 2383 void GLRenderer::SetScissorTestRect(gfx::Rect scissor_rect) {
2384 EnsureScissorTestEnabled(); 2384 EnsureScissorTestEnabled();
2385 2385
2386 // Don't unnecessarily ask the context to change the scissor, because it 2386 // Don't unnecessarily ask the context to change the scissor, because it
2387 // may cause undesired GPU pipeline flushes. 2387 // may cause undesired GPU pipeline flushes.
2388 if (scissor_rect == scissor_rect_) 2388 if (scissor_rect == scissor_rect_)
2389 return; 2389 return;
2390 2390
2391 scissor_rect_ = scissor_rect; 2391 scissor_rect_ = scissor_rect;
2392 FlushTextureQuadCache(); 2392 FlushTextureQuadCache();
2393 GLC(context_, 2393 GLC(context_,
2394 context_->scissor(scissor_rect.x(), 2394 context_->scissor(scissor_rect.x(),
2395 scissor_rect.y(), 2395 scissor_rect.y(),
2396 scissor_rect.width(), 2396 scissor_rect.width(),
2397 scissor_rect.height())); 2397 scissor_rect.height()));
2398 } 2398 }
2399 2399
2400 void GLRenderer::SetDrawViewportSize(gfx::Size viewport_size) { 2400 void GLRenderer::SetDrawViewportSize(gfx::Size viewport_size) {
2401 current_framebuffer_size_ = viewport_size; 2401 current_framebuffer_size_ = viewport_size;
2402 GLC(context_, 2402 GLC(context_,
2403 context_->viewport(0, 0, viewport_size.width(), viewport_size.height())); 2403 context_->viewport(client_->DeviceViewportOffset().x(),
2404 client_->DeviceViewportOffset().y(),
2405 viewport_size.width(),
2406 viewport_size.height()));
2404 } 2407 }
2405 2408
2406 bool GLRenderer::MakeContextCurrent() { return context_->makeContextCurrent(); } 2409 bool GLRenderer::MakeContextCurrent() { return context_->makeContextCurrent(); }
2407 2410
2408 bool GLRenderer::InitializeSharedObjects() { 2411 bool GLRenderer::InitializeSharedObjects() {
2409 TRACE_EVENT0("cc", "GLRenderer::InitializeSharedObjects"); 2412 TRACE_EVENT0("cc", "GLRenderer::InitializeSharedObjects");
2410 MakeContextCurrent(); 2413 MakeContextCurrent();
2411 2414
2412 // Create an FBO for doing offscreen rendering. 2415 // Create an FBO for doing offscreen rendering.
2413 GLC(context_, offscreen_framebuffer_id_ = context_->createFramebuffer()); 2416 GLC(context_, offscreen_framebuffer_id_ = context_->createFramebuffer());
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas 2915 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas
2913 // implementation. 2916 // implementation.
2914 return gr_context_ && context_->getContextAttributes().stencil; 2917 return gr_context_ && context_->getContextAttributes().stencil;
2915 } 2918 }
2916 2919
2917 bool GLRenderer::IsContextLost() { 2920 bool GLRenderer::IsContextLost() {
2918 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2921 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
2919 } 2922 }
2920 2923
2921 } // namespace cc 2924 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698