OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 destGL->WaitSyncTokenCHROMIUM(m_textureHolder->syncToken().GetData()); | 82 destGL->WaitSyncTokenCHROMIUM(m_textureHolder->syncToken().GetData()); |
83 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM( | 83 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM( |
84 GL_TEXTURE_2D, m_textureHolder->mailbox().name); | 84 GL_TEXTURE_2D, m_textureHolder->mailbox().name); |
85 destGL->CopyTextureCHROMIUM(sourceTextureId, destTextureId, internalFormat, | 85 destGL->CopyTextureCHROMIUM(sourceTextureId, destTextureId, internalFormat, |
86 destType, flipY, false, false); | 86 destType, flipY, false, false); |
87 // This drops the |destGL| context's reference on our |m_mailbox|, but it's | 87 // This drops the |destGL| context's reference on our |m_mailbox|, but it's |
88 // still held alive by our SkImage. | 88 // still held alive by our SkImage. |
89 destGL->DeleteTextures(1, &sourceTextureId); | 89 destGL->DeleteTextures(1, &sourceTextureId); |
90 } | 90 } |
91 | 91 |
92 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { | 92 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame( |
| 93 const ColorBehavior& colorBehavior) { |
| 94 // TODO(ccameron): This function should not ignore |colorBehavior|. |
| 95 // https://crbug.com/672306 |
93 checkThread(); | 96 checkThread(); |
94 if (!isValid()) | 97 if (!isValid()) |
95 return nullptr; | 98 return nullptr; |
96 createImageFromMailboxIfNeeded(); | 99 createImageFromMailboxIfNeeded(); |
97 return m_textureHolder->skImage(); | 100 return m_textureHolder->skImage(); |
98 } | 101 } |
99 | 102 |
100 void AcceleratedStaticBitmapImage::draw(SkCanvas* canvas, | 103 void AcceleratedStaticBitmapImage::draw(SkCanvas* canvas, |
101 const SkPaint& paint, | 104 const SkPaint& paint, |
102 const FloatRect& dstRect, | 105 const FloatRect& dstRect, |
103 const FloatRect& srcRect, | 106 const FloatRect& srcRect, |
104 RespectImageOrientationEnum, | 107 RespectImageOrientationEnum, |
105 ImageClampingMode imageClampingMode) { | 108 ImageClampingMode imageClampingMode, |
| 109 const ColorBehavior& colorBehavior) { |
| 110 // TODO(ccameron): This function should not ignore |colorBehavior|. |
| 111 // https://crbug.com/672306 |
106 checkThread(); | 112 checkThread(); |
107 if (!isValid()) | 113 if (!isValid()) |
108 return; | 114 return; |
109 createImageFromMailboxIfNeeded(); | 115 createImageFromMailboxIfNeeded(); |
110 sk_sp<SkImage> image = m_textureHolder->skImage(); | 116 sk_sp<SkImage> image = m_textureHolder->skImage(); |
111 StaticBitmapImage::drawHelper(canvas, paint, dstRect, srcRect, | 117 StaticBitmapImage::drawHelper(canvas, paint, dstRect, srcRect, |
112 imageClampingMode, image); | 118 imageClampingMode, image); |
113 } | 119 } |
114 | 120 |
115 bool AcceleratedStaticBitmapImage::isValid() { | 121 bool AcceleratedStaticBitmapImage::isValid() { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 173 |
168 void AcceleratedStaticBitmapImage::checkThread() { | 174 void AcceleratedStaticBitmapImage::checkThread() { |
169 if (m_detachThreadAtNextCheck) { | 175 if (m_detachThreadAtNextCheck) { |
170 m_threadChecker.DetachFromThread(); | 176 m_threadChecker.DetachFromThread(); |
171 m_detachThreadAtNextCheck = false; | 177 m_detachThreadAtNextCheck = false; |
172 } | 178 } |
173 CHECK(m_threadChecker.CalledOnValidThread()); | 179 CHECK(m_threadChecker.CalledOnValidThread()); |
174 } | 180 } |
175 | 181 |
176 } // namespace blink | 182 } // namespace blink |
OLD | NEW |