| OLD | NEW |
| 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 "ui/gfx/blit.h" | 5 #include "ui/gfx/blit.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 skia::EndPlatformPaint(dst_canvas); | 126 skia::EndPlatformPaint(dst_canvas); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ScrollCanvas(SkCanvas* canvas, | 129 void ScrollCanvas(SkCanvas* canvas, |
| 130 const gfx::Rect& in_clip, | 130 const gfx::Rect& in_clip, |
| 131 const gfx::Point& amount) { | 131 const gfx::Point& amount) { |
| 132 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. | 132 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. |
| 133 #if defined(OS_WIN) | 133 #if defined(OS_WIN) |
| 134 // If we have a PlatformCanvas, we should use ScrollDC. Otherwise, fall | 134 // If we have a PlatformCanvas, we should use ScrollDC. Otherwise, fall |
| 135 // through to the software implementation. | 135 // through to the software implementation. |
| 136 if (skia::SupportsPlatformPaint(canvas)) { | 136 if (skia::SupportsDirectPlatformPaint(canvas)) { |
| 137 skia::ScopedPlatformPaint scoped_platform_paint(canvas); | 137 skia::ScopedPlatformPaint scoped_platform_paint(canvas); |
| 138 HDC hdc = scoped_platform_paint.GetPlatformSurface(); | 138 HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
| 139 | 139 |
| 140 RECT damaged_rect; | 140 RECT damaged_rect; |
| 141 RECT r = in_clip.ToRECT(); | 141 RECT r = in_clip.ToRECT(); |
| 142 ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect); | 142 ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 #endif // defined(OS_WIN) | 145 #endif // defined(OS_WIN) |
| 146 // For non-windows, always do scrolling in software. | 146 // For non-windows, always do scrolling in software. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Fortunately, memmove already handles this for us. | 187 // Fortunately, memmove already handles this for us. |
| 188 for (int y = 0; y < dest_rect.height(); y++) { | 188 for (int y = 0; y < dest_rect.height(); y++) { |
| 189 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), | 189 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), |
| 190 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), | 190 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), |
| 191 row_bytes); | 191 row_bytes); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace gfx | 196 } // namespace gfx |
| OLD | NEW |