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 GLuint TransformTextureToGrayscale(GLuint src_texture, | |
| 327 const gfx::Size& src_size, | |
| 328 const gfx::Rect& src_subrect, | |
| 329 bool swizzle); | |
| 330 | |
| 322 static void nullcallback(bool success) {} | 331 static void nullcallback(bool success) {} |
| 323 void ReadbackDone(Request *request, int bytes_per_pixel); | 332 void ReadbackDone(Request *request, int bytes_per_pixel); |
| 324 void FinishRequest(Request* request, bool result); | 333 void FinishRequest(Request* request, bool result); |
| 325 void CancelRequests(); | 334 void CancelRequests(); |
| 326 | 335 |
| 327 static const float kRGBtoYColorWeights[]; | 336 static const float kRGBtoYColorWeights[]; |
| 328 static const float kRGBtoUColorWeights[]; | 337 static const float kRGBtoUColorWeights[]; |
| 329 static const float kRGBtoVColorWeights[]; | 338 static const float kRGBtoVColorWeights[]; |
| 339 static const float kRGBtoGrayscaleColorWeights[]; | |
| 330 | 340 |
| 331 GLES2Interface* gl_; | 341 GLES2Interface* gl_; |
| 332 gpu::ContextSupport* context_support_; | 342 gpu::ContextSupport* context_support_; |
| 333 GLHelper* helper_; | 343 GLHelper* helper_; |
| 334 | 344 |
| 335 // A scoped flush that will ensure all resource deletions are flushed when | 345 // A scoped flush that will ensure all resource deletions are flushed when |
| 336 // this object is destroyed. Must be declared before other Scoped* fields. | 346 // this object is destroyed. Must be declared before other Scoped* fields. |
| 337 ScopedFlush flush_; | 347 ScopedFlush flush_; |
| 338 | 348 |
| 339 std::queue<Request*> request_queue_; | 349 std::queue<Request*> request_queue_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 dst_size.height(), | 410 dst_size.height(), |
| 401 0, | 411 0, |
| 402 format, | 412 format, |
| 403 type, | 413 type, |
| 404 NULL); | 414 NULL); |
| 405 } | 415 } |
| 406 scaler->Scale(src_texture, dst_texture); | 416 scaler->Scale(src_texture, dst_texture); |
| 407 return dst_texture; | 417 return dst_texture; |
| 408 } | 418 } |
| 409 | 419 |
| 420 GLuint GLHelper::CopyTextureToImpl::TransformTextureToGrayscale( | |
| 421 GLuint src_texture, | |
| 422 const gfx::Size& src_size, | |
| 423 const gfx::Rect& src_subrect, | |
|
no sievers
2014/07/15 19:31:49
|src_subrect| is ignored below?
mfomitchev
2014/07/16 19:16:07
Done.
| |
| 424 bool swizzle) { | |
| 425 LOG(ERROR) << "GLHelper::CopyTextureToImpl::TransformTextureToGrayscale"; | |
| 426 | |
| 427 GLuint dst_texture = 1u; | |
|
mfomitchev
2014/07/11 20:21:33
Should we set the id to 0 instead of 1 here? Does
no sievers
2014/07/15 19:31:49
Yea I'd init to 0, it's what we do in other places
mfomitchev
2014/07/16 19:16:06
Done.
| |
| 428 gl_->GenTextures(1, &dst_texture); | |
| 429 { | |
| 430 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); | |
| 431 gl_->TexImage2D(GL_TEXTURE_2D, | |
| 432 0, | |
| 433 GL_BGRA_EXT, | |
| 434 src_size.width(), | |
| 435 src_size.height(), | |
|
no sievers
2014/07/15 19:31:49
This is the wrong size, shouldn't it be a fourth o
mfomitchev
2014/07/16 19:16:06
Done.
| |
| 436 0, | |
| 437 GL_BGRA_EXT, | |
| 438 GL_UNSIGNED_BYTE, | |
| 439 NULL); | |
| 440 } | |
| 441 | |
| 442 helper_->InitScalerImpl(); | |
| 443 scoped_ptr<ScalerInterface> grayscale_scaler( | |
| 444 helper_->scaler_impl_.get()->CreatePlanarScaler( | |
| 445 src_size, | |
| 446 gfx::Rect(0, 0, (src_size.width() + 3) & ~3, src_size.height()), | |
| 447 gfx::Size((src_size.width() + 3) / 4, src_size.height()), | |
| 448 false, | |
| 449 (swizzle == kSwizzleBGRA), | |
| 450 kRGBtoGrayscaleColorWeights)); | |
| 451 grayscale_scaler->Scale(src_texture, dst_texture); | |
| 452 return dst_texture; | |
| 453 } | |
| 454 | |
| 410 void GLHelper::CopyTextureToImpl::ReadbackAsync( | 455 void GLHelper::CopyTextureToImpl::ReadbackAsync( |
| 411 const gfx::Size& dst_size, | 456 const gfx::Size& dst_size, |
| 412 int32 bytes_per_row, | 457 int32 bytes_per_row, |
| 413 int32 row_stride_bytes, | 458 int32 row_stride_bytes, |
| 414 unsigned char* out, | 459 unsigned char* out, |
| 415 const SkColorType color_type, | 460 const SkColorType color_type, |
| 416 ReadbackSwizzle swizzle, | 461 ReadbackSwizzle swizzle, |
| 417 const base::Callback<void(bool)>& callback) { | 462 const base::Callback<void(bool)>& callback) { |
| 418 if (!IsReadbackConfigSupported(color_type)) { | 463 if (color_type != kAlpha_8_SkColorType && |
| 464 !IsReadbackConfigSupported(color_type)) { | |
| 419 callback.Run(false); | 465 callback.Run(false); |
| 420 return; | 466 return; |
| 421 } | 467 } |
| 422 Request* request = | 468 |
| 423 new Request(dst_size, bytes_per_row, row_stride_bytes, out, callback); | |
| 424 request_queue_.push(request); | |
| 425 request->buffer = 0u; | |
| 426 // Start with ARGB8888 params as any other format which is not | 469 // Start with ARGB8888 params as any other format which is not |
| 427 // supported is already asserted above. | 470 // supported is already asserted above. |
| 428 GLenum format = GL_RGBA, type = GL_UNSIGNED_BYTE; | 471 GLenum format = GL_RGBA, type = GL_UNSIGNED_BYTE; |
| 429 int bytes_per_pixel = 4; | 472 int bytes_per_pixel = 4; |
| 430 | 473 |
| 474 gfx::Size readback_size = dst_size; | |
| 431 switch (color_type) { | 475 switch (color_type) { |
| 432 case kN32_SkColorType: | 476 case kN32_SkColorType: |
| 433 if (swizzle == kSwizzleBGRA) | 477 if (swizzle == kSwizzleBGRA) |
| 434 format = GL_BGRA_EXT; | 478 format = GL_BGRA_EXT; |
| 435 break; | 479 break; |
| 436 case kRGB_565_SkColorType: | 480 case kRGB_565_SkColorType: |
| 437 format = GL_RGB; | 481 format = GL_RGB; |
| 438 type = GL_UNSIGNED_SHORT_5_6_5; | 482 type = GL_UNSIGNED_SHORT_5_6_5; |
| 439 bytes_per_pixel = 2; | 483 bytes_per_pixel = 2; |
| 440 break; | 484 break; |
| 485 case kAlpha_8_SkColorType: | |
| 486 // For readback purposes, treat the texture as BGRA of smaller size. | |
| 487 format = GL_BGRA_EXT; | |
| 488 bytes_per_pixel = 4; | |
| 489 readback_size.set_width((dst_size.width() + 3) / 4); | |
| 441 default: | 490 default: |
| 442 NOTREACHED(); | 491 NOTREACHED(); |
| 443 break; | 492 break; |
| 444 } | 493 } |
| 494 | |
| 495 Request* request = new Request( | |
| 496 readback_size, bytes_per_row, row_stride_bytes, out, callback); | |
| 497 request_queue_.push(request); | |
| 498 request->buffer = 0u; | |
| 445 gl_->GenBuffers(1, &request->buffer); | 499 gl_->GenBuffers(1, &request->buffer); |
| 446 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); | 500 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); |
| 447 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, | 501 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, |
| 448 bytes_per_pixel * dst_size.GetArea(), | 502 bytes_per_pixel * readback_size.GetArea(), |
| 449 NULL, | 503 NULL, |
| 450 GL_STREAM_READ); | 504 GL_STREAM_READ); |
| 451 | 505 |
| 452 request->query = 0u; | 506 request->query = 0u; |
| 453 gl_->GenQueriesEXT(1, &request->query); | 507 gl_->GenQueriesEXT(1, &request->query); |
| 454 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); | 508 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); |
| 455 gl_->ReadPixels(0, | 509 gl_->ReadPixels( |
| 456 0, | 510 0, 0, readback_size.width(), readback_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); | 511 gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); |
| 463 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); | 512 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 464 context_support_->SignalQuery( | 513 context_support_->SignalQuery( |
| 465 request->query, | 514 request->query, |
| 466 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), | 515 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), |
| 467 request, bytes_per_pixel)); | 516 request, bytes_per_pixel)); |
| 468 } | 517 } |
| 518 | |
| 469 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( | 519 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( |
| 470 GLuint src_texture, | 520 GLuint src_texture, |
| 471 const gfx::Size& src_size, | 521 const gfx::Size& src_size, |
| 472 const gfx::Rect& src_subrect, | 522 const gfx::Rect& src_subrect, |
| 473 const gfx::Size& dst_size, | 523 const gfx::Size& dst_size, |
| 474 unsigned char* out, | 524 unsigned char* out, |
| 475 const SkColorType color_type, | 525 const SkColorType out_color_type, |
| 476 const base::Callback<void(bool)>& callback, | 526 const base::Callback<void(bool)>& callback, |
| 477 GLHelper::ScalerQuality quality) { | 527 GLHelper::ScalerQuality quality) { |
| 478 if (!IsReadbackConfigSupported(color_type)) { | 528 if (out_color_type != kAlpha_8_SkColorType && |
| 529 !IsReadbackConfigSupported(out_color_type)) { | |
| 479 callback.Run(false); | 530 callback.Run(false); |
| 480 return; | 531 return; |
| 481 } | 532 } |
| 482 GLuint texture = ScaleTexture(src_texture, | 533 |
| 483 src_size, | 534 bool swizzle = |
| 484 src_subrect, | |
| 485 dst_size, | |
| 486 true, | |
| 487 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT | 535 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT |
| 488 true, | 536 true; |
| 489 #else | 537 #else |
| 490 false, | 538 false; |
| 491 #endif | 539 #endif |
| 492 color_type, | 540 |
| 493 quality); | 541 GLuint texture = |
| 542 ScaleTexture(src_texture, | |
| 543 src_size, | |
| 544 src_subrect, | |
| 545 dst_size, | |
| 546 true, | |
| 547 swizzle, | |
| 548 out_color_type == kAlpha_8_SkColorType ? kN32_SkColorType | |
|
no sievers
2014/07/15 19:31:49
This seems wrong for Alpha_8. If you are using the
mfomitchev
2014/07/16 19:16:06
Done.
| |
| 549 : out_color_type, | |
| 550 quality); | |
| 494 DCHECK(texture); | 551 DCHECK(texture); |
| 552 | |
| 553 if (out_color_type == kAlpha_8_SkColorType) { | |
| 554 texture = | |
| 555 TransformTextureToGrayscale(texture, src_size, src_subrect, swizzle); | |
|
no sievers
2014/07/15 19:31:49
+hubbe to comment if this can be done in a single
hubbe
2014/07/15 21:05:56
It can, iff quality is SCALER_QUALITY_FAST, search
mfomitchev
2014/07/16 19:16:06
Done. Also added vertically_flip_texture to Encode
mfomitchev
2014/07/16 19:16:06
Also fixed: the second arg should be dst_size, not
| |
| 556 | |
| 557 DCHECK(texture); | |
| 558 } | |
| 495 ScopedFramebuffer dst_framebuffer(gl_); | 559 ScopedFramebuffer dst_framebuffer(gl_); |
| 496 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, | 560 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, |
| 497 dst_framebuffer); | 561 dst_framebuffer); |
| 498 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); | 562 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); |
| 499 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, | 563 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, |
| 500 GL_COLOR_ATTACHMENT0, | 564 GL_COLOR_ATTACHMENT0, |
| 501 GL_TEXTURE_2D, | 565 GL_TEXTURE_2D, |
| 502 texture, | 566 texture, |
| 503 0); | 567 0); |
| 504 int bytes_per_pixel = 4; | 568 int bytes_per_pixel = 4; |
| 505 switch (color_type) { | 569 switch (out_color_type) { |
| 506 case kN32_SkColorType: | 570 case kN32_SkColorType: |
| 507 // Do nothing params already set. | 571 // Do nothing params already set. |
| 508 break; | 572 break; |
| 509 case kRGB_565_SkColorType: | 573 case kRGB_565_SkColorType: |
| 510 bytes_per_pixel = 2; | 574 bytes_per_pixel = 2; |
| 511 break; | 575 break; |
| 576 case kAlpha_8_SkColorType: | |
| 577 bytes_per_pixel = 1; | |
| 578 break; | |
| 512 default: | 579 default: |
| 513 NOTREACHED(); | 580 NOTREACHED(); |
| 514 break; | 581 break; |
| 515 } | 582 } |
| 516 ReadbackAsync(dst_size, | 583 ReadbackAsync(dst_size, |
| 517 dst_size.width() * bytes_per_pixel, | 584 dst_size.width() * bytes_per_pixel, |
| 518 dst_size.width() * bytes_per_pixel, | 585 dst_size.width() * bytes_per_pixel, |
| 519 out, | 586 out, |
| 520 color_type, | 587 out_color_type, |
| 521 kSwizzleNone, | 588 kSwizzleNone, |
| 522 callback); | 589 callback); |
| 523 gl_->DeleteTextures(1, &texture); | 590 gl_->DeleteTextures(1, &texture); |
| 524 } | 591 } |
| 525 | 592 |
| 526 void GLHelper::CopyTextureToImpl::ReadbackTextureSync( | 593 void GLHelper::CopyTextureToImpl::ReadbackTextureSync( |
| 527 GLuint texture, | 594 GLuint texture, |
| 528 const gfx::Rect& src_rect, | 595 const gfx::Rect& src_rect, |
| 529 unsigned char* out, | 596 unsigned char* out, |
| 530 SkColorType color_type) { | 597 SkColorType color_type) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 readback_support_(new GLHelperReadbackSupport(gl)) {} | 742 readback_support_(new GLHelperReadbackSupport(gl)) {} |
| 676 | 743 |
| 677 GLHelper::~GLHelper() {} | 744 GLHelper::~GLHelper() {} |
| 678 | 745 |
| 679 void GLHelper::CropScaleReadbackAndCleanTexture( | 746 void GLHelper::CropScaleReadbackAndCleanTexture( |
| 680 GLuint src_texture, | 747 GLuint src_texture, |
| 681 const gfx::Size& src_size, | 748 const gfx::Size& src_size, |
| 682 const gfx::Rect& src_subrect, | 749 const gfx::Rect& src_subrect, |
| 683 const gfx::Size& dst_size, | 750 const gfx::Size& dst_size, |
| 684 unsigned char* out, | 751 unsigned char* out, |
| 685 const SkColorType color_type, | 752 const SkColorType out_color_type, |
| 686 const base::Callback<void(bool)>& callback, | 753 const base::Callback<void(bool)>& callback, |
| 687 GLHelper::ScalerQuality quality) { | 754 GLHelper::ScalerQuality quality) { |
| 688 InitCopyTextToImpl(); | 755 InitCopyTextToImpl(); |
| 689 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( | 756 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture(src_texture, |
| 690 src_texture, | 757 src_size, |
| 691 src_size, | 758 src_subrect, |
| 692 src_subrect, | 759 dst_size, |
| 693 dst_size, | 760 out, |
| 694 out, | 761 out_color_type, |
| 695 color_type, | 762 callback, |
| 696 callback, | 763 quality); |
| 697 quality); | |
| 698 } | 764 } |
| 699 | 765 |
| 700 void GLHelper::CropScaleReadbackAndCleanMailbox( | 766 void GLHelper::CropScaleReadbackAndCleanMailbox( |
| 701 const gpu::Mailbox& src_mailbox, | 767 const gpu::Mailbox& src_mailbox, |
| 702 uint32 sync_point, | 768 uint32 sync_point, |
| 703 const gfx::Size& src_size, | 769 const gfx::Size& src_size, |
| 704 const gfx::Rect& src_subrect, | 770 const gfx::Rect& src_subrect, |
| 705 const gfx::Size& dst_size, | 771 const gfx::Size& dst_size, |
| 706 unsigned char* out, | 772 unsigned char* out, |
| 707 const SkColorType color_type, | 773 const SkColorType out_color_type, |
| 708 const base::Callback<void(bool)>& callback, | 774 const base::Callback<void(bool)>& callback, |
| 709 GLHelper::ScalerQuality quality) { | 775 GLHelper::ScalerQuality quality) { |
| 710 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); | 776 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); |
| 711 CropScaleReadbackAndCleanTexture( | 777 CropScaleReadbackAndCleanTexture( |
| 712 mailbox_texture, src_size, src_subrect, dst_size, out, | 778 mailbox_texture, src_size, src_subrect, dst_size, out, |
| 713 color_type, | 779 out_color_type, |
| 714 callback, | 780 callback, |
| 715 quality); | 781 quality); |
| 716 gl_->DeleteTextures(1, &mailbox_texture); | 782 gl_->DeleteTextures(1, &mailbox_texture); |
| 717 } | 783 } |
| 718 | 784 |
| 719 void GLHelper::ReadbackTextureSync(GLuint texture, | 785 void GLHelper::ReadbackTextureSync(GLuint texture, |
| 720 const gfx::Rect& src_rect, | 786 const gfx::Rect& src_rect, |
| 721 unsigned char* out, | 787 unsigned char* out, |
| 722 SkColorType format) { | 788 SkColorType format) { |
| 723 InitCopyTextToImpl(); | 789 InitCopyTextToImpl(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 swizzle, | 987 swizzle, |
| 922 callback); | 988 callback); |
| 923 } | 989 } |
| 924 | 990 |
| 925 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { | 991 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { |
| 926 0.257f, 0.504f, 0.098f, 0.0625f}; | 992 0.257f, 0.504f, 0.098f, 0.0625f}; |
| 927 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { | 993 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { |
| 928 -0.148f, -0.291f, 0.439f, 0.5f}; | 994 -0.148f, -0.291f, 0.439f, 0.5f}; |
| 929 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { | 995 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { |
| 930 0.439f, -0.368f, -0.071f, 0.5f}; | 996 0.439f, -0.368f, -0.071f, 0.5f}; |
| 997 const float GLHelper::CopyTextureToImpl::kRGBtoGrayscaleColorWeights[] = { | |
| 998 0.213f, 0.715f, 0.072f, 0.0f}; | |
| 931 | 999 |
| 932 // YUV readback constructors. Initiates the main scaler pipeline and | 1000 // YUV readback constructors. Initiates the main scaler pipeline and |
| 933 // one planar scaler for each of the Y, U and V planes. | 1001 // one planar scaler for each of the Y, U and V planes. |
| 934 GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl( | 1002 GLHelper::CopyTextureToImpl::ReadbackYUVImpl::ReadbackYUVImpl( |
| 935 GLES2Interface* gl, | 1003 GLES2Interface* gl, |
| 936 CopyTextureToImpl* copy_impl, | 1004 CopyTextureToImpl* copy_impl, |
| 937 GLHelperScaling* scaler_impl, | 1005 GLHelperScaling* scaler_impl, |
| 938 GLHelper::ScalerQuality quality, | 1006 GLHelper::ScalerQuality quality, |
| 939 const gfx::Size& src_size, | 1007 const gfx::Size& src_size, |
| 940 const gfx::Rect& src_subrect, | 1008 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, | 1321 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, |
| 1254 src_size, | 1322 src_size, |
| 1255 src_subrect, | 1323 src_subrect, |
| 1256 dst_size, | 1324 dst_size, |
| 1257 dst_subrect, | 1325 dst_subrect, |
| 1258 flip_vertically, | 1326 flip_vertically, |
| 1259 use_mrt); | 1327 use_mrt); |
| 1260 } | 1328 } |
| 1261 | 1329 |
| 1262 } // namespace content | 1330 } // namespace content |
| OLD | NEW |