OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/grcontext_provider.h" |
| 6 |
| 7 #include "cc/resource_provider.h" |
| 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 9 #include "third_party/skia/include/gpu/GrContext.h" |
| 10 |
| 11 namespace cc { |
| 12 |
| 13 GrContextProvider::GrContextProvider(ResourceProvider* resource_provider) |
| 14 : resource_provider_(resource_provider), |
| 15 context3d_(NULL), |
| 16 gr_context_(NULL) { |
| 17 } |
| 18 |
| 19 GrContextProvider::~GrContextProvider() {} |
| 20 |
| 21 void GrContextProvider::BeginUsingContexts() { |
| 22 // Flush the compositor context to ensure that textures there are available |
| 23 // in the shared context. |
| 24 resource_provider_->flush(); |
| 25 |
| 26 // Make sure ganesh uses the correct GL context. |
| 27 if (context3d()) |
| 28 context3d()->makeContextCurrent(); |
| 29 } |
| 30 |
| 31 void GrContextProvider::FinishUsingContexts() { |
| 32 // Flush ganesh context so that all the rendered stuff appears on the |
| 33 // texture. |
| 34 if (gr_context()) |
| 35 gr_context()->flush(); |
| 36 // Flush the GL context so rendering results from this context are |
| 37 // visible in the compositor's context. |
| 38 if (context3d()) |
| 39 context3d()->flush(); |
| 40 } |
| 41 |
| 42 } // namespace cc |
OLD | NEW |