Chromium Code Reviews| Index: ui/gfx/blit.cc |
| diff --git a/ui/gfx/blit.cc b/ui/gfx/blit.cc |
| index 5ee64701fcbab853d918f92b9e9657d5c653566e..1aeea03dfb7a58ce0ffaf5ace509a66b18219c43 100644 |
| --- a/ui/gfx/blit.cc |
| +++ b/ui/gfx/blit.cc |
| @@ -126,30 +126,27 @@ void BlitCanvasToCanvas(SkCanvas *dst_canvas, |
| skia::EndPlatformPaint(dst_canvas); |
| } |
| -#if defined(OS_WIN) && !defined(USE_AURA) |
| - |
| -void ScrollCanvas(SkCanvas* canvas, |
| - const gfx::Rect& clip, |
| - const gfx::Point& amount) { |
| - DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. |
| - DCHECK(skia::SupportsPlatformPaint(canvas)); |
| - skia::ScopedPlatformPaint scoped_platform_paint(canvas); |
| - HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
| - |
| - RECT damaged_rect; |
| - RECT r = clip.ToRECT(); |
| - ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect); |
| -} |
| - |
| -#elif defined(OS_POSIX) || defined(USE_AURA) |
| -// Cairo has no nice scroll function so we do our own. On Mac it's possible to |
| -// use platform scroll code, but it's complex so we just use the same path |
| -// here. Either way it will be software-only, so it shouldn't matter much. |
| - |
| void ScrollCanvas(SkCanvas* canvas, |
| const gfx::Rect& in_clip, |
| const gfx::Point& amount) { |
| DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. |
| +#if defined(OS_WIN) |
| + // If we have a PlatformCanvas, we should use ScrollDC. Otherwise, fall |
| + // through to the software implementation. |
| + if (skia::SupportsPlatformPaint(canvas)) { |
| + skia::ScopedPlatformPaint scoped_platform_paint(canvas); |
| + HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
| + |
| + RECT damaged_rect; |
| + RECT r = in_clip.ToRECT(); |
| + ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect); |
| + return; |
| + } |
|
dmichael (off chromium)
2012/07/20 18:24:04
Previously, Windows assumed that the canvas was al
|
| +#endif // defined(OS_WIN) |
| + // For non-windows, always do scrolling in software. |
| + // Cairo has no nice scroll function so we do our own. On Mac it's possible to |
| + // use platform scroll code, but it's complex so we just use the same path |
| + // here. Either way it will be software-only, so it shouldn't matter much. |
| SkBitmap& bitmap = const_cast<SkBitmap&>( |
| skia::GetTopDevice(*canvas)->accessBitmap(true)); |
| SkAutoLockPixels lock(bitmap); |
| @@ -196,6 +193,4 @@ void ScrollCanvas(SkCanvas* canvas, |
| } |
| } |
| -#endif |
| - |
| } // namespace gfx |