Chromium Code Reviews| Index: content/common/gpu/client/gl_helper.cc |
| diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc |
| index 645ee436dd392c94277cda4cd1b449b34a594a93..c77515c965ccfb35e1d595e047bb3092de95bf9f 100644 |
| --- a/content/common/gpu/client/gl_helper.cc |
| +++ b/content/common/gpu/client/gl_helper.cc |
| @@ -17,8 +17,10 @@ |
| #include "base/threading/thread_restrictions.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| +#include "third_party/skia/include/core/SkRegion.h" |
| #include "ui/gfx/rect.h" |
| #include "ui/gfx/size.h" |
| +#include "ui/gfx/skia_util.h" |
|
jonathan.backer
2012/12/04 19:15:13
nit: necessary?
no sievers
2012/12/05 22:02:34
Done.
|
| #include "ui/gl/gl_bindings.h" |
| using WebKit::WebGLId; |
| @@ -791,4 +793,30 @@ void GLHelper::InitCopyTextToImpl() { |
| } |
| +void GLHelper::CopySubBufferDamage(WebKit::WebGLId texture, |
| + WebKit::WebGLId previous_texture, |
| + const SkRegion& new_damage, |
| + const SkRegion& old_damage) { |
| + SkRegion region(old_damage); |
| + if (region.op(new_damage, SkRegion::kDifference_Op)) { |
| + ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); |
| + ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder( |
| + context_, dst_framebuffer); |
| + ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, texture); |
| + context_->framebufferTexture2D(GL_FRAMEBUFFER, |
| + GL_COLOR_ATTACHMENT0, |
| + GL_TEXTURE_2D, |
| + previous_texture, |
| + 0); |
| + for (SkRegion::Iterator it(region); !it.done(); it.next()) { |
| + const SkIRect& rect = it.rect(); |
| + context_->copyTexSubImage2D(GL_TEXTURE_2D, 0, |
| + rect.x(), rect.y(), |
| + rect.x(), rect.y(), |
| + rect.width(), rect.height()); |
| + } |
| + context_->flush(); |
| + } |
| +} |
| + |
| } // namespace content |