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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 uint32 sync_point) { | 120 uint32 sync_point) { |
| 121 return helper_->ConsumeMailboxToTexture(mailbox, sync_point); | 121 return helper_->ConsumeMailboxToTexture(mailbox, sync_point); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void CropScaleReadbackAndCleanTexture( | 124 void CropScaleReadbackAndCleanTexture( |
| 125 GLuint src_texture, | 125 GLuint src_texture, |
| 126 const gfx::Size& src_size, | 126 const gfx::Size& src_size, |
| 127 const gfx::Rect& src_subrect, | 127 const gfx::Rect& src_subrect, |
| 128 const gfx::Size& dst_size, | 128 const gfx::Size& dst_size, |
| 129 unsigned char* out, | 129 unsigned char* out, |
| 130 bool readback_config_rgb565, | 130 const SkBitmap::Config config, |
| 131 const base::Callback<void(bool)>& callback, | 131 const base::Callback<void(bool)>& callback, |
| 132 GLHelper::ScalerQuality quality); | 132 GLHelper::ScalerQuality quality); |
| 133 | 133 |
| 134 void ReadbackTextureSync(GLuint texture, | 134 void ReadbackTextureSync(GLuint texture, |
| 135 const gfx::Rect& src_rect, | 135 const gfx::Rect& src_rect, |
| 136 unsigned char* out, | 136 unsigned char* out, |
| 137 SkBitmap::Config format); | 137 SkBitmap::Config format); |
| 138 | 138 |
| 139 // Reads back bytes from the currently bound frame buffer. | 139 // Reads back bytes from the currently bound frame buffer. |
| 140 // Note that dst_size is specified in bytes, not pixels. | 140 // Note that dst_size is specified in bytes, not pixels. |
| 141 void ReadbackAsync(const gfx::Size& dst_size, | 141 void ReadbackAsync(const gfx::Size& dst_size, |
| 142 int32 bytes_per_row, // generally dst_size.width() * 4 | 142 int32 bytes_per_row, // generally dst_size.width() * 4 |
| 143 int32 row_stride_bytes, // generally dst_size.width() * 4 | 143 int32 row_stride_bytes, // generally dst_size.width() * 4 |
| 144 unsigned char* out, | 144 unsigned char* out, |
| 145 bool readback_config_rgb565, | 145 const SkBitmap::Config config, |
| 146 const base::Callback<void(bool)>& callback); | 146 const base::Callback<void(bool)>& callback); |
| 147 | 147 |
| 148 void ReadbackPlane(TextureFrameBufferPair* source, | 148 void ReadbackPlane(TextureFrameBufferPair* source, |
| 149 const scoped_refptr<media::VideoFrame>& target, | 149 const scoped_refptr<media::VideoFrame>& target, |
| 150 int plane, | 150 int plane, |
| 151 int size_shift, | 151 int size_shift, |
| 152 const gfx::Rect& dst_subrect, | 152 const gfx::Rect& dst_subrect, |
| 153 const base::Callback<void(bool)>& callback); | 153 const base::Callback<void(bool)>& callback); |
| 154 | 154 |
| 155 GLuint CopyAndScaleTexture(GLuint texture, | 155 GLuint CopyAndScaleTexture(GLuint texture, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 | 281 |
| 282 // Copies the block of pixels specified with |src_subrect| from |src_texture|, | 282 // Copies the block of pixels specified with |src_subrect| from |src_texture|, |
| 283 // scales it to |dst_size|, writes it into a texture, and returns its ID. | 283 // scales it to |dst_size|, writes it into a texture, and returns its ID. |
| 284 // |src_size| is the size of |src_texture|. | 284 // |src_size| is the size of |src_texture|. |
| 285 GLuint ScaleTexture(GLuint src_texture, | 285 GLuint ScaleTexture(GLuint src_texture, |
| 286 const gfx::Size& src_size, | 286 const gfx::Size& src_size, |
| 287 const gfx::Rect& src_subrect, | 287 const gfx::Rect& src_subrect, |
| 288 const gfx::Size& dst_size, | 288 const gfx::Size& dst_size, |
| 289 bool vertically_flip_texture, | 289 bool vertically_flip_texture, |
| 290 bool swizzle, | 290 bool swizzle, |
| 291 bool readback_config_rgb565, | 291 SkBitmap::Config config, |
| 292 GLHelper::ScalerQuality quality); | 292 GLHelper::ScalerQuality quality); |
| 293 | 293 |
| 294 static void nullcallback(bool success) {} | 294 static void nullcallback(bool success) {} |
| 295 void ReadbackDone(Request *request, int bytes_per_pixel); | 295 void ReadbackDone(Request *request, int bytes_per_pixel); |
| 296 void FinishRequest(Request* request, bool result); | 296 void FinishRequest(Request* request, bool result); |
| 297 void CancelRequests(); | 297 void CancelRequests(); |
| 298 | 298 |
| 299 static const float kRGBtoYColorWeights[]; | 299 static const float kRGBtoYColorWeights[]; |
| 300 static const float kRGBtoUColorWeights[]; | 300 static const float kRGBtoUColorWeights[]; |
| 301 static const float kRGBtoVColorWeights[]; | 301 static const float kRGBtoVColorWeights[]; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 327 swizzle); | 327 swizzle); |
| 328 } | 328 } |
| 329 | 329 |
| 330 GLuint GLHelper::CopyTextureToImpl::ScaleTexture( | 330 GLuint GLHelper::CopyTextureToImpl::ScaleTexture( |
| 331 GLuint src_texture, | 331 GLuint src_texture, |
| 332 const gfx::Size& src_size, | 332 const gfx::Size& src_size, |
| 333 const gfx::Rect& src_subrect, | 333 const gfx::Rect& src_subrect, |
| 334 const gfx::Size& dst_size, | 334 const gfx::Size& dst_size, |
| 335 bool vertically_flip_texture, | 335 bool vertically_flip_texture, |
| 336 bool swizzle, | 336 bool swizzle, |
| 337 bool readback_config_rgb565, | 337 SkBitmap::Config config, |
| 338 GLHelper::ScalerQuality quality) { | 338 GLHelper::ScalerQuality quality) { |
| 339 scoped_ptr<ScalerInterface> scaler( | 339 scoped_ptr<ScalerInterface> scaler( |
| 340 helper_->CreateScaler(quality, | 340 helper_->CreateScaler(quality, |
| 341 src_size, | 341 src_size, |
| 342 src_subrect, | 342 src_subrect, |
| 343 dst_size, | 343 dst_size, |
| 344 vertically_flip_texture, | 344 vertically_flip_texture, |
| 345 swizzle)); | 345 swizzle)); |
| 346 | 346 |
| 347 GLuint dst_texture = 0u; | 347 GLuint dst_texture = 0u; |
| 348 gl_->GenTextures(1, &dst_texture); | 348 gl_->GenTextures(1, &dst_texture); |
| 349 { | 349 { |
| 350 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); | 350 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); |
| 351 GLenum format = readback_config_rgb565 ? GL_RGB : GL_RGBA; | 351 GLenum format, type; |
| 352 GLenum type = readback_config_rgb565 ? | 352 switch (config) { |
| 353 GL_UNSIGNED_SHORT_5_6_5 : | 353 case SkBitmap::kRGB_565_Config: |
| 354 GL_UNSIGNED_BYTE; | 354 format = GL_RGB; |
| 355 type = GL_UNSIGNED_SHORT_5_6_5; | |
| 356 break; | |
| 357 case SkBitmap::kARGB_8888_Config: | |
| 358 default: | |
|
piman
2014/01/21 21:30:55
I don't think we should transparently fallback to
sivag
2014/01/22 10:35:09
Done.
| |
| 359 format = GL_RGBA; | |
| 360 type = GL_UNSIGNED_BYTE; | |
| 361 break; | |
| 362 } | |
| 355 gl_->TexImage2D(GL_TEXTURE_2D, | 363 gl_->TexImage2D(GL_TEXTURE_2D, |
| 356 0, | 364 0, |
| 357 format, | 365 format, |
| 358 dst_size.width(), | 366 dst_size.width(), |
| 359 dst_size.height(), | 367 dst_size.height(), |
| 360 0, | 368 0, |
| 361 format, | 369 format, |
| 362 type, | 370 type, |
| 363 NULL); | 371 NULL); |
| 364 } | 372 } |
| 365 scaler->Scale(src_texture, dst_texture); | 373 scaler->Scale(src_texture, dst_texture); |
| 366 return dst_texture; | 374 return dst_texture; |
| 367 } | 375 } |
| 368 | 376 |
| 369 void GLHelper::CopyTextureToImpl::ReadbackAsync( | 377 void GLHelper::CopyTextureToImpl::ReadbackAsync( |
| 370 const gfx::Size& dst_size, | 378 const gfx::Size& dst_size, |
| 371 int32 bytes_per_row, | 379 int32 bytes_per_row, |
| 372 int32 row_stride_bytes, | 380 int32 row_stride_bytes, |
| 373 unsigned char* out, | 381 unsigned char* out, |
| 374 bool readback_config_rgb565, | 382 const SkBitmap::Config config, |
| 375 const base::Callback<void(bool)>& callback) { | 383 const base::Callback<void(bool)>& callback) { |
| 376 Request* request = | 384 Request* request = |
| 377 new Request(dst_size, bytes_per_row, row_stride_bytes, out, callback); | 385 new Request(dst_size, bytes_per_row, row_stride_bytes, out, callback); |
| 378 request_queue_.push(request); | 386 request_queue_.push(request); |
| 379 request->buffer = 0u; | 387 request->buffer = 0u; |
| 380 int bytes_per_pixel = readback_config_rgb565 ? 2 : 4; | 388 GLenum format, type; |
| 389 int bytes_per_pixel = 0; | |
| 390 switch (config) { | |
| 391 case SkBitmap::kRGB_565_Config: | |
| 392 format = GL_RGB; | |
| 393 type = GL_UNSIGNED_SHORT_5_6_5; | |
| 394 bytes_per_pixel = 2; | |
| 395 break; | |
| 396 case SkBitmap::kARGB_8888_Config: | |
| 397 default: | |
|
piman
2014/01/21 21:30:55
Same here.
sivag
2014/01/22 10:35:09
Done.
| |
| 398 format = GL_RGBA; | |
| 399 type = GL_UNSIGNED_BYTE; | |
| 400 bytes_per_pixel = 4; | |
| 401 break; | |
| 402 } | |
| 381 gl_->GenBuffers(1, &request->buffer); | 403 gl_->GenBuffers(1, &request->buffer); |
| 382 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); | 404 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); |
| 383 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, | 405 gl_->BufferData(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, |
| 384 bytes_per_pixel * dst_size.GetArea(), | 406 bytes_per_pixel * dst_size.GetArea(), |
| 385 NULL, | 407 NULL, |
| 386 GL_STREAM_READ); | 408 GL_STREAM_READ); |
| 387 | 409 |
| 388 request->query = 0u; | 410 request->query = 0u; |
| 389 gl_->GenQueriesEXT(1, &request->query); | 411 gl_->GenQueriesEXT(1, &request->query); |
| 390 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); | 412 gl_->BeginQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, request->query); |
| 391 GLenum format = readback_config_rgb565 ? GL_RGB : GL_RGBA; | |
| 392 GLenum type = readback_config_rgb565 ? | |
| 393 GL_UNSIGNED_SHORT_5_6_5 : | |
| 394 GL_UNSIGNED_BYTE; | |
| 395 gl_->ReadPixels(0, | 413 gl_->ReadPixels(0, |
| 396 0, | 414 0, |
| 397 dst_size.width(), | 415 dst_size.width(), |
| 398 dst_size.height(), | 416 dst_size.height(), |
| 399 format, | 417 format, |
| 400 type, | 418 type, |
| 401 NULL); | 419 NULL); |
| 402 gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); | 420 gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); |
| 403 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); | 421 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 404 context_support_->SignalQuery( | 422 context_support_->SignalQuery( |
| 405 request->query, | 423 request->query, |
| 406 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), | 424 base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), |
| 407 request, bytes_per_pixel)); | 425 request, bytes_per_pixel)); |
| 408 } | 426 } |
| 409 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( | 427 void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( |
| 410 GLuint src_texture, | 428 GLuint src_texture, |
| 411 const gfx::Size& src_size, | 429 const gfx::Size& src_size, |
| 412 const gfx::Rect& src_subrect, | 430 const gfx::Rect& src_subrect, |
| 413 const gfx::Size& dst_size, | 431 const gfx::Size& dst_size, |
| 414 unsigned char* out, | 432 unsigned char* out, |
| 415 bool readback_config_rgb565, | 433 const SkBitmap::Config bitmap_config, |
| 416 const base::Callback<void(bool)>& callback, | 434 const base::Callback<void(bool)>& callback, |
| 417 GLHelper::ScalerQuality quality) { | 435 GLHelper::ScalerQuality quality) { |
| 418 GLuint texture = ScaleTexture(src_texture, | 436 GLuint texture = ScaleTexture(src_texture, |
| 419 src_size, | 437 src_size, |
| 420 src_subrect, | 438 src_subrect, |
| 421 dst_size, | 439 dst_size, |
| 422 true, | 440 true, |
| 423 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT | 441 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT |
| 424 true, | 442 true, |
| 425 #else | 443 #else |
| 426 false, | 444 false, |
| 427 #endif | 445 #endif |
| 428 readback_config_rgb565, | 446 bitmap_config, |
| 429 quality); | 447 quality); |
| 430 ScopedFramebuffer dst_framebuffer(gl_); | 448 ScopedFramebuffer dst_framebuffer(gl_); |
| 431 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, | 449 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, |
| 432 dst_framebuffer); | 450 dst_framebuffer); |
| 433 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); | 451 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); |
| 434 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, | 452 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, |
| 435 GL_COLOR_ATTACHMENT0, | 453 GL_COLOR_ATTACHMENT0, |
| 436 GL_TEXTURE_2D, | 454 GL_TEXTURE_2D, |
| 437 texture, | 455 texture, |
| 438 0); | 456 0); |
| 439 int bytes_per_pixel = readback_config_rgb565 ? 2 : 4; | 457 int bytes_per_pixel = 0; |
| 458 switch (bitmap_config) { | |
| 459 case SkBitmap::kRGB_565_Config: | |
| 460 bytes_per_pixel = 2; | |
| 461 break; | |
| 462 case SkBitmap::kARGB_8888_Config: | |
| 463 default: | |
|
piman
2014/01/21 21:30:55
And here
sivag
2014/01/22 10:35:09
Done.
| |
| 464 bytes_per_pixel = 4; | |
| 465 break; | |
| 466 } | |
| 440 ReadbackAsync(dst_size, | 467 ReadbackAsync(dst_size, |
| 441 dst_size.width() * bytes_per_pixel, | 468 dst_size.width() * bytes_per_pixel, |
| 442 dst_size.width() * bytes_per_pixel, | 469 dst_size.width() * bytes_per_pixel, |
| 443 out, | 470 out, |
| 444 readback_config_rgb565, | 471 bitmap_config, |
| 445 callback); | 472 callback); |
| 446 gl_->DeleteTextures(1, &texture); | 473 gl_->DeleteTextures(1, &texture); |
| 447 } | 474 } |
| 448 | 475 |
| 449 void GLHelper::CopyTextureToImpl::ReadbackTextureSync(GLuint texture, | 476 void GLHelper::CopyTextureToImpl::ReadbackTextureSync(GLuint texture, |
| 450 const gfx::Rect& src_rect, | 477 const gfx::Rect& src_rect, |
| 451 unsigned char* out, | 478 unsigned char* out, |
| 452 SkBitmap::Config config) { | 479 SkBitmap::Config config) { |
| 453 ScopedFramebuffer dst_framebuffer(gl_); | 480 ScopedFramebuffer dst_framebuffer(gl_); |
| 454 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, | 481 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 478 const gfx::Size& src_size, | 505 const gfx::Size& src_size, |
| 479 const gfx::Size& dst_size, | 506 const gfx::Size& dst_size, |
| 480 bool vertically_flip_texture, | 507 bool vertically_flip_texture, |
| 481 GLHelper::ScalerQuality quality) { | 508 GLHelper::ScalerQuality quality) { |
| 482 return ScaleTexture(src_texture, | 509 return ScaleTexture(src_texture, |
| 483 src_size, | 510 src_size, |
| 484 gfx::Rect(src_size), | 511 gfx::Rect(src_size), |
| 485 dst_size, | 512 dst_size, |
| 486 vertically_flip_texture, | 513 vertically_flip_texture, |
| 487 false, | 514 false, |
| 488 false, | 515 SkBitmap::kARGB_8888_Config, |
| 489 quality); | 516 quality); |
| 490 } | 517 } |
| 491 | 518 |
| 492 void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request, | 519 void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request, |
| 493 int bytes_per_pixel) { | 520 int bytes_per_pixel) { |
| 494 TRACE_EVENT0("mirror", | 521 TRACE_EVENT0("mirror", |
| 495 "GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete"); | 522 "GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete"); |
| 496 finished_request->done = true; | 523 finished_request->done = true; |
| 497 | 524 |
| 498 // We process transfer requests in the order they were received, regardless | 525 // We process transfer requests in the order they were received, regardless |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 support_565_format_(false) {} | 588 support_565_format_(false) {} |
| 562 | 589 |
| 563 GLHelper::~GLHelper() {} | 590 GLHelper::~GLHelper() {} |
| 564 | 591 |
| 565 void GLHelper::CropScaleReadbackAndCleanTexture( | 592 void GLHelper::CropScaleReadbackAndCleanTexture( |
| 566 GLuint src_texture, | 593 GLuint src_texture, |
| 567 const gfx::Size& src_size, | 594 const gfx::Size& src_size, |
| 568 const gfx::Rect& src_subrect, | 595 const gfx::Rect& src_subrect, |
| 569 const gfx::Size& dst_size, | 596 const gfx::Size& dst_size, |
| 570 unsigned char* out, | 597 unsigned char* out, |
| 571 bool readback_config_rgb565, | 598 const SkBitmap::Config config, |
| 572 const base::Callback<void(bool)>& callback) { | 599 const base::Callback<void(bool)>& callback) { |
| 573 InitCopyTextToImpl(); | 600 InitCopyTextToImpl(); |
| 574 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( | 601 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( |
| 575 src_texture, | 602 src_texture, |
| 576 src_size, | 603 src_size, |
| 577 src_subrect, | 604 src_subrect, |
| 578 dst_size, | 605 dst_size, |
| 579 out, | 606 out, |
| 580 readback_config_rgb565, | 607 config, |
| 581 callback, | 608 callback, |
| 582 GLHelper::SCALER_QUALITY_FAST); | 609 GLHelper::SCALER_QUALITY_FAST); |
| 583 } | 610 } |
| 584 | 611 |
| 585 void GLHelper::CropScaleReadbackAndCleanMailbox( | 612 void GLHelper::CropScaleReadbackAndCleanMailbox( |
| 586 const gpu::Mailbox& src_mailbox, | 613 const gpu::Mailbox& src_mailbox, |
| 587 uint32 sync_point, | 614 uint32 sync_point, |
| 588 const gfx::Size& src_size, | 615 const gfx::Size& src_size, |
| 589 const gfx::Rect& src_subrect, | 616 const gfx::Rect& src_subrect, |
| 590 const gfx::Size& dst_size, | 617 const gfx::Size& dst_size, |
| 591 unsigned char* out, | 618 unsigned char* out, |
| 592 bool readback_config_rgb565, | 619 const SkBitmap::Config bitmap_config, |
| 593 const base::Callback<void(bool)>& callback) { | 620 const base::Callback<void(bool)>& callback) { |
| 594 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); | 621 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); |
| 595 CropScaleReadbackAndCleanTexture( | 622 CropScaleReadbackAndCleanTexture( |
| 596 mailbox_texture, src_size, src_subrect, dst_size, out, | 623 mailbox_texture, src_size, src_subrect, dst_size, out, |
| 597 readback_config_rgb565, | 624 bitmap_config, |
| 598 callback); | 625 callback); |
| 599 gl_->DeleteTextures(1, &mailbox_texture); | 626 gl_->DeleteTextures(1, &mailbox_texture); |
| 600 } | 627 } |
| 601 | 628 |
| 602 void GLHelper::ReadbackTextureSync(GLuint texture, | 629 void GLHelper::ReadbackTextureSync(GLuint texture, |
| 603 const gfx::Rect& src_rect, | 630 const gfx::Rect& src_rect, |
| 604 unsigned char* out, | 631 unsigned char* out, |
| 605 SkBitmap::Config format) { | 632 SkBitmap::Config format) { |
| 606 InitCopyTextToImpl(); | 633 InitCopyTextToImpl(); |
| 607 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); | 634 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 int size_shift, | 846 int size_shift, |
| 820 const gfx::Rect& dst_subrect, | 847 const gfx::Rect& dst_subrect, |
| 821 const base::Callback<void(bool)>& callback) { | 848 const base::Callback<void(bool)>& callback) { |
| 822 gl_->BindFramebuffer(GL_FRAMEBUFFER, source->framebuffer()); | 849 gl_->BindFramebuffer(GL_FRAMEBUFFER, source->framebuffer()); |
| 823 size_t offset = target->stride(plane) * (dst_subrect.y() >> size_shift) + | 850 size_t offset = target->stride(plane) * (dst_subrect.y() >> size_shift) + |
| 824 (dst_subrect.x() >> size_shift); | 851 (dst_subrect.x() >> size_shift); |
| 825 ReadbackAsync(source->size(), | 852 ReadbackAsync(source->size(), |
| 826 dst_subrect.width() >> size_shift, | 853 dst_subrect.width() >> size_shift, |
| 827 target->stride(plane), | 854 target->stride(plane), |
| 828 target->data(plane) + offset, | 855 target->data(plane) + offset, |
| 829 false, | 856 SkBitmap::kARGB_8888_Config, |
| 830 callback); | 857 callback); |
| 831 } | 858 } |
| 832 | 859 |
| 833 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { | 860 const float GLHelper::CopyTextureToImpl::kRGBtoYColorWeights[] = { |
| 834 0.257f, 0.504f, 0.098f, 0.0625f}; | 861 0.257f, 0.504f, 0.098f, 0.0625f}; |
| 835 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { | 862 const float GLHelper::CopyTextureToImpl::kRGBtoUColorWeights[] = { |
| 836 -0.148f, -0.291f, 0.439f, 0.5f}; | 863 -0.148f, -0.291f, 0.439f, 0.5f}; |
| 837 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { | 864 const float GLHelper::CopyTextureToImpl::kRGBtoVColorWeights[] = { |
| 838 0.439f, -0.368f, -0.071f, 0.5f}; | 865 0.439f, -0.368f, -0.071f, 0.5f}; |
| 839 | 866 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1130 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, | 1157 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, |
| 1131 src_size, | 1158 src_size, |
| 1132 src_subrect, | 1159 src_subrect, |
| 1133 dst_size, | 1160 dst_size, |
| 1134 dst_subrect, | 1161 dst_subrect, |
| 1135 flip_vertically, | 1162 flip_vertically, |
| 1136 use_mrt); | 1163 use_mrt); |
| 1137 } | 1164 } |
| 1138 | 1165 |
| 1139 } // namespace content | 1166 } // namespace content |
| OLD | NEW |