OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sad_plugin.h" | 5 #include "webkit/plugins/sad_plugin.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
8 #include "third_party/skia/include/core/SkScalar.h" | 8 #include "third_party/skia/include/core/SkScalar.h" |
9 #include "ui/gfx/blit.h" | 9 #include "ui/gfx/blit.h" |
10 #include "ui/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas_skia.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 canvas.drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height), | 31 canvas.drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height), |
32 paint); | 32 paint); |
33 canvas.DrawBitmapInt(sad_plugin_bitmap, | 33 canvas.DrawBitmapInt(sad_plugin_bitmap, |
34 std::max(0, (width - sad_plugin_bitmap.width()) / 2), | 34 std::max(0, (width - sad_plugin_bitmap.width()) / 2), |
35 std::max(0, (height - sad_plugin_bitmap.height()) / 2)); | 35 std::max(0, (height - sad_plugin_bitmap.height()) / 2)); |
36 | 36 |
37 // It's slightly less code to make a big SkBitmap of the sad tab image and | 37 // It's slightly less code to make a big SkBitmap of the sad tab image and |
38 // then copy that to the screen than to use the native APIs. The small speed | 38 // then copy that to the screen than to use the native APIs. The small speed |
39 // penalty is not important when drawing crashed plugins. | 39 // penalty is not important when drawing crashed plugins. |
40 #if WEBKIT_USING_SKIA | 40 #if WEBKIT_USING_SKIA |
41 gfx::NativeDrawingContext context = webcanvas->beginPlatformPaint(); | 41 skia::PlatformCanvas* platform_canvas = |
reed1
2011/04/01 17:44:42
I presume these casts get replaced by some static
alokp
2011/04/01 19:57:38
Done.
| |
42 static_cast<skia::PlatformCanvas*>(webcanvas); | |
43 gfx::NativeDrawingContext context = platform_canvas->beginPlatformPaint(); | |
42 BlitCanvasToContext(context, plugin_rect, &canvas, gfx::Point(0, 0)); | 44 BlitCanvasToContext(context, plugin_rect, &canvas, gfx::Point(0, 0)); |
43 webcanvas->endPlatformPaint(); | 45 platform_canvas->endPlatformPaint(); |
44 #elif WEBKIT_USING_CG | 46 #elif WEBKIT_USING_CG |
45 BlitCanvasToContext(webcanvas, plugin_rect, &canvas, gfx::Point(0, 0)); | 47 BlitCanvasToContext(webcanvas, plugin_rect, &canvas, gfx::Point(0, 0)); |
46 #endif | 48 #endif |
47 } | 49 } |
48 | 50 |
49 } // namespace webkit | 51 } // namespace webkit |
OLD | NEW |