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

Side by Side Diff: content/browser/renderer_host/backing_store_skia.cc

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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) 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 "content/browser/renderer_host/backing_store_skia.h" 5 #include "content/browser/renderer_host/backing_store_skia.h"
6 6
7 #include "content/browser/renderer_host/render_process_host.h" 7 #include "content/browser/renderer_host/render_process_host_impl.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 17 matching lines...) Expand all
35 SkIntToScalar(point.x()), SkIntToScalar(point.y())); 35 SkIntToScalar(point.x()), SkIntToScalar(point.y()));
36 } 36 }
37 37
38 size_t BackingStoreSkia::MemorySize() { 38 size_t BackingStoreSkia::MemorySize() {
39 // NOTE: The computation may be different when the canvas is a subrectangle of 39 // NOTE: The computation may be different when the canvas is a subrectangle of
40 // a larger bitmap. 40 // a larger bitmap.
41 return size().GetArea() * 4; 41 return size().GetArea() * 4;
42 } 42 }
43 43
44 void BackingStoreSkia::PaintToBackingStore( 44 void BackingStoreSkia::PaintToBackingStore(
45 RenderProcessHost* process, 45 content::RenderProcessHost* process,
46 TransportDIB::Id bitmap, 46 TransportDIB::Id bitmap,
47 const gfx::Rect& bitmap_rect, 47 const gfx::Rect& bitmap_rect,
48 const std::vector<gfx::Rect>& copy_rects, 48 const std::vector<gfx::Rect>& copy_rects,
49 const base::Closure& completion_callback, 49 const base::Closure& completion_callback,
50 bool* scheduled_completion_callback) { 50 bool* scheduled_completion_callback) {
51 *scheduled_completion_callback = false; 51 *scheduled_completion_callback = false;
52 if (bitmap_rect.IsEmpty()) 52 if (bitmap_rect.IsEmpty())
53 return; 53 return;
54 54
55 const int width = bitmap_rect.width(); 55 const int width = bitmap_rect.width();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return false; 102 return false;
103 103
104 SkBitmap bitmap = skia::GetTopDevice(*output)->accessBitmap(true); 104 SkBitmap bitmap = skia::GetTopDevice(*output)->accessBitmap(true);
105 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height); 105 SkIRect skrect = SkIRect::MakeXYWH(rect.x(), rect.y(), width, height);
106 SkBitmap b; 106 SkBitmap b;
107 if (!canvas_->readPixels(skrect, &b)) 107 if (!canvas_->readPixels(skrect, &b))
108 return false; 108 return false;
109 output->writePixels(b, rect.x(), rect.y()); 109 output->writePixels(b, rect.x(), rect.y());
110 return true; 110 return true;
111 } 111 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_skia.h ('k') | content/browser/renderer_host/backing_store_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698