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 = skia::BeginPlatformPaint(webcanvas); | 41 skia::ScopedPlatformPaint scoped_platform_paint(webcanvas); |
| 42 gfx::NativeDrawingContext context = |
| 43 scoped_platform_paint.GetPlatformSurface(); |
42 BlitCanvasToContext(context, plugin_rect, &canvas, gfx::Point(0, 0)); | 44 BlitCanvasToContext(context, plugin_rect, &canvas, gfx::Point(0, 0)); |
43 skia::EndPlatformPaint(webcanvas); | |
44 #elif WEBKIT_USING_CG | 45 #elif WEBKIT_USING_CG |
45 BlitCanvasToContext(webcanvas, plugin_rect, &canvas, gfx::Point(0, 0)); | 46 BlitCanvasToContext(webcanvas, plugin_rect, &canvas, gfx::Point(0, 0)); |
46 #endif | 47 #endif |
47 } | 48 } |
48 | 49 |
49 } // namespace webkit | 50 } // namespace webkit |
OLD | NEW |