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're assuming the native format is BGRA_PREMUL below. This | 46 // TODO(ajwong): We shouldn't assume the image data format. |
47 // is wrong. | 47 pp::ImageData image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
48 pp::ImageData image(pp::ImageData::GetNativeImageDataFormat(), | |
49 pp::Size(viewport_width_, viewport_height_), | 48 pp::Size(viewport_width_, viewport_height_), |
50 false); | 49 false); |
51 if (image.is_null()) { | 50 if (image.is_null()) { |
52 LOG(ERROR) << "Unable to allocate image of size: " | 51 LOG(ERROR) << "Unable to allocate image."; |
53 << viewport_width_ << "x" << viewport_height_; | |
54 return; | 52 return; |
55 } | 53 } |
56 | 54 |
57 if (is_static_fill_) { | 55 if (is_static_fill_) { |
58 for (int y = 0; y < image.size().height(); y++) { | 56 for (int y = 0; y < image.size().height(); y++) { |
59 for (int x = 0; x < image.size().width(); x++) { | 57 for (int x = 0; x < image.size().width(); x++) { |
60 *image.GetAddr32(pp::Point(x, y)) = static_fill_color_; | 58 *image.GetAddr32(pp::Point(x, y)) = static_fill_color_; |
61 } | 59 } |
62 } | 60 } |
63 } else if (frame_) { | 61 } else if (frame_) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 update_rects_.begin(), update_rects_.end()); | 202 update_rects_.begin(), update_rects_.end()); |
205 Paint(); | 203 Paint(); |
206 // TODO(ajwong): Need to block here to be synchronous. | 204 // TODO(ajwong): Need to block here to be synchronous. |
207 } | 205 } |
208 | 206 |
209 | 207 |
210 void PepperView::OnDecodeDone() { | 208 void PepperView::OnDecodeDone() { |
211 } | 209 } |
212 | 210 |
213 } // namespace remoting | 211 } // namespace remoting |
OLD | NEW |