| 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/OffscreenCanvasFrameDispatcherImpl.h" | 5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/quads/texture_draw_quad.h" | 8 #include "cc/quads/texture_draw_quad.h" |
| 9 #include "gpu/command_buffer/client/gles2_interface.h" | 9 #include "gpu/command_buffer/client/gles2_interface.h" |
| 10 #include "platform/Histogram.h" | 10 #include "platform/Histogram.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 info.minRowBytes(), 0, 0); | 101 info.minRowBytes(), 0, 0); |
| 102 | 102 |
| 103 GLuint textureId = 0u; | 103 GLuint textureId = 0u; |
| 104 gl->GenTextures(1, &textureId); | 104 gl->GenTextures(1, &textureId); |
| 105 gl->BindTexture(GL_TEXTURE_2D, textureId); | 105 gl->BindTexture(GL_TEXTURE_2D, textureId); |
| 106 GLenum format = | 106 GLenum format = |
| 107 (kN32_SkColorType == kRGBA_8888_SkColorType) ? GL_RGBA : GL_BGRA_EXT; | 107 (kN32_SkColorType == kRGBA_8888_SkColorType) ? GL_RGBA : GL_BGRA_EXT; |
| 108 gl->TexImage2D(GL_TEXTURE_2D, 0, format, m_width, m_height, 0, format, | 108 gl->TexImage2D(GL_TEXTURE_2D, 0, format, m_width, m_height, 0, format, |
| 109 GL_UNSIGNED_BYTE, 0); | 109 GL_UNSIGNED_BYTE, 0); |
| 110 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 110 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 111 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 112 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 111 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, format, | 113 gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, format, |
| 112 GL_UNSIGNED_BYTE, dstPixels->data()); | 114 GL_UNSIGNED_BYTE, dstPixels->data()); |
| 113 | 115 |
| 114 gpu::Mailbox mailbox; | 116 gpu::Mailbox mailbox; |
| 115 gl->GenMailboxCHROMIUM(mailbox.name); | 117 gl->GenMailboxCHROMIUM(mailbox.name); |
| 116 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 118 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 117 | 119 |
| 118 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); | 120 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); |
| 119 gl->ShallowFlushCHROMIUM(); | 121 gl->ShallowFlushCHROMIUM(); |
| 120 gpu::SyncToken syncToken; | 122 gpu::SyncToken syncToken; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 330 } |
| 329 | 331 |
| 330 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( | 332 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( |
| 331 const sk_sp<SkImage>& image) { | 333 const sk_sp<SkImage>& image) { |
| 332 if (image && image->width() == m_width && image->height() == m_height) | 334 if (image && image->width() == m_width && image->height() == m_height) |
| 333 return true; | 335 return true; |
| 334 return false; | 336 return false; |
| 335 } | 337 } |
| 336 | 338 |
| 337 } // namespace blink | 339 } // namespace blink |
| OLD | NEW |