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

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

Issue 10069004: Fix per-tile painting support in Pepper Graphics2D plugins by using a temporary device independent … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use SkBitmap::copyTo. Created 8 years, 8 months 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 | « no previous file | 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 SkIntToScalar(image_data_->height())); 541 SkIntToScalar(image_data_->height()));
542 canvas->clipRect(image_data_rect, SkRegion::kDifference_Op); 542 canvas->clipRect(image_data_rect, SkRegion::kDifference_Op);
543 543
544 SkPaint paint; 544 SkPaint paint;
545 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 545 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
546 paint.setColor(SK_ColorWHITE); 546 paint.setColor(SK_ColorWHITE);
547 canvas->drawRect(sk_plugin_rect, paint); 547 canvas->drawRect(sk_plugin_rect, paint);
548 canvas->restore(); 548 canvas->restore();
549 } 549 }
550 550
551 SkBitmap image;
552 // Copy to device independent bitmap when target canvas doesn't support
553 // platform paint.
554 if (!skia::SupportsPlatformPaint(canvas))
555 backing_bitmap.copyTo(&image, SkBitmap::kARGB_8888_Config);
556 else
557 image = backing_bitmap;
558
551 SkPaint paint; 559 SkPaint paint;
552 if (is_always_opaque_) { 560 if (is_always_opaque_) {
553 // When we know the device is opaque, we can disable blending for slightly 561 // When we know the device is opaque, we can disable blending for slightly
554 // more optimized painting. 562 // more optimized painting.
555 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 563 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
556 } 564 }
557 canvas->drawBitmap(backing_bitmap, 565 canvas->drawBitmap(image,
558 SkIntToScalar(plugin_rect.x()), 566 SkIntToScalar(plugin_rect.x()),
559 SkIntToScalar(plugin_rect.y()), 567 SkIntToScalar(plugin_rect.y()),
560 &paint); 568 &paint);
561 canvas->restore(); 569 canvas->restore();
562 #endif 570 #endif
563 } 571 }
564 572
565 void PPB_Graphics2D_Impl::ViewWillInitiatePaint() { 573 void PPB_Graphics2D_Impl::ViewWillInitiatePaint() {
566 // Move any "unpainted" callback to the painted state. See 574 // Move any "unpainted" callback to the painted state. See
567 // |unpainted_flush_callback_| in the header for more. 575 // |unpainted_flush_callback_| in the header for more.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } 680 }
673 681
674 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 682 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
675 return !unpainted_flush_callback_.is_null() || 683 return !unpainted_flush_callback_.is_null() ||
676 !painted_flush_callback_.is_null() || 684 !painted_flush_callback_.is_null() ||
677 offscreen_flush_pending_; 685 offscreen_flush_pending_;
678 } 686 }
679 687
680 } // namespace ppapi 688 } // namespace ppapi
681 } // namespace webkit 689 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698