| 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 "webkit/glue/plugins/pepper_device_context_2d.h" | 5 #include "webkit/glue/plugins/pepper_device_context_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" |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "gfx/blit.h" |
| 12 #include "gfx/point.h" | 13 #include "gfx/point.h" |
| 13 #include "gfx/rect.h" | 14 #include "gfx/rect.h" |
| 14 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
| 15 #include "third_party/ppapi/c/pp_errors.h" | 16 #include "third_party/ppapi/c/pp_errors.h" |
| 16 #include "third_party/ppapi/c/pp_module.h" | 17 #include "third_party/ppapi/c/pp_module.h" |
| 17 #include "third_party/ppapi/c/pp_rect.h" | 18 #include "third_party/ppapi/c/pp_rect.h" |
| 18 #include "third_party/ppapi/c/pp_resource.h" | 19 #include "third_party/ppapi/c/pp_resource.h" |
| 19 #include "third_party/ppapi/c/ppb_device_context_2d.h" | 20 #include "third_party/ppapi/c/ppb_device_context_2d.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "webkit/glue/plugins/pepper_image_data.h" | 22 #include "webkit/glue/plugins/pepper_image_data.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 507 |
| 507 // We want to replace the contents of the bitmap rather than blend. | 508 // We want to replace the contents of the bitmap rather than blend. |
| 508 SkPaint paint; | 509 SkPaint paint; |
| 509 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 510 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 510 backing_canvas->drawBitmapRect(*image->GetMappedBitmap(), | 511 backing_canvas->drawBitmapRect(*image->GetMappedBitmap(), |
| 511 &src_irect, dest_rect, &paint); | 512 &src_irect, dest_rect, &paint); |
| 512 } | 513 } |
| 513 | 514 |
| 514 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy, | 515 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy, |
| 515 gfx::Rect* invalidated_rect) { | 516 gfx::Rect* invalidated_rect) { |
| 516 // TODO(brettw): implement this. | 517 gfx::ScrollCanvas(image_data_->mapped_canvas(), |
| 518 clip, gfx::Point(dx, dy)); |
| 519 *invalidated_rect = clip; |
| 517 } | 520 } |
| 518 | 521 |
| 519 void DeviceContext2D::ExecuteReplaceContents(ImageData* image, | 522 void DeviceContext2D::ExecuteReplaceContents(ImageData* image, |
| 520 gfx::Rect* invalidated_rect) { | 523 gfx::Rect* invalidated_rect) { |
| 521 image_data_->Swap(image); | 524 image_data_->Swap(image); |
| 522 *invalidated_rect = gfx::Rect(0, 0, | 525 *invalidated_rect = gfx::Rect(0, 0, |
| 523 image_data_->width(), image_data_->height()); | 526 image_data_->width(), image_data_->height()); |
| 524 } | 527 } |
| 525 | 528 |
| 526 void DeviceContext2D::ScheduleOffscreenCallback( | 529 void DeviceContext2D::ScheduleOffscreenCallback( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 544 data.Execute(PP_OK); | 547 data.Execute(PP_OK); |
| 545 } | 548 } |
| 546 | 549 |
| 547 bool DeviceContext2D::HasPendingFlush() const { | 550 bool DeviceContext2D::HasPendingFlush() const { |
| 548 return !unpainted_flush_callback_.is_null() || | 551 return !unpainted_flush_callback_.is_null() || |
| 549 !painted_flush_callback_.is_null() || | 552 !painted_flush_callback_.is_null() || |
| 550 offscreen_flush_pending_; | 553 offscreen_flush_pending_; |
| 551 } | 554 } |
| 552 | 555 |
| 553 } // namespace pepper | 556 } // namespace pepper |
| OLD | NEW |