diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 19:57:40 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 19:57:40 +0000 |
commit | 13b7a84041f48a558efb24725f0568b466b08cfd (patch) | |
tree | 0961c2135680b9f3e3441fd467c46828c964213e /remoting/client | |
parent | 125444b5adec00c029d1c80f8aed6a3faad34f59 (diff) | |
download | chromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.zip chromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.tar.gz chromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.tar.bz2 |
Revert 103523 - Move us fully from gfx:: over to skia types for consistency.
BUG=NONE
TEST=BUILD
Review URL: http://codereview.chromium.org/7992011
TBR=dmaclach@chromium.org
Review URL: http://codereview.chromium.org/8103006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/DEPS | 1 | ||||
-rw-r--r-- | remoting/client/frame_consumer.h | 4 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 4 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view.cc | 36 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view.h | 15 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view_proxy.cc | 2 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view_proxy.h | 2 | ||||
-rw-r--r-- | remoting/client/rectangle_update_decoder.cc | 72 | ||||
-rw-r--r-- | remoting/client/rectangle_update_decoder.h | 12 |
9 files changed, 74 insertions, 74 deletions
diff --git a/remoting/client/DEPS b/remoting/client/DEPS index 03cd3a6..e50aa3e 100644 --- a/remoting/client/DEPS +++ b/remoting/client/DEPS @@ -2,6 +2,7 @@ include_rules = [ "+ppapi", "+jingle/glue", "+net", + "+ui/gfx", "+remoting/protocol", "+remoting/jingle_glue", diff --git a/remoting/client/frame_consumer.h b/remoting/client/frame_consumer.h index 339b3a4..90f5e55 100644 --- a/remoting/client/frame_consumer.h +++ b/remoting/client/frame_consumer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -51,7 +51,7 @@ class FrameConsumer { // Both |frame| and |rects| are guaranteed to be valid until the |done| // callback is invoked. virtual void OnPartialFrameOutput(media::VideoFrame* frame, - RectVector* rects, + UpdatedRects* rects, Task* done) = 0; private: diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 1fc4573..d4176ed 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -211,7 +211,7 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { DCHECK(plugin_message_loop_->BelongsToCurrentThread()); - view_->SetPluginSize(SkISize::Make(position.width(), position.height())); + view_->SetPluginSize(gfx::Size(position.width(), position.height())); // TODO(wez): Pass the dimensions of the plugin to the RectangleDecoder // and let it generate the necessary refresh events. @@ -225,7 +225,7 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position, // Notify the RectangleDecoder of the new clip rect. rectangle_decoder_->UpdateClipRect( - SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height())); + gfx::Rect(clip.x(), clip.y(), clip.width(), clip.height())); } bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc index 6a58c78..d05a22e 100644 --- a/remoting/client/plugin/pepper_view.cc +++ b/remoting/client/plugin/pepper_view.cc @@ -74,7 +74,7 @@ void PepperView::Paint() { } } -void PepperView::SetHostSize(const SkISize& host_size) { +void PepperView::SetHostSize(const gfx::Size& host_size) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); if (host_size_ == host_size) @@ -87,10 +87,10 @@ void PepperView::SetHostSize(const SkISize& host_size) { host_size.width(), host_size.height()); } -void PepperView::PaintFrame(media::VideoFrame* frame, RectVector* rects) { +void PepperView::PaintFrame(media::VideoFrame* frame, UpdatedRects* rects) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); - SetHostSize(SkISize::Make(frame->width(), frame->height())); + SetHostSize(gfx::Size(frame->width(), frame->height())); if (!backing_store_.get() || backing_store_->is_null()) { LOG(ERROR) << "Backing store is not available."; @@ -108,26 +108,26 @@ void PepperView::PaintFrame(media::VideoFrame* frame, RectVector* rects) { FlushGraphics(start_time); } -bool PepperView::PaintRect(media::VideoFrame* frame, const SkIRect& r) { +bool PepperView::PaintRect(media::VideoFrame* frame, const gfx::Rect& r) { const uint8* frame_data = frame->data(media::VideoFrame::kRGBPlane); const int kFrameStride = frame->stride(media::VideoFrame::kRGBPlane); const int kBytesPerPixel = GetBytesPerPixel(media::VideoFrame::RGB32); pp::Size backing_store_size = backing_store_->size(); - SkIRect rect(r); - if (!rect.intersect(SkIRect::MakeWH(backing_store_size.width(), - backing_store_size.height()))) { + gfx::Rect rect = r.Intersect(gfx::Rect(0, 0, backing_store_size.width(), + backing_store_size.height())); + + if (rect.IsEmpty()) return false; - } const uint8* in = frame_data + - kFrameStride * rect.fTop + // Y offset. - kBytesPerPixel * rect.fLeft; // X offset. + kFrameStride * rect.y() + // Y offset. + kBytesPerPixel * rect.x(); // X offset. uint8* out = reinterpret_cast<uint8*>(backing_store_->data()) + - backing_store_->stride() * rect.fTop + // Y offset. - kBytesPerPixel * rect.fLeft; // X offset. + backing_store_->stride() * rect.y() + // Y offset. + kBytesPerPixel * rect.x(); // X offset. // TODO(hclam): We really should eliminate this memory copy. for (int j = 0; j < rect.height(); ++j) { @@ -141,7 +141,7 @@ bool PepperView::PaintRect(media::VideoFrame* frame, const SkIRect& r) { graphics2d_.PaintImageData( *backing_store_.get(), pp::Point(0, 0), - pp::Rect(rect.fLeft, rect.fTop, rect.width(), rect.height())); + pp::Rect(rect.x(), rect.y(), rect.width(), rect.height())); return true; } @@ -239,7 +239,7 @@ void PepperView::UpdateLoginStatus(bool success, const std::string& info) { scriptable_obj->SignalLoginChallenge(); } -bool PepperView::SetPluginSize(const SkISize& plugin_size) { +bool PepperView::SetPluginSize(const gfx::Size& plugin_size) { if (plugin_size_ == plugin_size) return false; plugin_size_ = plugin_size; @@ -252,7 +252,7 @@ bool PepperView::SetPluginSize(const SkISize& plugin_size) { return false; } - if (plugin_size.isEmpty()) + if (plugin_size.IsEmpty()) return false; // Allocate the backing store to save the desktop image. @@ -271,7 +271,7 @@ bool PepperView::SetPluginSize(const SkISize& plugin_size) { double PepperView::GetHorizontalScaleRatio() const { if (instance_->DoScaling()) { - DCHECK(!host_size_.isEmpty()); + DCHECK(!host_size_.IsEmpty()); return 1.0 * plugin_size_.width() / host_size_.width(); } return 1.0; @@ -279,7 +279,7 @@ double PepperView::GetHorizontalScaleRatio() const { double PepperView::GetVerticalScaleRatio() const { if (instance_->DoScaling()) { - DCHECK(!host_size_.isEmpty()); + DCHECK(!host_size_.IsEmpty()); return 1.0 * plugin_size_.height() / host_size_.height(); } return 1.0; @@ -311,7 +311,7 @@ void PepperView::ReleaseFrame(media::VideoFrame* frame) { } void PepperView::OnPartialFrameOutput(media::VideoFrame* frame, - RectVector* rects, + UpdatedRects* rects, Task* done) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h index 1d52cff..030f70b 100644 --- a/remoting/client/plugin/pepper_view.h +++ b/remoting/client/plugin/pepper_view.h @@ -19,6 +19,7 @@ #include "ppapi/cpp/point.h" #include "remoting/client/chromoting_view.h" #include "remoting/client/frame_consumer.h" +#include "ui/gfx/size.h" namespace remoting { @@ -55,24 +56,24 @@ class PepperView : public ChromotingView, Task* done); virtual void ReleaseFrame(media::VideoFrame* frame); virtual void OnPartialFrameOutput(media::VideoFrame* frame, - RectVector* rects, + UpdatedRects* rects, Task* done); // This is called when the dimension of the plugin element has changed. // Return true if plugin size has changed, false otherwise. - bool SetPluginSize(const SkISize& plugin_size); + bool SetPluginSize(const gfx::Size& plugin_size); private: void OnPaintDone(base::Time paint_start); // Set the dimension of the entire host screen. - void SetHostSize(const SkISize& host_size); + void SetHostSize(const gfx::Size& host_size); - void PaintFrame(media::VideoFrame* frame, RectVector* rects); + void PaintFrame(media::VideoFrame* frame, UpdatedRects* rects); // Render the rectangle of |frame| to the backing store. // Returns true if this rectangle is not clipped. - bool PaintRect(media::VideoFrame* frame, const SkIRect& rect); + bool PaintRect(media::VideoFrame* frame, const gfx::Rect& rect); // Blanks out a rectangle in an image. void BlankRect(pp::ImageData& image_data, const pp::Rect& rect); @@ -98,10 +99,10 @@ class PepperView : public ChromotingView, bool flush_blocked_; // The size of the plugin element. - SkISize plugin_size_; + gfx::Size plugin_size_; // The size of the host screen. - SkISize host_size_; + gfx::Size host_size_; bool is_static_fill_; uint32 static_fill_color_; diff --git a/remoting/client/plugin/pepper_view_proxy.cc b/remoting/client/plugin/pepper_view_proxy.cc index be37706..3e4bb35 100644 --- a/remoting/client/plugin/pepper_view_proxy.cc +++ b/remoting/client/plugin/pepper_view_proxy.cc @@ -146,7 +146,7 @@ void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) { } void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame, - RectVector* rects, + UpdatedRects* rects, Task* done) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( diff --git a/remoting/client/plugin/pepper_view_proxy.h b/remoting/client/plugin/pepper_view_proxy.h index e6b7d0a..4f65ce6 100644 --- a/remoting/client/plugin/pepper_view_proxy.h +++ b/remoting/client/plugin/pepper_view_proxy.h @@ -61,7 +61,7 @@ class PepperViewProxy : public base::RefCountedThreadSafe<PepperViewProxy>, Task* done); virtual void ReleaseFrame(media::VideoFrame* frame); virtual void OnPartialFrameOutput(media::VideoFrame* frame, - RectVector* rects, + UpdatedRects* rects, Task* done); // Remove the reference to |instance_| and |view_| by setting the value to diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc index b653e27..b96b7ba 100644 --- a/remoting/client/rectangle_update_decoder.cc +++ b/remoting/client/rectangle_update_decoder.cc @@ -20,7 +20,7 @@ namespace remoting { class PartialFrameCleanup : public Task { public: - PartialFrameCleanup(media::VideoFrame* frame, RectVector* rects, + PartialFrameCleanup(media::VideoFrame* frame, UpdatedRects* rects, RectangleUpdateDecoder* decoder) : frame_(frame), rects_(rects), decoder_(decoder) { } @@ -36,7 +36,7 @@ class PartialFrameCleanup : public Task { private: scoped_refptr<media::VideoFrame> frame_; - RectVector* rects_; + UpdatedRects* rects_; scoped_refptr<RectangleUpdateDecoder> decoder_; }; @@ -52,8 +52,8 @@ RectangleUpdateDecoder::~RectangleUpdateDecoder() { } void RectangleUpdateDecoder::Initialize(const SessionConfig& config) { - initial_screen_size_ = SkISize::Make(config.initial_resolution().width, - config.initial_resolution().height); + initial_screen_size_ = gfx::Size(config.initial_resolution().width, + config.initial_resolution().height); // Initialize decoder based on the selected codec. ChannelConfig::Codec codec = config.video_config().codec; @@ -98,20 +98,16 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, // Find the required frame size. bool has_screen_size = packet->format().has_screen_width() && packet->format().has_screen_height(); - SkISize screen_size(SkISize::Make(packet->format().screen_width(), - packet->format().screen_height())); + gfx::Size screen_size(packet->format().screen_width(), + packet->format().screen_height()); if (!has_screen_size) screen_size = initial_screen_size_; // Find the current frame size. - int width = 0; - int height = 0; - if (frame_) { - width = static_cast<int>(frame_->width()); - height = static_cast<int>(frame_->height()); - } - - SkISize frame_size(SkISize::Make(width, height)); + gfx::Size frame_size(0, 0); + if (frame_) + frame_size = gfx::Size(static_cast<int>(frame_->width()), + static_cast<int>(frame_->height())); // Allocate a new frame, if necessary. if ((!frame_) || (has_screen_size && (screen_size != frame_size))) { @@ -179,7 +175,7 @@ void RectangleUpdateDecoder::SetScaleRatios(double horizontal_ratio, decoder_->SetScaleRatios(horizontal_ratio, vertical_ratio); } -void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { +void RectangleUpdateDecoder::UpdateClipRect(const gfx::Rect& new_clip_rect) { if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, @@ -193,36 +189,36 @@ void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { return; // Find out the rectangles to show because of clip rect is updated. - if (new_clip_rect.fTop < clip_rect_.fTop) { + if (new_clip_rect.y() < clip_rect_.y()) { refresh_rects_.push_back( - SkIRect::MakeXYWH(new_clip_rect.fLeft, - new_clip_rect.fTop, - new_clip_rect.width(), - clip_rect_.fTop - new_clip_rect.fTop)); + gfx::Rect(new_clip_rect.x(), + new_clip_rect.y(), + new_clip_rect.width(), + clip_rect_.y() - new_clip_rect.y())); } - if (new_clip_rect.fLeft < clip_rect_.fLeft) { + if (new_clip_rect.x() < clip_rect_.x()) { refresh_rects_.push_back( - SkIRect::MakeXYWH(new_clip_rect.fLeft, - clip_rect_.fTop, - clip_rect_.fLeft - new_clip_rect.fLeft, - clip_rect_.height())); + gfx::Rect(new_clip_rect.x(), + clip_rect_.y(), + clip_rect_.x() - new_clip_rect.x(), + clip_rect_.height())); } - if (new_clip_rect.fRight > clip_rect_.fRight) { + if (new_clip_rect.right() > clip_rect_.right()) { refresh_rects_.push_back( - SkIRect::MakeXYWH(clip_rect_.fRight, - clip_rect_.fTop, - new_clip_rect.fRight - clip_rect_.fRight, - new_clip_rect.height())); + gfx::Rect(clip_rect_.right(), + clip_rect_.y(), + new_clip_rect.right() - clip_rect_.right(), + new_clip_rect.height())); } - if (new_clip_rect.fBottom > clip_rect_.fBottom) { + if (new_clip_rect.bottom() > clip_rect_.bottom()) { refresh_rects_.push_back( - SkIRect::MakeXYWH(new_clip_rect.fLeft, - clip_rect_.fBottom, - new_clip_rect.width(), - new_clip_rect.fBottom - clip_rect_.fBottom)); + gfx::Rect(new_clip_rect.x(), + clip_rect_.bottom(), + new_clip_rect.width(), + new_clip_rect.bottom() - clip_rect_.bottom())); } clip_rect_ = new_clip_rect; @@ -244,8 +240,8 @@ void RectangleUpdateDecoder::RefreshFullFrame() { return; refresh_rects_.push_back( - SkIRect::MakeWH(static_cast<int>(frame_->width()), - static_cast<int>(frame_->height()))); + gfx::Rect(0, 0, static_cast<int>(frame_->width()), + static_cast<int>(frame_->height()))); DoRefresh(); } @@ -255,7 +251,7 @@ void RectangleUpdateDecoder::SubmitToConsumer() { if (!frame_) return; - RectVector* dirty_rects = new RectVector(); + UpdatedRects* dirty_rects = new UpdatedRects(); decoder_->GetUpdatedRects(dirty_rects); frame_is_consuming_ = true; diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h index d44bb6f..7394bd4 100644 --- a/remoting/client/rectangle_update_decoder.h +++ b/remoting/client/rectangle_update_decoder.h @@ -9,6 +9,8 @@ #include "base/task.h" #include "media/base/video_frame.h" #include "remoting/base/decoder.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/size.h" class MessageLoop; @@ -52,7 +54,7 @@ class RectangleUpdateDecoder : // report dirty rectangles accordingly to enhance performance. // // If scale ratio is not 1.0 then clipping rectangle is ignored. - void UpdateClipRect(const SkIRect& clip_rect); + void UpdateClipRect(const gfx::Rect& clip_rect); // Force the decoder to output the last decoded video frame without any // clipping. @@ -66,7 +68,7 @@ class RectangleUpdateDecoder : void AllocateFrame(const VideoPacket* packet, Task* done); void ProcessPacketData(const VideoPacket* packet, Task* done); - void RefreshRects(const RectVector& rects); + void RefreshRects(const std::vector<gfx::Rect>& rects); // Obtain updated rectangles from decoder and submit it to the consumer. void SubmitToConsumer(); @@ -83,9 +85,9 @@ class RectangleUpdateDecoder : MessageLoop* message_loop_; FrameConsumer* consumer_; - SkISize initial_screen_size_; - SkIRect clip_rect_; - RectVector refresh_rects_; + gfx::Size initial_screen_size_; + gfx::Rect clip_rect_; + std::vector<gfx::Rect> refresh_rects_; scoped_ptr<Decoder> decoder_; |