| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/gfx/canvas.h" | 5 #include "app/gfx/canvas.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "app/gfx/font.h" | 9 #include "app/gfx/font.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // CreateBitmapShader returns a Shader with a reference count of one, we | 241 // CreateBitmapShader returns a Shader with a reference count of one, we |
| 242 // need to unref after paint takes ownership of the shader. | 242 // need to unref after paint takes ownership of the shader. |
| 243 shader->unref(); | 243 shader->unref(); |
| 244 save(); | 244 save(); |
| 245 translate(SkIntToScalar(dest_x - src_x), SkIntToScalar(dest_y - src_y)); | 245 translate(SkIntToScalar(dest_x - src_x), SkIntToScalar(dest_y - src_y)); |
| 246 ClipRectInt(src_x, src_y, w, h); | 246 ClipRectInt(src_x, src_y, w, h); |
| 247 drawPaint(paint); | 247 drawPaint(paint); |
| 248 restore(); | 248 restore(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 SkBitmap Canvas::ExtractBitmap() { | 251 SkBitmap Canvas::ExtractBitmap() const { |
| 252 const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); | 252 const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); |
| 253 | 253 |
| 254 // Make a bitmap to return, and a canvas to draw into it. We don't just want | 254 // Make a bitmap to return, and a canvas to draw into it. We don't just want |
| 255 // to call extractSubset or the copy constuctor, since we want an actual copy | 255 // to call extractSubset or the copy constuctor, since we want an actual copy |
| 256 // of the bitmap. | 256 // of the bitmap. |
| 257 SkBitmap result; | 257 SkBitmap result; |
| 258 device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); | 258 device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); |
| 259 return result; | 259 return result; |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace gfx | 262 } // namespace gfx |
| OLD | NEW |