Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 uint32 sync_point) { | 134 uint32 sync_point) { |
| 135 return helper_->ConsumeMailboxToTexture(mailbox, sync_point); | 135 return helper_->ConsumeMailboxToTexture(mailbox, sync_point); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void CropScaleReadbackAndCleanTexture( | 138 void CropScaleReadbackAndCleanTexture( |
| 139 GLuint src_texture, | 139 GLuint src_texture, |
| 140 const gfx::Size& src_size, | 140 const gfx::Size& src_size, |
| 141 const gfx::Rect& src_subrect, | 141 const gfx::Rect& src_subrect, |
| 142 const gfx::Size& dst_size, | 142 const gfx::Size& dst_size, |
| 143 unsigned char* out, | 143 unsigned char* out, |
| 144 const SkColorType color_type, | 144 const SkColorType out_color_type, |
| 145 const base::Callback<void(bool)>& callback, | 145 const base::Callback<void(bool)>& callback, |
| 146 GLHelper::ScalerQuality quality); | 146 GLHelper::ScalerQuality quality); |
| 147 | 147 |
| 148 void ReadbackTextureSync(GLuint texture, | 148 void ReadbackTextureSync(GLuint texture, |
| 149 const gfx::Rect& src_rect, | 149 const gfx::Rect& src_rect, |
| 150 unsigned char* out, | 150 unsigned char* out, |
| 151 SkColorType format); | 151 SkColorType format); |
| 152 | 152 |
| 153 void ReadbackTextureAsync(GLuint texture, | 153 void ReadbackTextureAsync(GLuint texture, |
| 154 const gfx::Size& dst_size, | 154 const gfx::Size& dst_size, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 // |src_size| is the size of |src_texture|. | 312 // |src_size| is the size of |src_texture|. |
| 313 GLuint ScaleTexture(GLuint src_texture, | 313 GLuint ScaleTexture(GLuint src_texture, |
| 314 const gfx::Size& src_size, | 314 const gfx::Size& src_size, |
| 315 const gfx::Rect& src_subrect, | 315 const gfx::Rect& src_subrect, |
| 316 const gfx::Size& dst_size, | 316 const gfx::Size& dst_size, |
| 317 bool vertically_flip_texture, | 317 bool vertically_flip_texture, |
| 318 bool swizzle, | 318 bool swizzle, |
| 319 SkColorType color_type, | 319 SkColorType color_type, |
| 320 GLHelper::ScalerQuality quality); | 320 GLHelper::ScalerQuality quality); |
| 321 | 321 |
| 322 // Converts each four consecutive pixels of the source texture into one pixel | |
| 323 // in the result texture with each pixel channel representing the grayscale | |
| 324 // color of one of the four original pixels: | |
| 325 // R1B1G1A1 R2B2G2A2 R3B3G3A3 R4G4B4A4 -> X1X2X3X4 | |
| 326 // The resulting texture is still an RGBA texture (which is ~4 times narrower | |
| 327 // than the original). If rendered directly, it wouldn't show anything useful, | |
| 328 // but the data in it can be used to construct a grayscale image. | |
| 329 // |encoded_texture_size| is the exact size of the resulting RGBA texture. It | |
| 330 // is equal to src_size.width()/4 rounded upwards. Some channels in the last | |
| 331 // pixel ((-src_size.width()) % 4) to be exact) are padding and don't contain | |
| 332 // useful data. | |
| 333 GLuint EncodeTextureAsGrayscale(GLuint src_texture, | |
| 334 const gfx::Size& src_size, | |
| 335 gfx::Size* const encoded_texture_size, | |
| 336 bool vertically_flip_texture, | |
| 337 bool swizzle); | |
| 338 | |
| 322 static void nullcallback(bool success) {} | 339 static void nullcallback(bool success) {} |
| 323 void ReadbackDone(Request *request, int bytes_per_pixel); | 340 void ReadbackDone(Request *request, int bytes_per_pixel); |
| 324 void FinishRequest(Request* request, bool result); | 341 void FinishRequest(Request* request, bool result); |
| 325 void CancelRequests(); | 342 void CancelRequests(); |
| 326 | 343 |
| 327 static const float kRGBtoYColorWeights[]; | 344 static const float kRGBtoYColorWeights[]; |
| 328 static const float kRGBtoUColorWeights[]; | 345 static const float kRGBtoUColorWeights[]; |
| 329 static const float kRGBtoVColorWeights[]; | 346 static const float kRGBtoVColorWeights[]; |
| 347 static const float kRGBtoGrayscaleColorWeights[]; | |
| 330 | 348 |
| 331 GLES2Interface* gl_; | 349 GLES2Interface* gl_; |
| 332 gpu::ContextSupport* context_support_; | 350 gpu::ContextSupport* context_support_; |
| 333 GLHelper* helper_; | 351 GLHelper* helper_; |
| 334 | 352 |
| 335 // A scoped flush that will ensure all resource deletions are flushed when | 353 // A scoped flush that will ensure all resource deletions are flushed when |
| 336 // this object is destroyed. Must be declared before other Scoped* fields. | 354 // this object is destroyed. Must be declared before other Scoped* fields. |
| 337 ScopedFlush flush_; | 355 ScopedFlush flush_; |
| 338 | 356 |
| 339 std::queue<Request*> request_queue_; | 357 std::queue<Request*> request_queue_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 dst_size.height(), | 418 dst_size.height(), |
| 401 0, | 419 0, |
| 402 format, | 420 format, |
| 403 type, | 421 type, |
| 404 NULL); | 422 NULL); |
| 405 } | 423 } |
| 406 scaler->Scale(src_texture, dst_texture); | 424 scaler->Scale(src_texture, dst_texture); |
| 407 return dst_texture; | 425 return dst_texture; |
| 408 } | 426 } |
| 409 | 427 |
| 428 GLuint GLHelper::CopyTextureToImpl::EncodeTextureAsGrayscale( | |
| 429 GLuint src_texture, | |
| 430 const gfx::Size& src_size, | |
| 431 gfx::Size* const encoded_texture_size, | |
| 432 bool vertically_flip_texture, | |
| 433 bool swizzle) { | |
| 434 LOG(ERROR) << "GLHelper::CopyTextureToImpl::EncodeTextureAsGrayscale"; | |
| 435 | |
| 436 GLuint dst_texture = 0u; | |
| 437 gl_->GenTextures(1, &dst_texture); | |
| 438 // The size of the encoded texture. | |
| 439 *encoded_texture_size = | |
| 440 gfx::Size((src_size.width() + 3) / 4, src_size.height()); | |
| 441 { | |
| 442 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); | |
| 443 gl_->TexImage2D(GL_TEXTURE_2D, | |
| 444 0, | |
| 445 GL_BGRA_EXT, | |
| 446 encoded_texture_size->width(), | |
| 447 encoded_texture_size->height(), | |
| 448 0, | |
| 449 GL_BGRA_EXT, | |
|
no sievers
2014/07/18 19:27:13
Is it more straightforward to use GL_RGBA here if
mfomitchev
2014/08/12 21:52:04
I am getting the same result regardless of whether
| |
| 450 GL_UNSIGNED_BYTE, | |
| 451 NULL); | |
| 452 } | |
| 453 | |
| 454 helper_->InitScalerImpl(); | |
| 455 scoped_ptr<ScalerInterface> grayscale_scaler( | |
| 456 helper_->scaler_impl_.get()->CreatePlanarScaler( | |
| 457 src_size, | |
| 458 gfx::Rect(0, 0, (src_size.width() + 3) & ~3, src_size.height()), | |
| 459 *encoded_texture_size, | |
| 460 vertically_flip_texture, | |
| 461 (swizzle == kSwizzleBGRA), | |
|
no sievers
2014/07/18 19:27:12
Here you are comparing a bool to an enum. Did you
mfomitchev
2014/08/12 21:52:04
Just using the bool swizzle that's passed in now.
| |
| 462 kRGBtoGrayscaleColorWeights)); | |
| 463 grayscale_scaler->Scale(src_texture, dst_texture); | |
| 464 return dst_texture; | |
| 465 } | |
| 466 | |
| 410 void GLHelper::CopyTextureToImpl::ReadbackAsync( | 467 void GLHelper::CopyTextureToImpl::ReadbackAsync( |
| 411 const gfx::Size& dst_size, | 468 const gfx::Size& dst_size, |
| 412 int32 bytes_per_row, | 469 int32 bytes_per_row, |
| 413 int32 row_stride_bytes, | 470 int32 row_stride_bytes, |
| 414 unsigned char* out, | 471 unsigned char* out, |
| 415 const SkColorType color_type, | 472 const SkColorType color_type, |
| 416 ReadbackSwizzle swizzle, | 473 ReadbackSwizzle swizzle, |
| 417 const base::Callback<void(bool)>& callback) { | 474 const base::Callback<void(bool)>& callback) { |
| 418 if (!IsReadbackConfigSupported(color_type)) { | 475 if (!IsReadbackConfigSupported(color_type)) { |
| 419 callback.Run(false); | 476 callback.Run(false); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 435 break; | 492 break; |
| 436 case kRGB_565_SkColorType: | 493 case kRGB_565_SkColorType: |
| 437 format = GL_RGB; | 494 format = GL_RGB; |
| 438 type = GL_UNSIGNED_SHORT_5_6_5; | 495 type = GL_UNSIGNED_SHORT_5_6_5; |
| 439 bytes_per_pixel = 2; | 496 bytes_per_pixel = 2; |
| 440 break; | 497 break; |
| 441 default: | 498 default: |
| 442 NOTREACHED(); | 499 NOTREACHED(); |
| 443 break; | 500 break; |
| 444 } | 501 } |
| 502 | |
| 445 gl_->GenBuffers(1, &request->buffer); | 503 gl_->GenBuffers(1, &request->buffer); |
| 446 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); | 504 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); |
| 447 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, | 505 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, |
| 448 bytes_per_pixel * dst_size.GetArea(), | 506 bytes_per_pixel * dst_size.GetArea(), |
| 449 NULL, | 507 NULL, |
| 450 GL_STREAM_READ); | 508 GL_STREAM_READ); |
| 451 | 509 |
| 452 request->query = 0u; | 510 request->query = 0u; |
| 453 gl_->GenQueriesEXT(1, &request->query); | 511 gl_->GenQueriesEXT(1, &request->query); |
| 454 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); | 512 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); |
| 455 gl_->ReadPixels(0, | 513 gl_->ReadPixels( |
| 456 0, | 514 0, 0, dst_size.width(), dst_size.height(), format, type, NULL); |
| 457 dst_size.width(), | |
| 458 dst_size.height(), | |
| 459 format, | |
| 460 type, | |
| 461 NULL); | |
| 462 gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); | 515 gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); |
| 463 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); | 516 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 464 context_support_->SignalQuery( | 517 context_support_->SignalQuery( |
| 465 request->query, | 518 request->query, |
| 466 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), | 519 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), |
| 467 request, bytes_per_pixel)); | 520 request, bytes_per_pixel)); |
| 468 } | 521 } |
| 522 | |
| 469 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( | 523 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( |
| 470 GLuint src_texture, | 524 GLuint src_texture, |
| 471 const gfx::Size& src_size, | 525 const gfx::Size& src_size, |
| 472 const gfx::Rect& src_subrect, | 526 const gfx::Rect& src_subrect, |
| 473 const gfx::Size& dst_size, | 527 const gfx::Size& dst_size, |
| 474 unsigned char* out, | 528 unsigned char* out, |
| 475 const SkColorType color_type, | 529 const SkColorType out_color_type, |
| 476 const base::Callback<void(bool)>& callback, | 530 const base::Callback<void(bool)>& callback, |
| 477 GLHelper::ScalerQuality quality) { | 531 GLHelper::ScalerQuality quality) { |
| 478 if (!IsReadbackConfigSupported(color_type)) { | 532 if (out_color_type != kAlpha_8_SkColorType && |
| 533 !IsReadbackConfigSupported(out_color_type)) { | |
| 479 callback.Run(false); | 534 callback.Run(false); |
| 480 return; | 535 return; |
| 481 } | 536 } |
| 482 GLuint texture = ScaleTexture(src_texture, | 537 |
| 483 src_size, | 538 GLuint texture = src_texture; |
| 484 src_subrect, | 539 bool swizzle = |
| 485 dst_size, | |
| 486 true, | |
| 487 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT | 540 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT |
| 488 true, | 541 true; |
| 489 #else | 542 #else |
| 490 false, | 543 false; |
| 491 #endif | 544 #endif |
| 492 color_type, | 545 |
| 493 quality); | 546 // Scale texture if needed |
| 494 DCHECK(texture); | 547 // Optimization: SCALER_QUALITY_FAST is just a single bilinear pass, which we |
| 548 // can do just as well in EncodeTextureAsGrayscale if we need to output A8 | |
| 549 // color type, so let's skip the actual scaling in that case. | |
| 550 bool scale_texture = out_color_type != kAlpha_8_SkColorType || | |
| 551 quality != GLHelper::SCALER_QUALITY_FAST; | |
| 552 if (scale_texture) { | |
| 553 LOG(ERROR) << "+++ Scaling texture"; | |
| 554 texture = | |
| 555 ScaleTexture(src_texture, | |
| 556 src_size, | |
| 557 src_subrect, | |
| 558 dst_size, | |
| 559 true, | |
| 560 out_color_type == kAlpha_8_SkColorType ? false : swizzle, | |
| 561 out_color_type == kAlpha_8_SkColorType ? kN32_SkColorType | |
| 562 : out_color_type, | |
| 563 quality); | |
| 564 DCHECK(texture); | |
| 565 } | |
| 566 | |
| 567 // Encode texture to grayscale if needed | |
| 568 gfx::Size readback_texture_size = dst_size; | |
| 569 | |
| 570 if (out_color_type == kAlpha_8_SkColorType) { | |
| 571 texture = EncodeTextureAsGrayscale( | |
| 572 texture, | |
| 573 dst_size, | |
| 574 &readback_texture_size, | |
| 575 !scale_texture, // Do the vertical flip here if we haven't already | |
| 576 // done it in the scale step. | |
| 577 swizzle); | |
| 578 DCHECK(texture); | |
| 579 } | |
| 580 | |
| 581 // Readback the pixels of the resulting texture | |
| 495 ScopedFramebuffer dst_framebuffer(gl_); | 582 ScopedFramebuffer dst_framebuffer(gl_); |
| 496 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, | 583 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, |
| 497 dst_framebuffer); | 584 dst_framebuffer); |
| 498 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); | 585 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); |
| 499 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, | 586 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, |
| 500 GL_COLOR_ATTACHMENT0, | 587 GL_COLOR_ATTACHMENT0, |
| 501 GL_TEXTURE_2D, | 588 GL_TEXTURE_2D, |
| 502 texture, | 589 texture, |
| 503 0); | 590 0); |
| 504 int bytes_per_pixel = 4; | 591 int bytes_per_pixel = 4; |
| 505 switch (color_type) { | 592 ReadbackSwizzle readback_swizzle = kSwizzleNone; |
| 593 SkColorType readback_color_type = out_color_type; | |
| 594 switch (out_color_type) { | |
| 506 case kN32_SkColorType: | 595 case kN32_SkColorType: |
| 507 // Do nothing params already set. | 596 // Do nothing params already set. |
| 508 break; | 597 break; |
| 509 case kRGB_565_SkColorType: | 598 case kRGB_565_SkColorType: |
| 510 bytes_per_pixel = 2; | 599 bytes_per_pixel = 2; |
| 511 break; | 600 break; |
| 601 case kAlpha_8_SkColorType: | |
| 602 bytes_per_pixel = 1; | |
| 603 readback_swizzle = kSwizzleBGRA; | |
| 604 readback_color_type = kN32_SkColorType; | |
| 605 break; | |
| 512 default: | 606 default: |
| 513 NOTREACHED(); | 607 NOTREACHED(); |
| 514 break; | 608 break; |
| 515 } | 609 } |
| 516 ReadbackAsync(dst_size, | 610 ReadbackAsync(readback_texture_size, |
| 517 dst_size.width() * bytes_per_pixel, | 611 dst_size.width() * bytes_per_pixel, |
| 518 dst_size.width() * bytes_per_pixel, | 612 dst_size.width() * bytes_per_pixel, |
| 519 out, | 613 out, |
| 520 color_type, | 614 readback_color_type, |
| 521 kSwizzleNone, | 615 readback_swizzle, |
| 522 callback); | 616 callback); |
| 523 gl_->DeleteTextures(1, &texture); | 617 gl_->DeleteTextures(1, &texture); |
| 524 } | 618 } |
| 525 | 619 |
| 526 void GLHelper::CopyTextureToImpl::ReadbackTextureSync( | 620 void GLHelper::CopyTextureToImpl::ReadbackTextureSync( |
| 527 GLuint texture, | 621 GLuint texture, |
| 528 const gfx::Rect& src_rect, | 622 const gfx::Rect& src_rect, |
| 529 unsigned char* out, | 623 unsigned char* out, |
| 530 SkColorType color_type) { | 624 SkColorType color_type) { |
| 531 if (!IsReadbackConfigSupported(color_type)) | 625 if (!IsReadbackConfigSupported(color_type)) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 readback_support_(new GLHelperReadbackSupport(gl)) {} | 769 readback_support_(new GLHelperReadbackSupport(gl)) {} |
| 676 | 770 |
| 677 GLHelper::~GLHelper() {} | 771 GLHelper::~GLHelper() {} |
| 678 | 772 |
| 679 void GLHelper::CropScaleReadbackAndCleanTexture( | 773 void GLHelper::CropScaleReadbackAndCleanTexture( |
| 680 GLuint src_texture, | 774 GLuint src_texture, |
| 681 const gfx::Size& src_size, | 775 const gfx::Size& src_size, |
| 682 const gfx::Rect& src_subrect, | 776 const gfx::Rect& src_subrect, |
| 683 const gfx::Size& dst_size, | 777 const gfx::Size& dst_size, |
| 684 unsigned char* out, | 778 unsigned char* out, |
| 685 const SkColorType color_type, | 779 const SkColorType out_color_type, |
| 686 const base::Callback<void(bool)>& callback, | 780 const base::Callback<void(bool)>& callback, |
| 687 GLHelper::ScalerQuality quality) { | 781 GLHelper::ScalerQuality quality) { |
| 688 InitCopyTextToImpl(); | 782 InitCopyTextToImpl(); |
| 689 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( | 783 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture(src_texture, |
| 690 src_texture, | 784 src_size, |
| 691 src_size, | 785 src_subrect, |
| 692 src_subrect, | 786 dst_size, |
| 693 dst_size, | 787 out, |
| 694 out, | 788 out_color_type, |
| 695 color_type, | 789 callback, |
| 696 callback, | 790 quality); |
| 697 quality); | |
| 698 } | 791 } |
| 699 | 792 |
| 700 void GLHelper::CropScaleReadbackAndCleanMailbox( | 793 void GLHelper::CropScaleReadbackAndCleanMailbox( |
| 701 const gpu::Mailbox& src_mailbox, | 794 const gpu::Mailbox& src_mailbox, |
| 702 uint32 sync_point, | 795 uint32 sync_point, |
| 703 const gfx::Size& src_size, | 796 const gfx::Size& src_size, |
| 704 const gfx::Rect& src_subrect, | 797 const gfx::Rect& src_subrect, |
| 705 const gfx::Size& dst_size, | 798 const gfx::Size& dst_size, |
| 706 unsigned char* out, | 799 unsigned char* out, |
| 707 const SkColorType color_type, | 800 const SkColorType out_color_type, |
| 708 const base::Callback<void(bool)>& callback, | 801 const base::Callback<void(bool)>& callback, |
| 709 GLHelper::ScalerQuality quality) { | 802 GLHelper::ScalerQuality quality) { |
| 710 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); | 803 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); |
| 711 CropScaleReadbackAndCleanTexture( | 804 CropScaleReadbackAndCleanTexture(mailbox_texture, |
| 712 mailbox_texture, src_size, src_subrect, dst_size, out, | 805 src_size, |
| 713 color_type, | 806 src_subrect, |
| 714 callback, | 807 dst_size, |
| 715 quality); | 808 out, |
| 809 out_color_type, | |
| 810 callback, | |
| 811 quality); | |
| 716 gl_->DeleteTextures(1, &mailbox_texture); | 812 gl_->DeleteTextures(1, &mailbox_texture); |
| 717 } | 813 } |
| 718 | 814 |
| 719 void GLHelper::ReadbackTextureSync(GLuint texture, | 815 void GLHelper::ReadbackTextureSync(GLuint texture, |
| 720 const gfx::Rect& src_rect, | 816 const gfx::Rect& src_rect, |
| 721 unsigned char* out, | 817 unsigned char* out, |
| 722 SkColorType format) { | 818 SkColorType format) { |
| 723 InitCopyTextToImpl(); | 819 InitCopyTextToImpl(); |
| 724 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); | 820 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); |
| 725 } | 821 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 swizzle, | 1017 swizzle, |
| 922 callback); | 1018 callback); |
| 923 } | 1019 } |
| 924 | 1020 |
| 925 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { | 1021 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { |
| 926 0.257f, 0.504f, 0.098f, 0.0625f}; | 1022 0.257f, 0.504f, 0.098f, 0.0625f}; |
| 927 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { | 1023 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { |
| 928 -0.148f, -0.291f, 0.439f, 0.5f}; | 1024 -0.148f, -0.291f, 0.439f, 0.5f}; |
| 929 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { | 1025 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { |
| 930 0.439f, -0.368f, -0.071f, 0.5f}; | 1026 0.439f, -0.368f, -0.071f, 0.5f}; |
| 1027 const float GLHelper::CopyTextureToImpl::kRGBtoGrayscaleColorWeights[] = { | |
| 1028 0.213f, 0.715f, 0.072f, 0.0f}; | |
| 931 | 1029 |
| 932 // YUV readback constructors. Initiates the main scaler pipeline and | 1030 // YUV readback constructors. Initiates the main scaler pipeline and |
| 933 // one planar scaler for each of the Y, U and V planes. | 1031 // one planar scaler for each of the Y, U and V planes. |
| 934 GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl( | 1032 GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl( |
| 935 GLES2Interface* gl, | 1033 GLES2Interface* gl, |
| 936 CopyTextureToImpl* copy_impl, | 1034 CopyTextureToImpl* copy_impl, |
| 937 GLHelperScaling* scaler_impl, | 1035 GLHelperScaling* scaler_impl, |
| 938 GLHelper::ScalerQuality quality, | 1036 GLHelper::ScalerQuality quality, |
| 939 const gfx::Size& src_size, | 1037 const gfx::Size& src_size, |
| 940 const gfx::Rect& src_subrect, | 1038 const gfx::Rect& src_subrect, |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1253 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, | 1351 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, |
| 1254 src_size, | 1352 src_size, |
| 1255 src_subrect, | 1353 src_subrect, |
| 1256 dst_size, | 1354 dst_size, |
| 1257 dst_subrect, | 1355 dst_subrect, |
| 1258 flip_vertically, | 1356 flip_vertically, |
| 1259 use_mrt); | 1357 use_mrt); |
| 1260 } | 1358 } |
| 1261 | 1359 |
| 1262 } // namespace content | 1360 } // namespace content |
| OLD | NEW |