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

Side by Side Diff: webkit/glue/plugins/pepper_graphics_2d.cc

Issue 3915002: Out of process Pepper (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | webkit/glue/plugins/pepper_plugin_module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/glue/plugins/pepper_graphics_2d.h" 5 #include "webkit/glue/plugins/pepper_graphics_2d.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return false; 412 return false;
413 413
414 SkIRect src_irect = { x, y, 414 SkIRect src_irect = { x, y,
415 x + image_resource->width(), 415 x + image_resource->width(),
416 y + image_resource->height() }; 416 y + image_resource->height() };
417 SkRect dest_rect = { SkIntToScalar(0), 417 SkRect dest_rect = { SkIntToScalar(0),
418 SkIntToScalar(0), 418 SkIntToScalar(0),
419 SkIntToScalar(image_resource->width()), 419 SkIntToScalar(image_resource->width()),
420 SkIntToScalar(image_resource->height()) }; 420 SkIntToScalar(image_resource->height()) };
421 421
422 ImageDataAutoMapper auto_mapper2(image_data_);
422 if (image_resource->format() != image_data_->format()) { 423 if (image_resource->format() != image_data_->format()) {
423 // Convert the image data if the format does not match. 424 // Convert the image data if the format does not match.
424 ConvertImageData(image_data_, src_irect, image_resource.get(), dest_rect); 425 ConvertImageData(image_data_, src_irect, image_resource.get(), dest_rect);
425 } else { 426 } else {
426 skia::PlatformCanvas* dest_canvas = image_resource->mapped_canvas(); 427 skia::PlatformCanvas* dest_canvas = image_resource->mapped_canvas();
427 428
428 // We want to replace the contents of the bitmap rather than blend. 429 // We want to replace the contents of the bitmap rather than blend.
429 SkPaint paint; 430 SkPaint paint;
430 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 431 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
431 dest_canvas->drawBitmapRect(*image_data_->GetMappedBitmap(), 432 dest_canvas->drawBitmapRect(*image_data_->GetMappedBitmap(),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 new_instance->InvalidateRect(gfx::Rect()); 465 new_instance->InvalidateRect(gfx::Rect());
465 } 466 }
466 467
467 bound_instance_ = new_instance; 468 bound_instance_ = new_instance;
468 return true; 469 return true;
469 } 470 }
470 471
471 void Graphics2D::Paint(WebKit::WebCanvas* canvas, 472 void Graphics2D::Paint(WebKit::WebCanvas* canvas,
472 const gfx::Rect& plugin_rect, 473 const gfx::Rect& plugin_rect,
473 const gfx::Rect& paint_rect) { 474 const gfx::Rect& paint_rect) {
474 // We're guaranteed to have a mapped canvas since we mapped it in Init(). 475 ImageDataAutoMapper auto_mapper(image_data_);
475 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); 476 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap();
476 477
477 #if defined(OS_MACOSX) 478 #if defined(OS_MACOSX)
478 SkAutoLockPixels lock(backing_bitmap); 479 SkAutoLockPixels lock(backing_bitmap);
479 480
480 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 481 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
481 CGDataProviderCreateWithData( 482 CGDataProviderCreateWithData(
482 NULL, backing_bitmap.getAddr32(0, 0), 483 NULL, backing_bitmap.getAddr32(0, 0),
483 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); 484 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL));
484 base::mac::ScopedCFTypeRef<CGImageRef> image( 485 base::mac::ScopedCFTypeRef<CGImageRef> image(
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 data.Execute(PP_OK); 628 data.Execute(PP_OK);
628 } 629 }
629 630
630 bool Graphics2D::HasPendingFlush() const { 631 bool Graphics2D::HasPendingFlush() const {
631 return !unpainted_flush_callback_.is_null() || 632 return !unpainted_flush_callback_.is_null() ||
632 !painted_flush_callback_.is_null() || 633 !painted_flush_callback_.is_null() ||
633 offscreen_flush_pending_; 634 offscreen_flush_pending_;
634 } 635 }
635 636
636 } // namespace pepper 637 } // namespace pepper
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | webkit/glue/plugins/pepper_plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698