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

Side by Side Diff: content/renderer/pepper/pepper_graphics_2d_host.cc

Issue 2361903004: Revert temporary device independent bitmap (Closed)
Patch Set: Created 4 years, 2 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
« 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 "content/renderer/pepper/pepper_graphics_2d_host.h" 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 SkRect image_data_rect = 347 SkRect image_data_rect =
348 gfx::RectToSkRect(gfx::Rect(plugin_rect.origin(), image_size)); 348 gfx::RectToSkRect(gfx::Rect(plugin_rect.origin(), image_size));
349 canvas->clipRect(image_data_rect, SkRegion::kDifference_Op); 349 canvas->clipRect(image_data_rect, SkRegion::kDifference_Op);
350 350
351 SkPaint paint; 351 SkPaint paint;
352 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 352 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
353 paint.setColor(SK_ColorWHITE); 353 paint.setColor(SK_ColorWHITE);
354 canvas->drawRect(sk_invalidate_rect, paint); 354 canvas->drawRect(sk_invalidate_rect, paint);
355 } 355 }
356 356
357 SkBitmap image;
358 // Copy to device independent bitmap when target canvas doesn't support
359 // platform paint.
360 if (!skia::SupportsPlatformPaint(canvas))
361 backing_bitmap.copyTo(&image, kN32_SkColorType);
362 else
363 image = backing_bitmap;
364
365 SkPaint paint; 357 SkPaint paint;
366 if (is_always_opaque_) { 358 if (is_always_opaque_) {
367 // When we know the device is opaque, we can disable blending for slightly 359 // When we know the device is opaque, we can disable blending for slightly
368 // more optimized painting. 360 // more optimized painting.
369 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 361 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
370 } 362 }
371 363
372 SkPoint pixel_origin(PointToSkPoint(plugin_rect.origin())); 364 SkPoint pixel_origin(PointToSkPoint(plugin_rect.origin()));
373 if (scale_ != 1.0f && scale_ > 0.0f) { 365 if (scale_ != 1.0f && scale_ > 0.0f) {
374 canvas->scale(scale_, scale_); 366 canvas->scale(scale_, scale_);
375 pixel_origin.scale(1.0f / scale_); 367 pixel_origin.scale(1.0f / scale_);
376 } 368 }
377 canvas->drawBitmap(image, pixel_origin.x(), pixel_origin.y(), &paint); 369 canvas->drawBitmap(backing_bitmap, pixel_origin.x(), pixel_origin.y(),
370 &paint);
378 } 371 }
379 372
380 void PepperGraphics2DHost::ViewInitiatedPaint() { 373 void PepperGraphics2DHost::ViewInitiatedPaint() {
381 TRACE_EVENT0("pepper", "PepperGraphics2DHost::ViewInitiatedPaint"); 374 TRACE_EVENT0("pepper", "PepperGraphics2DHost::ViewInitiatedPaint");
382 if (need_flush_ack_) { 375 if (need_flush_ack_) {
383 SendFlushAck(); 376 SendFlushAck();
384 need_flush_ack_ = false; 377 need_flush_ack_ = false;
385 } 378 }
386 } 379 }
387 380
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 gfx::Point inverse_scaled_point = 828 gfx::Point inverse_scaled_point =
836 gfx::ScaleToFlooredPoint(*delta, inverse_scale); 829 gfx::ScaleToFlooredPoint(*delta, inverse_scale);
837 if (original_delta != inverse_scaled_point) 830 if (original_delta != inverse_scaled_point)
838 return false; 831 return false;
839 } 832 }
840 833
841 return true; 834 return true;
842 } 835 }
843 836
844 } // namespace content 837 } // namespace content
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