| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/client/plugin/pepper_view.h" | 5 #include "remoting/client/plugin/pepper_view.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "remoting/base/decoder_zlib.h" | 8 #include "remoting/base/decoder_zlib.h" |
| 9 #include "remoting/client/plugin/chromoting_plugin.h" | 9 #include "remoting/client/plugin/chromoting_plugin.h" |
| 10 #include "remoting/client/plugin/pepper_util.h" | 10 #include "remoting/client/plugin/pepper_util.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void PepperView::TearDown() { | 37 void PepperView::TearDown() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PepperView::Paint() { | 40 void PepperView::Paint() { |
| 41 if (!plugin_->CurrentlyOnPluginThread()) { | 41 if (!plugin_->CurrentlyOnPluginThread()) { |
| 42 RunTaskOnPluginThread(NewRunnableMethod(this, &PepperView::Paint)); | 42 RunTaskOnPluginThread(NewRunnableMethod(this, &PepperView::Paint)); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // TODO(ajwong): We shouldn't assume the image data format. | 46 // TODO(ajwong): We're assuming the native format is BGRA_PREMUL below. This |
| 47 pp::ImageData image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 47 // is wrong. |
| 48 pp::ImageData image(pp::ImageData::GetNativeImageDataFormat(), |
| 48 pp::Size(viewport_width_, viewport_height_), | 49 pp::Size(viewport_width_, viewport_height_), |
| 49 false); | 50 false); |
| 50 if (image.is_null()) { | 51 if (image.is_null()) { |
| 51 LOG(ERROR) << "Unable to allocate image."; | 52 LOG(ERROR) << "Unable to allocate image of size: " |
| 53 << viewport_width_ << "x" << viewport_height_; |
| 52 return; | 54 return; |
| 53 } | 55 } |
| 54 | 56 |
| 55 if (is_static_fill_) { | 57 if (is_static_fill_) { |
| 56 for (int y = 0; y < image.size().height(); y++) { | 58 for (int y = 0; y < image.size().height(); y++) { |
| 57 for (int x = 0; x < image.size().width(); x++) { | 59 for (int x = 0; x < image.size().width(); x++) { |
| 58 *image.GetAddr32(pp::Point(x, y)) = static_fill_color_; | 60 *image.GetAddr32(pp::Point(x, y)) = static_fill_color_; |
| 59 } | 61 } |
| 60 } | 62 } |
| 61 } else if (frame_) { | 63 } else if (frame_) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 update_rects_.begin(), update_rects_.end()); | 204 update_rects_.begin(), update_rects_.end()); |
| 203 Paint(); | 205 Paint(); |
| 204 // TODO(ajwong): Need to block here to be synchronous. | 206 // TODO(ajwong): Need to block here to be synchronous. |
| 205 } | 207 } |
| 206 | 208 |
| 207 | 209 |
| 208 void PepperView::OnDecodeDone() { | 210 void PepperView::OnDecodeDone() { |
| 209 } | 211 } |
| 210 | 212 |
| 211 } // namespace remoting | 213 } // namespace remoting |
| OLD | NEW |