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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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
OLDNEW
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"
11 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/vector2d.h"
12 13
13 #if defined(OS_OPENBSD) 14 #if defined(OS_OPENBSD)
14 #include <cairo.h> 15 #include <cairo.h>
15 #elif defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 16 #elif defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
16 #include <cairo/cairo.h> 17 #include <cairo/cairo.h>
17 #endif 18 #endif
18 19
19 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
20 #include "base/mac/scoped_cftyperef.h" 21 #include "base/mac/scoped_cftyperef.h"
21 #endif 22 #endif
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 DCHECK(skia::SupportsPlatformPaint(dst_canvas)); 122 DCHECK(skia::SupportsPlatformPaint(dst_canvas));
122 DCHECK(skia::SupportsPlatformPaint(src_canvas)); 123 DCHECK(skia::SupportsPlatformPaint(src_canvas));
123 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect, 124 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect,
124 skia::BeginPlatformPaint(src_canvas), src_origin); 125 skia::BeginPlatformPaint(src_canvas), src_origin);
125 skia::EndPlatformPaint(src_canvas); 126 skia::EndPlatformPaint(src_canvas);
126 skia::EndPlatformPaint(dst_canvas); 127 skia::EndPlatformPaint(dst_canvas);
127 } 128 }
128 129
129 void ScrollCanvas(SkCanvas* canvas, 130 void ScrollCanvas(SkCanvas* canvas,
130 const gfx::Rect& in_clip, 131 const gfx::Rect& in_clip,
131 const gfx::Point& amount) { 132 const gfx::Vector2d& amount) {
132 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff. 133 DCHECK(!HasClipOrTransform(*canvas)); // Don't support special stuff.
133 #if defined(OS_WIN) 134 #if defined(OS_WIN)
134 // If we have a PlatformCanvas, we should use ScrollDC. Otherwise, fall 135 // If we have a PlatformCanvas, we should use ScrollDC. Otherwise, fall
135 // through to the software implementation. 136 // through to the software implementation.
136 if (skia::SupportsPlatformPaint(canvas)) { 137 if (skia::SupportsPlatformPaint(canvas)) {
137 skia::ScopedPlatformPaint scoped_platform_paint(canvas); 138 skia::ScopedPlatformPaint scoped_platform_paint(canvas);
138 HDC hdc = scoped_platform_paint.GetPlatformSurface(); 139 HDC hdc = scoped_platform_paint.GetPlatformSurface();
139 140
140 RECT damaged_rect; 141 RECT damaged_rect;
141 RECT r = in_clip.ToRECT(); 142 RECT r = in_clip.ToRECT();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Fortunately, memmove already handles this for us. 188 // Fortunately, memmove already handles this for us.
188 for (int y = 0; y < dest_rect.height(); y++) { 189 for (int y = 0; y < dest_rect.height(); y++) {
189 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), 190 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y),
190 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), 191 bitmap.getAddr32(src_rect.x(), src_rect.y() + y),
191 row_bytes); 192 row_bytes);
192 } 193 }
193 } 194 }
194 } 195 }
195 196
196 } // namespace gfx 197 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698