Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Side by Side Diff: chrome/gpu/gpu_video_layer_glx.cc

Issue 3834003: On Windows, create a new TransportDIB::Handle struct which includes the file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/gpu/gpu_video_layer_glx.h" 5 #include "chrome/gpu/gpu_video_layer_glx.h"
6 6
7 #include "app/gfx/gl/gl_bindings.h" 7 #include "app/gfx/gl/gl_bindings.h"
8 #include "chrome/common/gpu_messages.h" 8 #include "chrome/common/gpu_messages.h"
9 #include "chrome/gpu/gpu_thread.h" 9 #include "chrome/gpu/gpu_thread.h"
10 #include "chrome/gpu/gpu_view_x.h" 10 #include "chrome/gpu/gpu_view_x.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 void GpuVideoLayerGLX::OnChannelConnected(int32 peer_pid) { 245 void GpuVideoLayerGLX::OnChannelConnected(int32 peer_pid) {
246 } 246 }
247 247
248 void GpuVideoLayerGLX::OnChannelError() { 248 void GpuVideoLayerGLX::OnChannelError() {
249 // FIXME(brettw) does this mean we aren't getting any more messages and we 249 // FIXME(brettw) does this mean we aren't getting any more messages and we
250 // should delete outselves? 250 // should delete outselves?
251 NOTIMPLEMENTED(); 251 NOTIMPLEMENTED();
252 } 252 }
253 253
254 void GpuVideoLayerGLX::OnPaintToVideoLayer(base::ProcessId source_process_id, 254 void GpuVideoLayerGLX::OnPaintToVideoLayer(TransportDIB::Handle dib_handle,
255 TransportDIB::Id id,
256 const gfx::Rect& bitmap_rect) { 255 const gfx::Rect& bitmap_rect) {
256 TransportDIB::ScopedHandle scoped_dib_handle(dib_handle);
257 // TODO(scherkus): |native_size_| is set in constructor, so perhaps this check 257 // TODO(scherkus): |native_size_| is set in constructor, so perhaps this check
258 // should be a DCHECK(). 258 // should be a DCHECK().
259 const int width = native_size_.width(); 259 const int width = native_size_.width();
260 const int height = native_size_.height(); 260 const int height = native_size_.height();
261 const int stride = width; 261 const int stride = width;
262 262
263 if (width <= 0 || width > kMaxVideoLayerSize || 263 if (width <= 0 || width > kMaxVideoLayerSize ||
264 height <= 0 || height > kMaxVideoLayerSize) 264 height <= 0 || height > kMaxVideoLayerSize)
265 return; 265 return;
266 266
267 TransportDIB* dib = TransportDIB::Map(id); 267 TransportDIB* dib = TransportDIB::Map(scoped_dib_handle.release());
268 if (!dib) 268 if (!dib)
269 return; 269 return;
270 270
271 // Everything looks good, update our target position and size. 271 // Everything looks good, update our target position and size.
272 target_rect_ = bitmap_rect; 272 target_rect_ = bitmap_rect;
273 273
274 // Perform colour space conversion. 274 // Perform colour space conversion.
275 uint8* planes[kYUVPlanes]; 275 uint8* planes[kYUVPlanes];
276 planes[kYPlane] = reinterpret_cast<uint8*>(dib->memory()); 276 planes[kYPlane] = reinterpret_cast<uint8*>(dib->memory());
277 planes[kUPlane] = planes[kYPlane] + width * height; 277 planes[kUPlane] = planes[kYPlane] + width * height;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 vertices[3] = -2.0f * (object.bottom() / height) + 1.0f; 323 vertices[3] = -2.0f * (object.bottom() / height) + 1.0f;
324 324
325 // Top right. 325 // Top right.
326 vertices[4] = 2.0f * (object.right() / width) - 1.0f; 326 vertices[4] = 2.0f * (object.right() / width) - 1.0f;
327 vertices[5] = -2.0f * (object.y() / height) + 1.0f; 327 vertices[5] = -2.0f * (object.y() / height) + 1.0f;
328 328
329 // Bottom right. 329 // Bottom right.
330 vertices[6] = 2.0f * (object.right() / width) - 1.0f; 330 vertices[6] = 2.0f * (object.right() / width) - 1.0f;
331 vertices[7] = -2.0f * (object.bottom() / height) + 1.0f; 331 vertices[7] = -2.0f * (object.bottom() / height) + 1.0f;
332 } 332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698