OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugins/ppapi/ppb_graphics_2d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 SkPaint paint; | 698 SkPaint paint; |
699 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 699 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
700 backing_canvas->drawBitmapRect(*image->GetMappedBitmap(), | 700 backing_canvas->drawBitmapRect(*image->GetMappedBitmap(), |
701 &src_irect, dest_rect, &paint); | 701 &src_irect, dest_rect, &paint); |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 void PPB_Graphics2D_Impl::ExecuteScroll(const gfx::Rect& clip, | 705 void PPB_Graphics2D_Impl::ExecuteScroll(const gfx::Rect& clip, |
706 int dx, int dy, | 706 int dx, int dy, |
707 gfx::Rect* invalidated_rect) { | 707 gfx::Rect* invalidated_rect) { |
708 gfx::ScrollCanvas(image_data_->GetCanvas(), | 708 gfx::ScrollCanvas(image_data_->GetCanvas(), clip, gfx::Vector2d(dx, dy)); |
709 clip, gfx::Point(dx, dy)); | |
710 *invalidated_rect = clip; | 709 *invalidated_rect = clip; |
711 } | 710 } |
712 | 711 |
713 void PPB_Graphics2D_Impl::ExecuteReplaceContents(PPB_ImageData_Impl* image, | 712 void PPB_Graphics2D_Impl::ExecuteReplaceContents(PPB_ImageData_Impl* image, |
714 gfx::Rect* invalidated_rect, | 713 gfx::Rect* invalidated_rect, |
715 PP_Resource* old_image_data) { | 714 PP_Resource* old_image_data) { |
716 if (image->format() != image_data_->format()) { | 715 if (image->format() != image_data_->format()) { |
717 DCHECK(image->width() == image_data_->width() && | 716 DCHECK(image->width() == image_data_->width() && |
718 image->height() == image_data_->height()); | 717 image->height() == image_data_->height()); |
719 // Convert the image data if the format does not match. | 718 // Convert the image data if the format does not match. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 759 } |
761 | 760 |
762 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 761 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
763 return !unpainted_flush_callback_.is_null() || | 762 return !unpainted_flush_callback_.is_null() || |
764 !painted_flush_callback_.is_null() || | 763 !painted_flush_callback_.is_null() || |
765 offscreen_flush_pending_; | 764 offscreen_flush_pending_; |
766 } | 765 } |
767 | 766 |
768 } // namespace ppapi | 767 } // namespace ppapi |
769 } // namespace webkit | 768 } // namespace webkit |
OLD | NEW |