OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 memcpy(dest_resource->pixels, source_resource->pixels, bytes); | 2256 memcpy(dest_resource->pixels, source_resource->pixels, bytes); |
2257 } | 2257 } |
2258 } | 2258 } |
2259 | 2259 |
2260 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { | 2260 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { |
2261 GLint active_unit = 0; | 2261 GLint active_unit = 0; |
2262 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 2262 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
2263 return active_unit; | 2263 return active_unit; |
2264 } | 2264 } |
2265 | 2265 |
| 2266 void ResourceProvider::PushGroupMarker(const char* name) { |
| 2267 GLES2Interface* gl = ContextGL(); |
| 2268 DCHECK(gl); |
| 2269 |
| 2270 gl->PushGroupMarkerEXT(0, name); |
| 2271 } |
| 2272 |
| 2273 void ResourceProvider::PopGroupMarker() { |
| 2274 GLES2Interface* gl = ContextGL(); |
| 2275 DCHECK(gl); |
| 2276 |
| 2277 gl->PopGroupMarkerEXT(); |
| 2278 } |
| 2279 |
| 2280 void ResourceProvider::ResetGpuContext() { |
| 2281 class GrContext* gr_context = GrContext(); |
| 2282 // TODO(alokp): Implement TestContextProvider::GrContext(). |
| 2283 if (!gr_context) |
| 2284 return; |
| 2285 |
| 2286 gr_context->resetContext(); |
| 2287 } |
| 2288 |
| 2289 void ResourceProvider::FlushGpuContext() { |
| 2290 class GrContext* gr_context = GrContext(); |
| 2291 // TODO(alokp): Implement TestContextProvider::GrContext(). |
| 2292 if (!gr_context) |
| 2293 return; |
| 2294 |
| 2295 gr_context->flush(); |
| 2296 } |
| 2297 |
2266 GLES2Interface* ResourceProvider::ContextGL() const { | 2298 GLES2Interface* ResourceProvider::ContextGL() const { |
2267 ContextProvider* context_provider = output_surface_->context_provider(); | 2299 ContextProvider* context_provider = output_surface_->context_provider(); |
2268 return context_provider ? context_provider->ContextGL() : NULL; | 2300 return context_provider ? context_provider->ContextGL() : NULL; |
2269 } | 2301 } |
2270 | 2302 |
2271 class GrContext* ResourceProvider::GrContext() const { | 2303 class GrContext* ResourceProvider::GrContext() const { |
2272 ContextProvider* context_provider = output_surface_->context_provider(); | 2304 ContextProvider* context_provider = output_surface_->context_provider(); |
2273 return context_provider ? context_provider->GrContext() : NULL; | 2305 return context_provider ? context_provider->GrContext() : NULL; |
2274 } | 2306 } |
2275 | 2307 |
2276 } // namespace cc | 2308 } // namespace cc |
OLD | NEW |