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 "content/renderer/pepper/pepper_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 TRACE_EVENT0("pepper", "PepperGraphics2DHost::Paint"); | 325 TRACE_EVENT0("pepper", "PepperGraphics2DHost::Paint"); |
326 ImageDataAutoMapper auto_mapper(image_data_.get()); | 326 ImageDataAutoMapper auto_mapper(image_data_.get()); |
327 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); | 327 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); |
328 | 328 |
329 gfx::Rect invalidate_rect = plugin_rect; | 329 gfx::Rect invalidate_rect = plugin_rect; |
330 invalidate_rect.Intersect(paint_rect); | 330 invalidate_rect.Intersect(paint_rect); |
331 SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect); | 331 SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect); |
332 SkAutoCanvasRestore auto_restore(canvas, true); | 332 SkAutoCanvasRestore auto_restore(canvas, true); |
333 canvas->clipRect(sk_invalidate_rect); | 333 canvas->clipRect(sk_invalidate_rect); |
334 gfx::Size pixel_image_size(image_data_->width(), image_data_->height()); | 334 gfx::Size pixel_image_size(image_data_->width(), image_data_->height()); |
335 gfx::Size image_size = | 335 gfx::Size image_size = gfx::ScaleToFlooredSize(pixel_image_size, scale_); |
336 gfx::ToFlooredSize(gfx::ScaleSize(pixel_image_size, scale_)); | |
337 | 336 |
338 PepperPluginInstance* plugin_instance = | 337 PepperPluginInstance* plugin_instance = |
339 renderer_ppapi_host_->GetPluginInstance(pp_instance()); | 338 renderer_ppapi_host_->GetPluginInstance(pp_instance()); |
340 if (!plugin_instance) | 339 if (!plugin_instance) |
341 return; | 340 return; |
342 if (plugin_instance->IsFullPagePlugin()) { | 341 if (plugin_instance->IsFullPagePlugin()) { |
343 // When we're resizing a window with a full-frame plugin, the plugin may | 342 // When we're resizing a window with a full-frame plugin, the plugin may |
344 // not yet have bound a new device, which will leave parts of the | 343 // not yet have bound a new device, which will leave parts of the |
345 // background exposed if the window is getting larger. We want this to | 344 // background exposed if the window is getting larger. We want this to |
346 // show white (typically less jarring) rather than black or uninitialized. | 345 // show white (typically less jarring) rather than black or uninitialized. |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 gfx::Point inverse_scaled_point = | 814 gfx::Point inverse_scaled_point = |
816 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); | 815 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); |
817 if (original_delta != inverse_scaled_point) | 816 if (original_delta != inverse_scaled_point) |
818 return false; | 817 return false; |
819 } | 818 } |
820 | 819 |
821 return true; | 820 return true; |
822 } | 821 } |
823 | 822 |
824 } // namespace content | 823 } // namespace content |
OLD | NEW |