diff options
Diffstat (limited to 'chromium/components/viz/common/frame_sinks')
4 files changed, 15 insertions, 21 deletions
diff --git a/chromium/components/viz/common/frame_sinks/copy_output_request.cc b/chromium/components/viz/common/frame_sinks/copy_output_request.cc index 43fa33bcbde..56164fa32ea 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_request.cc +++ b/chromium/components/viz/common/frame_sinks/copy_output_request.cc @@ -64,14 +64,6 @@ bool CopyOutputRequest::SendsResultsInCurrentSequence() const { result_task_runner_->RunsTasksInCurrentSequence(); } -void CopyOutputRequest::SetMailbox(const gpu::Mailbox& mailbox, - const gpu::SyncToken& sync_token) { - DCHECK_EQ(result_format_, ResultFormat::RGBA_TEXTURE); - DCHECK(!mailbox.IsZero()); - mailbox_ = mailbox; - sync_token_ = sync_token; -} - // static std::unique_ptr<CopyOutputRequest> CopyOutputRequest::CreateStubForTesting() { return std::make_unique<CopyOutputRequest>( diff --git a/chromium/components/viz/common/frame_sinks/copy_output_request.h b/chromium/components/viz/common/frame_sinks/copy_output_request.h index 4c57ab26846..d38cfde73ad 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_request.h +++ b/chromium/components/viz/common/frame_sinks/copy_output_request.h @@ -107,17 +107,6 @@ class VIZ_COMMON_EXPORT CopyOutputRequest { bool has_result_selection() const { return result_selection_.has_value(); } const gfx::Rect& result_selection() const { return *result_selection_; } - // Legacy support for providing textures up-front, to copy results into. - // TODO(miu): Remove these methods after tab capture is moved to VIZ. - // http://crbug.com/754872 - // The texture bound to the mailbox is expected to have a GL_TEXTURE_2D - // target. - void SetMailbox(const gpu::Mailbox& mailbox, - const gpu::SyncToken& sync_token); - bool has_mailbox() const { return mailbox_.has_value(); } - const gpu::Mailbox& mailbox() const { return *mailbox_; } - const gpu::SyncToken& sync_token() const { return *sync_token_; } - // Sends the result from executing this request. Called by the internal // implementation, usually a DirectRenderer. void SendResult(std::unique_ptr<CopyOutputResult> result); @@ -144,8 +133,6 @@ class VIZ_COMMON_EXPORT CopyOutputRequest { base::Optional<base::UnguessableToken> source_; base::Optional<gfx::Rect> area_; base::Optional<gfx::Rect> result_selection_; - base::Optional<gpu::Mailbox> mailbox_; - base::Optional<gpu::SyncToken> sync_token_; DISALLOW_COPY_AND_ASSIGN(CopyOutputRequest); }; diff --git a/chromium/components/viz/common/frame_sinks/copy_output_result.cc b/chromium/components/viz/common/frame_sinks/copy_output_result.cc index 0e71b82219a..0354e37a22c 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_result.cc +++ b/chromium/components/viz/common/frame_sinks/copy_output_result.cc @@ -77,6 +77,16 @@ bool CopyOutputResult::ReadI420Planes(uint8_t* y_out, return false; } +bool CopyOutputResult::ReadRGBAPlane(uint8_t* dest, int stride) const { + const SkBitmap& bitmap = AsSkBitmap(); + if (!bitmap.readyToDraw()) + return false; + SkImageInfo image_info = SkImageInfo::MakeN32(bitmap.width(), bitmap.height(), + kPremul_SkAlphaType); + bitmap.readPixels(image_info, dest, stride, 0, 0); + return true; +} + CopyOutputSkBitmapResult::CopyOutputSkBitmapResult(const gfx::Rect& rect, const SkBitmap& bitmap) : CopyOutputSkBitmapResult(Format::RGBA_BITMAP, rect, bitmap) {} diff --git a/chromium/components/viz/common/frame_sinks/copy_output_result.h b/chromium/components/viz/common/frame_sinks/copy_output_result.h index 5e6318c6f3c..2ae0b84452e 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_result.h +++ b/chromium/components/viz/common/frame_sinks/copy_output_result.h @@ -104,6 +104,11 @@ class VIZ_COMMON_EXPORT CopyOutputResult { uint8_t* v_out, int v_out_stride) const; + // Copies the result of an RGBA_BITMAP into |dest|. The result is in N32Premul + // form. Returns true if successful, or false if: 1) the result is empty, or + // 2) the result format is not RGBA_BITMAP and conversion is not implemented. + virtual bool ReadRGBAPlane(uint8_t* dest, int stride) const; + protected: // Accessor for subclasses to initialize the cached SkBitmap. SkBitmap* cached_bitmap() const { return &cached_bitmap_; } |