Chromium Code Reviews| Index: content/renderer/pepper/pepper_graphics_2d_host.cc |
| diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc |
| index 9b1cd3749ec553fe13639f9a6b35444006dfebf3..29ebb756f89b522a6dcf13b91062aca642b41c52 100644 |
| --- a/content/renderer/pepper/pepper_graphics_2d_host.cc |
| +++ b/content/renderer/pepper/pepper_graphics_2d_host.cc |
| @@ -14,6 +14,8 @@ |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "base/trace_event/trace_event.h" |
| #include "build/build_config.h" |
| +#include "cc/paint/paint_canvas.h" |
| +#include "cc/paint/paint_flags.h" |
| #include "cc/resources/shared_bitmap.h" |
| #include "cc/resources/texture_mailbox.h" |
| #include "content/child/child_shared_bitmap_manager.h" |
| @@ -276,13 +278,14 @@ bool PepperGraphics2DHost::ReadImageData(PP_Resource image, |
| // Convert the image data if the format does not match. |
| ConvertImageData(image_data_.get(), src_irect, image_resource, dest_rect); |
| } else { |
| - SkCanvas* dest_canvas = image_resource->GetCanvas(); |
| + cc::PaintCanvas* dest_canvas = image_resource->GetCanvas(); |
| // We want to replace the contents of the bitmap rather than blend. |
| - SkPaint paint; |
| + cc::PaintFlags paint; |
| paint.setBlendMode(SkBlendMode::kSrc); |
| - dest_canvas->drawBitmapRect( |
| - image_data_->GetMappedBitmap(), src_irect, dest_rect, &paint); |
| + cc::GetSkCanvas(dest_canvas) |
| + ->drawBitmapRect(image_data_->GetMappedBitmap(), src_irect, dest_rect, |
| + &paint); |
| } |
| return true; |
| } |
| @@ -327,7 +330,7 @@ void PepperGraphics2DHost::Paint(blink::WebCanvas* canvas, |
| gfx::Rect invalidate_rect = plugin_rect; |
| invalidate_rect.Intersect(paint_rect); |
| SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect); |
| - SkAutoCanvasRestore auto_restore(canvas, true); |
| + cc::PaintCanvasAutoRestore auto_restore(canvas, true); |
| canvas->clipRect(sk_invalidate_rect); |
| gfx::Size pixel_image_size(image_data_->width(), image_data_->height()); |
| gfx::Size image_size = gfx::ScaleToFlooredSize(pixel_image_size, scale_); |
| @@ -343,18 +346,18 @@ void PepperGraphics2DHost::Paint(blink::WebCanvas* canvas, |
| // show white (typically less jarring) rather than black or uninitialized. |
| // We don't do this for non-full-frame plugins since we specifically want |
| // the page background to show through. |
| - SkAutoCanvasRestore auto_restore(canvas, true); |
| + cc::PaintCanvasAutoRestore auto_restore(canvas, true); |
| SkRect image_data_rect = |
| gfx::RectToSkRect(gfx::Rect(plugin_rect.origin(), image_size)); |
| canvas->clipRect(image_data_rect, SkClipOp::kDifference); |
| - SkPaint paint; |
| + cc::PaintFlags paint; |
| paint.setBlendMode(SkBlendMode::kSrc); |
| paint.setColor(SK_ColorWHITE); |
| canvas->drawRect(sk_invalidate_rect, paint); |
| } |
| - SkPaint paint; |
| + cc::PaintFlags paint; |
| if (is_always_opaque_) { |
| // When we know the device is opaque, we can disable blending for slightly |
| // more optimized painting. |
| @@ -735,13 +738,14 @@ void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image, |
| ConvertImageData(image, src_irect, image_data_.get(), dest_rect); |
| } else { |
| // We're guaranteed to have a mapped canvas since we mapped it in Init(). |
| - SkCanvas* backing_canvas = image_data_->GetCanvas(); |
| + cc::PaintCanvas* backing_canvas = image_data_->GetCanvas(); |
|
danakj
2017/01/20 23:34:14
does image_data_ really return a cc::PaintCanvas?
enne (OOO)
2017/01/24 01:51:28
Thanks, missed this one as a part of reverting cha
|
| // We want to replace the contents of the bitmap rather than blend. |
| - SkPaint paint; |
| + cc::PaintFlags paint; |
| paint.setBlendMode(SkBlendMode::kSrc); |
| - backing_canvas->drawBitmapRect( |
| - image->GetMappedBitmap(), src_irect, dest_rect, &paint); |
| + cc::GetSkCanvas(backing_canvas) |
| + ->drawBitmapRect(image->GetMappedBitmap(), src_irect, dest_rect, |
| + &paint); |
| } |
| } |