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

Side by Side Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 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 | « webkit/glue/webcursor_aurax11.cc ('k') | no next file » | 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) 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // TODO(brettw) bug 56673: do a direct memcpy instead of going through CG 556 // TODO(brettw) bug 56673: do a direct memcpy instead of going through CG
557 // if the is_always_opaque_ flag is set. Must ensure bitmap is still clipped. 557 // if the is_always_opaque_ flag is set. Must ensure bitmap is still clipped.
558 558
559 CGContextDrawImage(canvas, bitmap_rect, image); 559 CGContextDrawImage(canvas, bitmap_rect, image);
560 #else 560 #else
561 gfx::Rect invalidate_rect = gfx::IntersectRects(plugin_rect, paint_rect); 561 gfx::Rect invalidate_rect = gfx::IntersectRects(plugin_rect, paint_rect);
562 SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect); 562 SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect);
563 SkAutoCanvasRestore auto_restore(canvas, true); 563 SkAutoCanvasRestore auto_restore(canvas, true);
564 canvas->clipRect(sk_invalidate_rect); 564 canvas->clipRect(sk_invalidate_rect);
565 gfx::Size pixel_image_size(image_data_->width(), image_data_->height()); 565 gfx::Size pixel_image_size(image_data_->width(), image_data_->height());
566 gfx::Size image_size = gfx::ToFlooredSize(pixel_image_size.Scale(scale_)); 566 gfx::Size image_size = gfx::ToFlooredSize(
567 gfx::ScaleSize(pixel_image_size, scale_));
567 568
568 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); 569 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
569 if (!plugin_instance) 570 if (!plugin_instance)
570 return; 571 return;
571 if (plugin_instance->IsFullPagePlugin()) { 572 if (plugin_instance->IsFullPagePlugin()) {
572 // When we're resizing a window with a full-frame plugin, the plugin may 573 // When we're resizing a window with a full-frame plugin, the plugin may
573 // not yet have bound a new device, which will leave parts of the 574 // not yet have bound a new device, which will leave parts of the
574 // background exposed if the window is getting larger. We want this to 575 // background exposed if the window is getting larger. We want this to
575 // show white (typically less jarring) rather than black or uninitialized. 576 // show white (typically less jarring) rather than black or uninitialized.
576 // We don't do this for non-full-frame plugins since we specifically want 577 // We don't do this for non-full-frame plugins since we specifically want
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 } 758 }
758 759
759 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 760 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
760 return !unpainted_flush_callback_.is_null() || 761 return !unpainted_flush_callback_.is_null() ||
761 !painted_flush_callback_.is_null() || 762 !painted_flush_callback_.is_null() ||
762 offscreen_flush_pending_; 763 offscreen_flush_pending_;
763 } 764 }
764 765
765 } // namespace ppapi 766 } // namespace ppapi
766 } // namespace webkit 767 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/glue/webcursor_aurax11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698