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

Side by Side Diff: ui/gfx/blit.cc

Issue 10256008: Adds a class that makes it easy to subclass a HWND and filter messages sent to it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/win/hwnd_subclass_unittest.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 SkCanvas *src_canvas, 119 SkCanvas *src_canvas,
120 const Point& src_origin) { 120 const Point& src_origin) {
121 DCHECK(skia::SupportsPlatformPaint(dst_canvas)); 121 DCHECK(skia::SupportsPlatformPaint(dst_canvas));
122 DCHECK(skia::SupportsPlatformPaint(src_canvas)); 122 DCHECK(skia::SupportsPlatformPaint(src_canvas));
123 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect, 123 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect,
124 skia::BeginPlatformPaint(src_canvas), src_origin); 124 skia::BeginPlatformPaint(src_canvas), src_origin);
125 skia::EndPlatformPaint(src_canvas); 125 skia::EndPlatformPaint(src_canvas);
126 skia::EndPlatformPaint(dst_canvas); 126 skia::EndPlatformPaint(dst_canvas);
127 } 127 }
128 128
129 #if defined(OS_WIN) 129 #if defined(OS_WIN) && !defined(USE_AURA)
130 130
131 void ScrollCanvas(SkCanvas* canvas, 131 void ScrollCanvas(SkCanvas* canvas,
132 const gfx::Rect& clip, 132 const gfx::Rect& clip,
133 const gfx::Point& amount) { 133 const gfx::Point& amount) {
134 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. 134 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff.
135 DCHECK(skia::SupportsPlatformPaint(canvas)); 135 DCHECK(skia::SupportsPlatformPaint(canvas));
136 skia::ScopedPlatformPaint scoped_platform_paint(canvas); 136 skia::ScopedPlatformPaint scoped_platform_paint(canvas);
137 HDC hdc = scoped_platform_paint.GetPlatformSurface(); 137 HDC hdc = scoped_platform_paint.GetPlatformSurface();
138 138
139 RECT damaged_rect; 139 RECT damaged_rect;
140 RECT r = clip.ToRECT(); 140 RECT r = clip.ToRECT();
141 ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect); 141 ScrollDC(hdc, amount.x(), amount.y(), NULL, &r, NULL, &damaged_rect);
142 } 142 }
143 143
144 #elif defined(OS_POSIX) 144 #elif defined(OS_POSIX) || defined(USE_AURA)
145 // Cairo has no nice scroll function so we do our own. On Mac it's possible to 145 // Cairo has no nice scroll function so we do our own. On Mac it's possible to
146 // use platform scroll code, but it's complex so we just use the same path 146 // use platform scroll code, but it's complex so we just use the same path
147 // here. Either way it will be software-only, so it shouldn't matter much. 147 // here. Either way it will be software-only, so it shouldn't matter much.
148 148
149 void ScrollCanvas(SkCanvas* canvas, 149 void ScrollCanvas(SkCanvas* canvas,
150 const gfx::Rect& in_clip, 150 const gfx::Rect& in_clip,
151 const gfx::Point& amount) { 151 const gfx::Point& amount) {
152 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. 152 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff.
153 SkBitmap& bitmap = const_cast<SkBitmap&>( 153 SkBitmap& bitmap = const_cast<SkBitmap&>(
154 skia::GetTopDevice(*canvas)->accessBitmap(true)); 154 skia::GetTopDevice(*canvas)->accessBitmap(true));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), 192 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y),
193 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), 193 bitmap.getAddr32(src_rect.x(), src_rect.y() + y),
194 row_bytes); 194 row_bytes);
195 } 195 }
196 } 196 }
197 } 197 }
198 198
199 #endif 199 #endif
200 200
201 } // namespace gfx 201 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/win/hwnd_subclass_unittest.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698