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

Side by Side Diff: content/common/gpu/client/gl_helper.cc

Issue 88033002: Add RGB565 Texture readback support in gl_helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for RGB565 format texture readback in gl_helper Created 7 years 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
« no previous file with comments | « content/common/gpu/client/gl_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/common/gpu/client/gl_helper.h" 5 #include "content/common/gpu/client/gl_helper.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 uint32 sync_point) { 132 uint32 sync_point) {
133 return helper_->ConsumeMailboxToTexture(mailbox, sync_point); 133 return helper_->ConsumeMailboxToTexture(mailbox, sync_point);
134 } 134 }
135 135
136 void CropScaleReadbackAndCleanTexture( 136 void CropScaleReadbackAndCleanTexture(
137 WebGLId src_texture, 137 WebGLId src_texture,
138 const gfx::Size& src_size, 138 const gfx::Size& src_size,
139 const gfx::Rect& src_subrect, 139 const gfx::Rect& src_subrect,
140 const gfx::Size& dst_size, 140 const gfx::Size& dst_size,
141 unsigned char* out, 141 unsigned char* out,
142 bool readback_config_rgb565,
142 const base::Callback<void(bool)>& callback, 143 const base::Callback<void(bool)>& callback,
143 GLHelper::ScalerQuality quality); 144 GLHelper::ScalerQuality quality);
144 145
146 WebGLId CopyTo565Texture(const gfx::Size& dst_size);
147
145 void ReadbackTextureSync(WebGLId texture, 148 void ReadbackTextureSync(WebGLId texture,
146 const gfx::Rect& src_rect, 149 const gfx::Rect& src_rect,
147 unsigned char* out); 150 unsigned char* out);
148 151
149 // Reads back bytes from the currently bound frame buffer. 152 // Reads back bytes from the currently bound frame buffer.
150 // Note that dst_size is specified in bytes, not pixels. 153 // Note that dst_size is specified in bytes, not pixels.
151 void ReadbackAsync( 154 void ReadbackAsync(
152 const gfx::Size& dst_size, 155 const gfx::Size& dst_size,
153 int32 bytes_per_row, // generally dst_size.width() * 4 156 int32 bytes_per_row, // generally dst_size.width() * 4
154 int32 row_stride_bytes, // generally dst_size.width() * 4 157 int32 row_stride_bytes, // generally dst_size.width() * 4
155 unsigned char* out, 158 unsigned char* out,
159 bool readback_config_rgb565,
160 int readback_factor,
156 const base::Callback<void(bool)>& callback); 161 const base::Callback<void(bool)>& callback);
157 162
158 void ReadbackPlane(TextureFrameBufferPair* source, 163 void ReadbackPlane(TextureFrameBufferPair* source,
159 const scoped_refptr<media::VideoFrame>& target, 164 const scoped_refptr<media::VideoFrame>& target,
160 int plane, 165 int plane,
161 int size_shift, 166 int size_shift,
162 const gfx::Rect& dst_subrect, 167 const gfx::Rect& dst_subrect,
163 const base::Callback<void(bool)>& callback); 168 const base::Callback<void(bool)>& callback);
164 169
165 blink::WebGLId CopyAndScaleTexture(WebGLId texture, 170 blink::WebGLId CopyAndScaleTexture(WebGLId texture,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // |src_size| is the size of |src_texture|. 306 // |src_size| is the size of |src_texture|.
302 WebGLId ScaleTexture(WebGLId src_texture, 307 WebGLId ScaleTexture(WebGLId src_texture,
303 const gfx::Size& src_size, 308 const gfx::Size& src_size,
304 const gfx::Rect& src_subrect, 309 const gfx::Rect& src_subrect,
305 const gfx::Size& dst_size, 310 const gfx::Size& dst_size,
306 bool vertically_flip_texture, 311 bool vertically_flip_texture,
307 bool swizzle, 312 bool swizzle,
308 GLHelper::ScalerQuality quality); 313 GLHelper::ScalerQuality quality);
309 314
310 static void nullcallback(bool success) {} 315 static void nullcallback(bool success) {}
311 void ReadbackDone(Request *request); 316 void ReadbackDone(Request *request,int readback_factor);
312 void FinishRequest(Request* request, bool result); 317 void FinishRequest(Request* request, bool result);
313 void CancelRequests(); 318 void CancelRequests();
314 319
315 static const float kRGBtoYColorWeights[]; 320 static const float kRGBtoYColorWeights[];
316 static const float kRGBtoUColorWeights[]; 321 static const float kRGBtoUColorWeights[];
317 static const float kRGBtoVColorWeights[]; 322 static const float kRGBtoVColorWeights[];
318 323
319 WebGraphicsContext3D* context_; 324 WebGraphicsContext3D* context_;
320 gpu::ContextSupport* context_support_; 325 gpu::ContextSupport* context_support_;
321 GLHelper* helper_; 326 GLHelper* helper_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, dst_texture); 370 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, dst_texture);
366 context_->texImage2D(GL_TEXTURE_2D, 371 context_->texImage2D(GL_TEXTURE_2D,
367 0, 372 0,
368 GL_RGBA, 373 GL_RGBA,
369 dst_size.width(), 374 dst_size.width(),
370 dst_size.height(), 375 dst_size.height(),
371 0, 376 0,
372 GL_RGBA, 377 GL_RGBA,
373 GL_UNSIGNED_BYTE, 378 GL_UNSIGNED_BYTE,
374 NULL); 379 NULL);
375 } 380 }
376 scaler->Scale(src_texture, dst_texture); 381 scaler->Scale(src_texture, dst_texture);
377 return dst_texture; 382 return dst_texture;
378 } 383 }
379 384
380 void GLHelper::CopyTextureToImpl::ReadbackAsync( 385 void GLHelper::CopyTextureToImpl::ReadbackAsync(
381 const gfx::Size& dst_size, 386 const gfx::Size& dst_size,
382 int32 bytes_per_row, 387 int32 bytes_per_row,
383 int32 row_stride_bytes, 388 int32 row_stride_bytes,
384 unsigned char* out, 389 unsigned char* out,
390 bool readback_config_rgb565,
391 int readback_factor,
hubbe 2013/12/26 21:41:49 readback_factor is redundant and not well named. J
385 const base::Callback<void(bool)>& callback) { 392 const base::Callback<void(bool)>& callback) {
386 Request* request = new Request(dst_size, 393 Request* request = new Request(dst_size,
387 bytes_per_row, 394 bytes_per_row,
388 row_stride_bytes, 395 row_stride_bytes,
389 out, 396 out,
390 callback); 397 callback);
391 request_queue_.push(request); 398 request_queue_.push(request);
392 request->buffer = context_->createBuffer(); 399 request->buffer = context_->createBuffer();
393 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 400 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
394 request->buffer); 401 request->buffer);
395 context_->bufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 402 context_->bufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
396 4 * dst_size.GetArea(), 403 readback_factor * dst_size.GetArea(),
397 NULL, 404 NULL,
398 GL_STREAM_READ); 405 GL_STREAM_READ);
399 406
400 request->query = context_->createQueryEXT(); 407 request->query = context_->createQueryEXT();
401 context_->beginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, 408 context_->beginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM,
402 request->query); 409 request->query);
403 context_->readPixels(0, 0, dst_size.width(), dst_size.height(), 410 if(readback_config_rgb565){
411 context_->readPixels(0, 0, dst_size.width(), dst_size.height(),
412 GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL);
413 }else{
414 context_->readPixels(0, 0, dst_size.width(), dst_size.height(),
404 GL_RGBA, GL_UNSIGNED_BYTE, NULL); 415 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
416 }
405 context_->endQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); 417 context_->endQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM);
406 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); 418 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
407 context_support_->SignalQuery( 419 context_support_->SignalQuery(
408 request->query, 420 request->query,
409 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); 421 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(),
422 request, readback_factor));
410 } 423 }
411 424 WebGLId GLHelper::CopyTextureToImpl::CopyTo565Texture(const gfx::Size& dst_size)
412 425 {
426 //Using copy to texture
hubbe 2013/12/26 21:41:49 Nit: Space after //
427 WebGLId dst_rgb_565_texture = context_->createTexture();
428 {
429 ScopedTextureBinder<GL_TEXTURE_2D> rgb_texture_binder(context_,
430 dst_rgb_565_texture);
431 context_->texImage2D(GL_TEXTURE_2D,
432 0,
433 GL_RGB,
434 dst_size.width(),
435 dst_size.height(),
436 0,
437 GL_RGB,
438 GL_UNSIGNED_SHORT_5_6_5,
439 NULL);
440 context_->copyTexSubImage2D(GL_TEXTURE_2D, 0,
441 0, 0,
442 0, 0,
443 dst_size.width(), dst_size.height());
444 }
445 return dst_rgb_565_texture;
446 }
413 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( 447 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture(
414 WebGLId src_texture, 448 WebGLId src_texture,
415 const gfx::Size& src_size, 449 const gfx::Size& src_size,
416 const gfx::Rect& src_subrect, 450 const gfx::Rect& src_subrect,
417 const gfx::Size& dst_size, 451 const gfx::Size& dst_size,
418 unsigned char* out, 452 unsigned char* out,
453 bool readback_config_rgb565,
419 const base::Callback<void(bool)>& callback, 454 const base::Callback<void(bool)>& callback,
420 GLHelper::ScalerQuality quality) { 455 GLHelper::ScalerQuality quality) {
421 WebGLId texture = ScaleTexture(src_texture, 456 WebGLId texture = ScaleTexture(src_texture,
422 src_size, 457 src_size,
423 src_subrect, 458 src_subrect,
424 dst_size, 459 dst_size,
425 true, 460 true,
426 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT 461 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
427 true, 462 true,
428 #else 463 #else
429 false, 464 false,
430 #endif 465 #endif
431 quality); 466 quality);
432 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); 467 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer());
433 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(context_, 468 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(context_,
434 dst_framebuffer); 469 dst_framebuffer);
435 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, texture); 470 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, texture);
436 context_->framebufferTexture2D(GL_FRAMEBUFFER, 471 context_->framebufferTexture2D(GL_FRAMEBUFFER,
437 GL_COLOR_ATTACHMENT0, 472 GL_COLOR_ATTACHMENT0,
438 GL_TEXTURE_2D, 473 GL_TEXTURE_2D,
439 texture, 474 texture,
440 0); 475 0);
476 int readback_factor = 0;
hubbe 2013/12/26 21:41:49 readback_factor -> bytes_per_pixel
477 if(readback_config_rgb565){
478 readback_factor = 2;
479 }else{
480 readback_factor = 4;
481 }
482 WebGLId dst_rgb_565_texture = 0;
483 if(readback_config_rgb565){
484 dst_rgb_565_texture = CopyTo565Texture(dst_size);
hubbe 2013/12/26 21:41:49 It would (probably) be faster to have the scaler w
485 ScopedTextureBinder<GL_TEXTURE_2D> rgb_texture_binder(context_,
486 dst_rgb_565_texture);
487 context_->framebufferTexture2D(GL_FRAMEBUFFER,
488 GL_COLOR_ATTACHMENT0,
489 GL_TEXTURE_2D,
490 dst_rgb_565_texture,
491 0);
492 //Check format of read after binding with fbo.
hubbe 2013/12/26 21:41:49 Space after //
493 int ext_format, ext_type;
494 context_->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &ext_format);
495 context_->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &ext_type);
496 if((ext_format != GL_RGB) || (ext_type != GL_UNSIGNED_SHORT_5_6_5)){
hubbe 2013/12/26 21:41:49 This is the wrong place to detect this. This detec
497 LOG(ERROR)<<"Readbackformat rgb565 not supported";
hubbe 2013/12/26 21:41:49 NIT: space around <<
498 context_->deleteTexture(texture);
499 context_->deleteTexture(dst_rgb_565_texture);
500 callback.Run(false);
501 return;
502 }
503 }
441 ReadbackAsync(dst_size, 504 ReadbackAsync(dst_size,
442 dst_size.width() * 4, 505 dst_size.width() * readback_factor,
443 dst_size.width() * 4, 506 dst_size.width() * readback_factor,
444 out, 507 out,
508 readback_config_rgb565,
509 readback_factor,
445 callback); 510 callback);
446 context_->deleteTexture(texture); 511 context_->deleteTexture(texture);
512 if(readback_config_rgb565){
513 context_->deleteTexture(dst_rgb_565_texture);
514 }
447 } 515 }
448 516
449 void GLHelper::CopyTextureToImpl::ReadbackTextureSync( 517 void GLHelper::CopyTextureToImpl::ReadbackTextureSync(
450 WebGLId texture, 518 WebGLId texture,
451 const gfx::Rect& src_rect, 519 const gfx::Rect& src_rect,
452 unsigned char* out) { 520 unsigned char* out) {
453 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); 521 ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer());
454 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(context_, 522 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(context_,
455 dst_framebuffer); 523 dst_framebuffer);
456 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, texture); 524 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, texture);
(...skipping 19 matching lines...) Expand all
476 GLHelper::ScalerQuality quality) { 544 GLHelper::ScalerQuality quality) {
477 return ScaleTexture(src_texture, 545 return ScaleTexture(src_texture,
478 src_size, 546 src_size,
479 gfx::Rect(src_size), 547 gfx::Rect(src_size),
480 dst_size, 548 dst_size,
481 vertically_flip_texture, 549 vertically_flip_texture,
482 false, 550 false,
483 quality); 551 quality);
484 } 552 }
485 553
486 void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request) { 554 void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request,
555 int read_factor) {
487 TRACE_EVENT0("mirror", 556 TRACE_EVENT0("mirror",
488 "GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete"); 557 "GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete");
489 finished_request->done = true; 558 finished_request->done = true;
490 559
491 // We process transfer requests in the order they were received, regardless 560 // We process transfer requests in the order they were received, regardless
492 // of the order we get the callbacks in. 561 // of the order we get the callbacks in.
493 while (!request_queue_.empty()) { 562 while (!request_queue_.empty()) {
494 Request* request = request_queue_.front(); 563 Request* request = request_queue_.front();
495 if (!request->done) { 564 if (!request->done) {
496 break; 565 break;
497 } 566 }
498 567
499 bool result = false; 568 bool result = false;
500 if (request->buffer != 0) { 569 if (request->buffer != 0) {
501 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 570 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
502 request->buffer); 571 request->buffer);
503 unsigned char* data = static_cast<unsigned char *>( 572 unsigned char* data = static_cast<unsigned char *>(
504 context_->mapBufferCHROMIUM( 573 context_->mapBufferCHROMIUM(
505 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY)); 574 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY));
506 if (data) { 575 if (data) {
507 result = true; 576 result = true;
508 if (request->bytes_per_row == request->size.width() * 4 && 577 if (request->bytes_per_row == request->size.width() * read_factor &&
509 request->bytes_per_row == request->row_stride_bytes) { 578 request->bytes_per_row == request->row_stride_bytes) {
510 memcpy(request->pixels, data, request->size.GetArea() * 4); 579 memcpy(request->pixels, data, request->size.GetArea() * read_factor);
511 } else { 580 } else {
512 unsigned char* out = request->pixels; 581 unsigned char* out = request->pixels;
513 for (int y = 0; y < request->size.height(); y++) { 582 for (int y = 0; y < request->size.height(); y++) {
514 memcpy(out, data, request->bytes_per_row); 583 memcpy(out, data, request->bytes_per_row);
515 out += request->row_stride_bytes; 584 out += request->row_stride_bytes;
516 data += request->size.width() * 4; 585 data += request->size.width() * read_factor;
517 } 586 }
518 } 587 }
519 context_->unmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM); 588 context_->unmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM);
520 } 589 }
521 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); 590 context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
522 } 591 }
523 592
524 FinishRequest(request, result); 593 FinishRequest(request, result);
525 } 594 }
526 } 595 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 627
559 GLHelper::~GLHelper() { 628 GLHelper::~GLHelper() {
560 } 629 }
561 630
562 void GLHelper::CropScaleReadbackAndCleanTexture( 631 void GLHelper::CropScaleReadbackAndCleanTexture(
563 WebGLId src_texture, 632 WebGLId src_texture,
564 const gfx::Size& src_size, 633 const gfx::Size& src_size,
565 const gfx::Rect& src_subrect, 634 const gfx::Rect& src_subrect,
566 const gfx::Size& dst_size, 635 const gfx::Size& dst_size,
567 unsigned char* out, 636 unsigned char* out,
637 bool readback_config_rgb565,
568 const base::Callback<void(bool)>& callback) { 638 const base::Callback<void(bool)>& callback) {
569 InitCopyTextToImpl(); 639 InitCopyTextToImpl();
570 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( 640 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture(
571 src_texture, 641 src_texture,
572 src_size, 642 src_size,
573 src_subrect, 643 src_subrect,
574 dst_size, 644 dst_size,
575 out, 645 out,
646 readback_config_rgb565,
576 callback, 647 callback,
577 GLHelper::SCALER_QUALITY_FAST); 648 GLHelper::SCALER_QUALITY_FAST);
578 } 649 }
579 650
580 void GLHelper::CropScaleReadbackAndCleanMailbox( 651 void GLHelper::CropScaleReadbackAndCleanMailbox(
581 const gpu::Mailbox& src_mailbox, 652 const gpu::Mailbox& src_mailbox,
582 uint32 sync_point, 653 uint32 sync_point,
583 const gfx::Size& src_size, 654 const gfx::Size& src_size,
584 const gfx::Rect& src_subrect, 655 const gfx::Rect& src_subrect,
585 const gfx::Size& dst_size, 656 const gfx::Size& dst_size,
586 unsigned char* out, 657 unsigned char* out,
658 bool readback_config_rgb565,
587 const base::Callback<void(bool)>& callback) { 659 const base::Callback<void(bool)>& callback) {
588 WebGLId mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); 660 WebGLId mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point);
589 CropScaleReadbackAndCleanTexture( 661 CropScaleReadbackAndCleanTexture(
590 mailbox_texture, src_size, src_subrect, dst_size, out, callback); 662 mailbox_texture, src_size, src_subrect, dst_size, out,
663 readback_config_rgb565,
664 callback);
591 context_->deleteTexture(mailbox_texture); 665 context_->deleteTexture(mailbox_texture);
592 } 666 }
593 667
594 void GLHelper::ReadbackTextureSync(blink::WebGLId texture, 668 void GLHelper::ReadbackTextureSync(blink::WebGLId texture,
595 const gfx::Rect& src_rect, 669 const gfx::Rect& src_rect,
596 unsigned char* out) { 670 unsigned char* out) {
597 InitCopyTextToImpl(); 671 InitCopyTextToImpl();
598 copy_texture_to_impl_->ReadbackTextureSync(texture, 672 copy_texture_to_impl_->ReadbackTextureSync(texture,
599 src_rect, 673 src_rect,
600 out); 674 out);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 const gfx::Rect& dst_subrect, 840 const gfx::Rect& dst_subrect,
767 const base::Callback<void(bool)>& callback) { 841 const base::Callback<void(bool)>& callback) {
768 context_->bindFramebuffer(GL_FRAMEBUFFER, source->framebuffer()); 842 context_->bindFramebuffer(GL_FRAMEBUFFER, source->framebuffer());
769 size_t offset = target->stride(plane) * (dst_subrect.y() >> size_shift) + 843 size_t offset = target->stride(plane) * (dst_subrect.y() >> size_shift) +
770 (dst_subrect.x() >> size_shift); 844 (dst_subrect.x() >> size_shift);
771 ReadbackAsync( 845 ReadbackAsync(
772 source->size(), 846 source->size(),
773 dst_subrect.width() >> size_shift, 847 dst_subrect.width() >> size_shift,
774 target->stride(plane), 848 target->stride(plane),
775 target->data(plane) + offset, 849 target->data(plane) + offset,
850 false,
851 4,
776 callback); 852 callback);
777 } 853 }
778 854
779 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { 855 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = {
780 0.257f, 0.504f, 0.098f, 0.0625f 856 0.257f, 0.504f, 0.098f, 0.0625f
781 }; 857 };
782 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { 858 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = {
783 -0.148f, -0.291f, 0.439f, 0.5f 859 -0.148f, -0.291f, 0.439f, 0.5f
784 }; 860 };
785 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { 861 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 quality, 1160 quality,
1085 src_size, 1161 src_size,
1086 src_subrect, 1162 src_subrect,
1087 dst_size, 1163 dst_size,
1088 dst_subrect, 1164 dst_subrect,
1089 flip_vertically, 1165 flip_vertically,
1090 use_mrt); 1166 use_mrt);
1091 } 1167 }
1092 1168
1093 } // namespace content 1169 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gl_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698