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

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

Issue 823133004: Cleanup: Update the path to gfx rect headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rect_f.h Created 5 years, 11 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
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 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
11 #include "ui/gfx/blit.h" 11 #include "ui/gfx/blit.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 void PaintSadPlugin(blink::WebCanvas* webcanvas, 16 void PaintSadPlugin(blink::WebCanvas* webcanvas,
17 const gfx::Rect& plugin_rect, 17 const gfx::Rect& plugin_rect,
18 const SkBitmap& sad_plugin_bitmap) { 18 const SkBitmap& sad_plugin_bitmap) {
19 const int width = plugin_rect.width(); 19 const int width = plugin_rect.width();
20 const int height = plugin_rect.height(); 20 const int height = plugin_rect.height();
21 21
22 SkCanvas* canvas = webcanvas; 22 SkCanvas* canvas = webcanvas;
23 SkAutoCanvasRestore auto_restore(canvas, true); 23 SkAutoCanvasRestore auto_restore(canvas, true);
24 // We draw the sad-plugin bitmap at the origin of canvas. 24 // We draw the sad-plugin bitmap at the origin of canvas.
25 // Add a translation so that it appears at the origin of plugin rect. 25 // Add a translation so that it appears at the origin of plugin rect.
26 canvas->translate(plugin_rect.x(), plugin_rect.y()); 26 canvas->translate(plugin_rect.x(), plugin_rect.y());
27 27
28 SkPaint paint; 28 SkPaint paint;
29 paint.setStyle(SkPaint::kFill_Style); 29 paint.setStyle(SkPaint::kFill_Style);
30 paint.setColor(SK_ColorBLACK); 30 paint.setColor(SK_ColorBLACK);
31 canvas->drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height), 31 canvas->drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height),
32 paint); 32 paint);
33 canvas->drawBitmap( 33 canvas->drawBitmap(
34 sad_plugin_bitmap, 34 sad_plugin_bitmap,
35 SkIntToScalar(std::max(0, (width - sad_plugin_bitmap.width()) / 2)), 35 SkIntToScalar(std::max(0, (width - sad_plugin_bitmap.width()) / 2)),
36 SkIntToScalar(std::max(0, (height - sad_plugin_bitmap.height()) / 2))); 36 SkIntToScalar(std::max(0, (height - sad_plugin_bitmap.height()) / 2)));
37 } 37 }
38 38
39 } // namespace content 39 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget_unittest.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698