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

Side by Side Diff: webkit/tools/test_shell/mac/webwidget_host.mm

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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
« no previous file with comments | « webkit/plugins/sad_plugin.cc ('k') | webkit/tools/test_shell/test_shell_webthemecontrol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "webkit/tools/test_shell/webwidget_host.h" 7 #include "webkit/tools/test_shell/webwidget_host.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Allocate a canvas if necessary 172 // Allocate a canvas if necessary
173 if (!canvas_.get()) { 173 if (!canvas_.get()) {
174 ResetScrollRect(); 174 ResetScrollRect();
175 paint_rect_ = client_rect; 175 paint_rect_ = client_rect;
176 canvas_.reset(new skia::PlatformCanvas( 176 canvas_.reset(new skia::PlatformCanvas(
177 paint_rect_.width(), paint_rect_.height(), true)); 177 paint_rect_.width(), paint_rect_.height(), true));
178 } 178 }
179 179
180 // make sure webkit draws into our bitmap, not the window 180 // make sure webkit draws into our bitmap, not the window
181 CGContextRef bitmap_context = 181 CGContextRef bitmap_context =
182 canvas_->getTopPlatformDevice().GetBitmapContext(); 182 skia::GetBitmapContext(skia::GetTopDevice(*canvas_));
183 [NSGraphicsContext setCurrentContext: 183 [NSGraphicsContext setCurrentContext:
184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context 184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context
185 flipped:YES]]; 185 flipped:YES]];
186 186
187 webwidget_->animate(); 187 webwidget_->animate();
188 188
189 // This may result in more invalidation 189 // This may result in more invalidation
190 webwidget_->layout(); 190 webwidget_->layout();
191 191
192 // Scroll the canvas if necessary 192 // Scroll the canvas if necessary
(...skipping 21 matching lines...) Expand all
214 214
215 // set the context back to our window 215 // set the context back to our window
216 [NSGraphicsContext setCurrentContext: view_context]; 216 [NSGraphicsContext setCurrentContext: view_context];
217 217
218 // Paint to the screen 218 // Paint to the screen
219 if ([view_ lockFocusIfCanDraw]) { 219 if ([view_ lockFocusIfCanDraw]) {
220 int bitmap_height = CGBitmapContextGetHeight(bitmap_context); 220 int bitmap_height = CGBitmapContextGetHeight(bitmap_context);
221 int bitmap_width = CGBitmapContextGetWidth(bitmap_context); 221 int bitmap_width = CGBitmapContextGetWidth(bitmap_context);
222 CGRect bitmap_rect = { { 0, 0 }, 222 CGRect bitmap_rect = { { 0, 0 },
223 { bitmap_width, bitmap_height } }; 223 { bitmap_width, bitmap_height } };
224 canvas_->getTopPlatformDevice().DrawToContext( 224 skia::DrawToNativeContext(canvas_.get(), context, 0,
225 context, 0, client_rect.height() - bitmap_height, &bitmap_rect); 225 client_rect.height() - bitmap_height, &bitmap_rect);
226 226
227 [view_ unlockFocus]; 227 [view_ unlockFocus];
228 } 228 }
229 } 229 }
230 230
231 WebScreenInfo WebWidgetHost::GetScreenInfo() { 231 WebScreenInfo WebWidgetHost::GetScreenInfo() {
232 return WebScreenInfoFactory::screenInfo(view_); 232 return WebScreenInfoFactory::screenInfo(view_);
233 } 233 }
234 234
235 void WebWidgetHost::Resize(const gfx::Rect& rect) { 235 void WebWidgetHost::Resize(const gfx::Rect& rect) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
278 #ifndef NDEBUG 278 #ifndef NDEBUG
279 DCHECK(!painting_); 279 DCHECK(!painting_);
280 #endif 280 #endif
281 DCHECK(canvas_.get()); 281 DCHECK(canvas_.get());
282 282
283 set_painting(true); 283 set_painting(true);
284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); 284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect);
285 set_painting(false); 285 set_painting(false);
286 } 286 }
OLDNEW
« no previous file with comments | « webkit/plugins/sad_plugin.cc ('k') | webkit/tools/test_shell/test_shell_webthemecontrol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698