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

Unified Diff: ui/gfx/blit.cc

Issue 10790063: PPAPI/NaCl: Make ImageData for NaCl just use shared memory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make PPB_ImageData_API base non-exported Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/resource_creation_api.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+#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
« no previous file with comments | « ppapi/thunk/resource_creation_api.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698