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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 1551143002: Remove the "target" argument from CopyTextureChromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 108 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
109 109
110 // TODO(dcastagna): avoid this copy once Skia supports native textures 110 // TODO(dcastagna): avoid this copy once Skia supports native textures
111 // with a texture target different than TEXTURE_2D. 111 // with a texture target different than TEXTURE_2D.
112 // crbug.com/505026 112 // crbug.com/505026
113 if (mailbox_holder.texture_target != GL_TEXTURE_2D) { 113 if (mailbox_holder.texture_target != GL_TEXTURE_2D) {
114 unsigned texture_copy = 0; 114 unsigned texture_copy = 0;
115 gl->GenTextures(1, &texture_copy); 115 gl->GenTextures(1, &texture_copy);
116 DCHECK(texture_copy); 116 DCHECK(texture_copy);
117 gl->BindTexture(GL_TEXTURE_2D, texture_copy); 117 gl->BindTexture(GL_TEXTURE_2D, texture_copy);
118 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_textures[i], texture_copy, 118 gl->CopyTextureCHROMIUM(source_textures[i], texture_copy, GL_RGB,
119 GL_RGB, GL_UNSIGNED_BYTE, false, true, false); 119 GL_UNSIGNED_BYTE, false, true, false);
120 120
121 gl->DeleteTextures(1, &source_textures[i]); 121 gl->DeleteTextures(1, &source_textures[i]);
122 source_textures[i] = texture_copy; 122 source_textures[i] = texture_copy;
123 } 123 }
124 } 124 }
125 DCHECK_LE(source_textures[0], 125 DCHECK_LE(source_textures[0],
126 static_cast<unsigned>(std::numeric_limits<int>::max())); 126 static_cast<unsigned>(std::numeric_limits<int>::max()));
127 DCHECK_LE(source_textures[1], 127 DCHECK_LE(source_textures[1],
128 static_cast<unsigned>(std::numeric_limits<int>::max())); 128 static_cast<unsigned>(std::numeric_limits<int>::max()));
129 DCHECK_LE(source_textures[2], 129 DCHECK_LE(source_textures[2],
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); 575 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
576 uint32_t source_texture = gl->CreateAndConsumeTextureCHROMIUM( 576 uint32_t source_texture = gl->CreateAndConsumeTextureCHROMIUM(
577 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 577 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
578 578
579 // The video is stored in a unmultiplied format, so premultiply 579 // The video is stored in a unmultiplied format, so premultiply
580 // if necessary. 580 // if necessary.
581 // Application itself needs to take care of setting the right |flip_y| 581 // Application itself needs to take care of setting the right |flip_y|
582 // value down to get the expected result. 582 // value down to get the expected result.
583 // "flip_y == true" means to reverse the video orientation while 583 // "flip_y == true" means to reverse the video orientation while
584 // "flip_y == false" means to keep the intrinsic orientation. 584 // "flip_y == false" means to keep the intrinsic orientation.
585 gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture, 585 gl->CopyTextureCHROMIUM(source_texture, texture, internal_format, type,
586 internal_format, type, flip_y, premultiply_alpha, 586 flip_y, premultiply_alpha, false);
587 false);
588 587
589 gl->DeleteTextures(1, &source_texture); 588 gl->DeleteTextures(1, &source_texture);
590 gl->Flush(); 589 gl->Flush();
591 590
592 SyncTokenClientImpl client(gl); 591 SyncTokenClientImpl client(gl);
593 video_frame->UpdateReleaseSyncToken(&client); 592 video_frame->UpdateReleaseSyncToken(&client);
594 } 593 }
595 594
596 void SkCanvasVideoRenderer::ResetCache() { 595 void SkCanvasVideoRenderer::ResetCache() {
597 DCHECK(thread_checker_.CalledOnValidThread()); 596 DCHECK(thread_checker_.CalledOnValidThread());
598 // Clear cached values. 597 // Clear cached values.
599 last_image_ = nullptr; 598 last_image_ = nullptr;
600 last_timestamp_ = kNoTimestamp(); 599 last_timestamp_ = kNoTimestamp();
601 } 600 }
602 601
603 } // namespace media 602 } // namespace media
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc ('k') | mojo/gpu/mojo_gles2_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698