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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp

Issue 2776083002: enable fallback path (Closed)
Patch Set: use stream read Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/AcceleratedStaticBitmapImage.h" 5 #include "platform/graphics/AcceleratedStaticBitmapImage.h"
6 6
7 #include "gpu/command_buffer/client/gles2_interface.h" 7 #include "gpu/command_buffer/client/gles2_interface.h"
8 #include "gpu/command_buffer/common/sync_token.h" 8 #include "gpu/command_buffer/common/sync_token.h"
9 #include "platform/graphics/MailboxTextureHolder.h" 9 #include "platform/graphics/MailboxTextureHolder.h"
10 #include "platform/graphics/SkiaTextureHolder.h" 10 #include "platform/graphics/SkiaTextureHolder.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 IntSize AcceleratedStaticBitmapImage::size() const { 59 IntSize AcceleratedStaticBitmapImage::size() const {
60 return m_textureHolder->size(); 60 return m_textureHolder->size();
61 } 61 }
62 62
63 void AcceleratedStaticBitmapImage::updateSyncToken(gpu::SyncToken syncToken) { 63 void AcceleratedStaticBitmapImage::updateSyncToken(gpu::SyncToken syncToken) {
64 m_textureHolder->updateSyncToken(syncToken); 64 m_textureHolder->updateSyncToken(syncToken);
65 } 65 }
66 66
67 void AcceleratedStaticBitmapImage::copyToTexture( 67 void AcceleratedStaticBitmapImage::copyToTexture(
68 WebGraphicsContext3DProvider* destProvider, 68 WebGraphicsContext3DProvider* destProvider,
69 GLenum destTarget,
69 GLuint destTextureId, 70 GLuint destTextureId,
70 GLenum internalFormat, 71 bool flipY,
71 GLenum destType, 72 const IntPoint& destPoint,
72 bool flipY) { 73 const IntRect& sourceSubRectangle) {
73 checkThread(); 74 checkThread();
74 if (!isValid()) 75 if (!isValid())
75 return; 76 return;
76 // |destProvider| may not be the same context as the one used for |m_image|, 77 // |destProvider| may not be the same context as the one used for |m_image|,
77 // so we use a mailbox to generate a texture id for |destProvider| to access. 78 // so we use a mailbox to generate a texture id for |destProvider| to access.
78 ensureMailbox(); 79 ensureMailbox();
79 80
80 // Get a texture id that |destProvider| knows about and copy from it. 81 // Get a texture id that |destProvider| knows about and copy from it.
81 gpu::gles2::GLES2Interface* destGL = destProvider->contextGL(); 82 gpu::gles2::GLES2Interface* destGL = destProvider->contextGL();
82 destGL->WaitSyncTokenCHROMIUM(m_textureHolder->syncToken().GetData()); 83 destGL->WaitSyncTokenCHROMIUM(m_textureHolder->syncToken().GetData());
83 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM( 84 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM(
84 GL_TEXTURE_2D, m_textureHolder->mailbox().name); 85 GL_TEXTURE_2D, m_textureHolder->mailbox().name);
85 destGL->CopyTextureCHROMIUM(sourceTextureId, 0, GL_TEXTURE_2D, destTextureId, 86 destGL->CopySubTextureCHROMIUM(
86 0, internalFormat, destType, flipY, false, false); 87 sourceTextureId, 0, destTarget, destTextureId, 0, destPoint.x(),
88 destPoint.y(), sourceSubRectangle.x(), sourceSubRectangle.y(),
89 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY, false,
90 false);
87 // This drops the |destGL| context's reference on our |m_mailbox|, but it's 91 // This drops the |destGL| context's reference on our |m_mailbox|, but it's
88 // still held alive by our SkImage. 92 // still held alive by our SkImage.
89 destGL->DeleteTextures(1, &sourceTextureId); 93 destGL->DeleteTextures(1, &sourceTextureId);
90 } 94 }
91 95
92 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { 96 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() {
93 checkThread(); 97 checkThread();
94 if (!isValid()) 98 if (!isValid())
95 return nullptr; 99 return nullptr;
96 createImageFromMailboxIfNeeded(); 100 createImageFromMailboxIfNeeded();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 173
170 void AcceleratedStaticBitmapImage::checkThread() { 174 void AcceleratedStaticBitmapImage::checkThread() {
171 if (m_detachThreadAtNextCheck) { 175 if (m_detachThreadAtNextCheck) {
172 m_threadChecker.DetachFromThread(); 176 m_threadChecker.DetachFromThread();
173 m_detachThreadAtNextCheck = false; 177 m_detachThreadAtNextCheck = false;
174 } 178 }
175 CHECK(m_threadChecker.CalledOnValidThread()); 179 CHECK(m_threadChecker.CalledOnValidThread());
176 } 180 }
177 181
178 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698