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

Side by Side Diff: content/renderer/sad_plugin.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 | « content/renderer/render_view_impl.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | 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/sad_plugin.h" 5 #include "content/renderer/sad_plugin.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 void PaintSadPlugin(blink::WebCanvas* webcanvas, 15 void PaintSadPlugin(blink::WebCanvas* webcanvas,
16 const gfx::Rect& plugin_rect, 16 const gfx::Rect& plugin_rect,
17 const SkBitmap& sad_plugin_bitmap) { 17 const SkBitmap& sad_plugin_bitmap) {
18 const int width = plugin_rect.width(); 18 const int width = plugin_rect.width();
19 const int height = plugin_rect.height(); 19 const int height = plugin_rect.height();
20 20
21 SkCanvas* canvas = webcanvas; 21 CdlCanvas* canvas = webcanvas;
22 SkAutoCanvasRestore auto_restore(canvas, true); 22 CdlAutoCanvasRestore auto_restore(canvas, true);
23 // We draw the sad-plugin bitmap at the origin of canvas. 23 // We draw the sad-plugin bitmap at the origin of canvas.
24 // Add a translation so that it appears at the origin of plugin rect. 24 // Add a translation so that it appears at the origin of plugin rect.
25 canvas->translate(plugin_rect.x(), plugin_rect.y()); 25 canvas->translate(plugin_rect.x(), plugin_rect.y());
26 26
27 SkPaint paint; 27 CdlPaint paint;
28 paint.setStyle(SkPaint::kFill_Style); 28 paint.setStyle(CdlPaint::kFill_Style);
29 paint.setColor(SK_ColorBLACK); 29 paint.setColor(SK_ColorBLACK);
30 canvas->drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height), 30 canvas->drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height),
31 paint); 31 paint);
32 canvas->drawBitmap( 32 canvas->drawBitmap(
33 sad_plugin_bitmap, 33 sad_plugin_bitmap,
34 SkIntToScalar(std::max(0, (width - sad_plugin_bitmap.width()) / 2)), 34 SkIntToScalar(std::max(0, (width - sad_plugin_bitmap.width()) / 2)),
35 SkIntToScalar(std::max(0, (height - sad_plugin_bitmap.height()) / 2))); 35 SkIntToScalar(std::max(0, (height - sad_plugin_bitmap.height()) / 2)));
36 } 36 }
37 37
38 } // namespace content 38 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698