| OLD | NEW |
| 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 "chrome/browser/renderer_host/backing_store_skia.h" | 5 #include "content/browser/renderer_host/backing_store_skia.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_process_host.h" | 7 #include "content/browser/renderer_host/render_process_host.h" |
| 8 #include "skia/ext/platform_canvas.h" | 8 #include "skia/ext/platform_canvas.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/canvas_skia.h" | 11 #include "ui/gfx/canvas_skia.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 // Assume that somewhere along the line, someone will do width * height * 4 | 14 // Assume that somewhere along the line, someone will do width * height * 4 |
| 15 // with signed numbers. If the maximum value is 2**31, then 2**31 / 4 = | 15 // with signed numbers. If the maximum value is 2**31, then 2**31 / 4 = |
| 16 // 2**29 and floor(sqrt(2**29)) = 23170. | 16 // 2**29 and floor(sqrt(2**29)) = 23170. |
| 17 | 17 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return false; | 96 return false; |
| 97 | 97 |
| 98 SkBitmap bitmap = output->getTopPlatformDevice().accessBitmap(true); | 98 SkBitmap bitmap = output->getTopPlatformDevice().accessBitmap(true); |
| 99 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height); | 99 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height); |
| 100 SkBitmap b; | 100 SkBitmap b; |
| 101 if (!canvas_->readPixels(skrect, &b)) | 101 if (!canvas_->readPixels(skrect, &b)) |
| 102 return false; | 102 return false; |
| 103 output->writePixels(b, rect.x(), rect.y()); | 103 output->writePixels(b, rect.x(), rect.y()); |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| OLD | NEW |