| 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/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 base::ScopedCFTypeRef<CGImageRef> src_image( | 81 base::ScopedCFTypeRef<CGImageRef> src_image( |
| 82 CGBitmapContextCreateImage(src_context)); | 82 CGBitmapContextCreateImage(src_context)); |
| 83 base::ScopedCFTypeRef<CGImageRef> src_sub_image( | 83 base::ScopedCFTypeRef<CGImageRef> src_sub_image( |
| 84 CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect())); | 84 CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect())); |
| 85 CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image); | 85 CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image); |
| 86 NOTIMPLEMENTED(); | 86 NOTIMPLEMENTED(); |
| 87 #endif | 87 #endif |
| 88 } | 88 } |
| 89 | 89 |
| 90 void BlitContextToCanvas(SkCanvas *dst_canvas, | |
| 91 const Rect& dst_rect, | |
| 92 NativeDrawingContext src_context, | |
| 93 const Point& src_origin) { | |
| 94 DCHECK(skia::SupportsPlatformPaint(dst_canvas)); | |
| 95 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect, | |
| 96 src_context, src_origin); | |
| 97 skia::EndPlatformPaint(dst_canvas); | |
| 98 } | |
| 99 | |
| 100 void BlitCanvasToContext(NativeDrawingContext dst_context, | |
| 101 const Rect& dst_rect, | |
| 102 SkCanvas *src_canvas, | |
| 103 const Point& src_origin) { | |
| 104 DCHECK(skia::SupportsPlatformPaint(src_canvas)); | |
| 105 BlitContextToContext(dst_context, dst_rect, | |
| 106 skia::BeginPlatformPaint(src_canvas), src_origin); | |
| 107 skia::EndPlatformPaint(src_canvas); | |
| 108 } | |
| 109 | |
| 110 void BlitCanvasToCanvas(SkCanvas *dst_canvas, | 90 void BlitCanvasToCanvas(SkCanvas *dst_canvas, |
| 111 const Rect& dst_rect, | 91 const Rect& dst_rect, |
| 112 SkCanvas *src_canvas, | 92 SkCanvas *src_canvas, |
| 113 const Point& src_origin) { | 93 const Point& src_origin) { |
| 114 DCHECK(skia::SupportsPlatformPaint(dst_canvas)); | 94 DCHECK(skia::SupportsPlatformPaint(dst_canvas)); |
| 115 DCHECK(skia::SupportsPlatformPaint(src_canvas)); | 95 DCHECK(skia::SupportsPlatformPaint(src_canvas)); |
| 116 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect, | 96 BlitContextToContext(skia::BeginPlatformPaint(dst_canvas), dst_rect, |
| 117 skia::BeginPlatformPaint(src_canvas), src_origin); | 97 skia::BeginPlatformPaint(src_canvas), src_origin); |
| 118 skia::EndPlatformPaint(src_canvas); | 98 skia::EndPlatformPaint(src_canvas); |
| 119 skia::EndPlatformPaint(dst_canvas); | 99 skia::EndPlatformPaint(dst_canvas); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Fortunately, memmove already handles this for us. | 157 // Fortunately, memmove already handles this for us. |
| 178 for (int y = 0; y < dest_rect.height(); y++) { | 158 for (int y = 0; y < dest_rect.height(); y++) { |
| 179 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), | 159 memmove(bitmap.getAddr32(dest_rect.x(), dest_rect.y() + y), |
| 180 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), | 160 bitmap.getAddr32(src_rect.x(), src_rect.y() + y), |
| 181 row_bytes); | 161 row_bytes); |
| 182 } | 162 } |
| 183 } | 163 } |
| 184 } | 164 } |
| 185 | 165 |
| 186 } // namespace gfx | 166 } // namespace gfx |
| OLD | NEW |