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

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

Issue 11031055: Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months 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 "content/browser/renderer_host/backing_store_win.h" 5 #include "content/browser/renderer_host/backing_store_win.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 paint_rect.x() - bitmap_rect.x(), 152 paint_rect.x() - bitmap_rect.x(),
153 paint_rect.y() - bitmap_rect.y(), 153 paint_rect.y() - bitmap_rect.y(),
154 paint_rect.width(), 154 paint_rect.width(),
155 paint_rect.height(), 155 paint_rect.height(),
156 dib->memory(), 156 dib->memory(),
157 reinterpret_cast<BITMAPINFO*>(&hdr)); 157 reinterpret_cast<BITMAPINFO*>(&hdr));
158 } 158 }
159 } 159 }
160 160
161 bool BackingStoreWin::CopyFromBackingStore(const gfx::Rect& rect, 161 bool BackingStoreWin::CopyFromBackingStore(const gfx::Rect& rect,
162 skia::PlatformCanvas* output) { 162 skia::PlatformBitmap* output) {
163 if (!output->initialize(rect.width(), rect.height(), true)) 163 if (!output->Allocate(rect.width(), rect.height(), true))
164 return false; 164 return false;
165 165
166 skia::ScopedPlatformPaint scoped_platform_paint(output); 166 HDC temp_dc = output->GetSurface();
167 HDC temp_dc = scoped_platform_paint.GetPlatformSurface();
168 BitBlt(temp_dc, 0, 0, rect.width(), rect.height(), 167 BitBlt(temp_dc, 0, 0, rect.width(), rect.height(),
169 hdc(), rect.x(), rect.y(), SRCCOPY); 168 hdc(), rect.x(), rect.y(), SRCCOPY);
170 return true; 169 return true;
171 } 170 }
172 171
173 void BackingStoreWin::ScrollBackingStore(int dx, int dy, 172 void BackingStoreWin::ScrollBackingStore(int dx, int dy,
174 const gfx::Rect& clip_rect, 173 const gfx::Rect& clip_rect,
175 const gfx::Size& view_size) { 174 const gfx::Size& view_size) {
176 RECT damaged_rect, r = clip_rect.ToRECT(); 175 RECT damaged_rect, r = clip_rect.ToRECT();
177 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect); 176 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect);
178 177
179 // TODO(darin): this doesn't work if dx and dy are both non-zero! 178 // TODO(darin): this doesn't work if dx and dy are both non-zero!
180 DCHECK(dx == 0 || dy == 0); 179 DCHECK(dx == 0 || dy == 0);
181 } 180 }
182 181
183 } // namespace content 182 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_win.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698