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

Side by Side Diff: webkit/tools/test_shell/webwidget_host_gtk.cc

Issue 14110: Move the "platform" wrappers in skia/ext to the skia namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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/tools/test_shell/webwidget_host.h ('k') | webkit/tools/test_shell/webwidget_host_win.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) 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 "webkit/tools/test_shell/webwidget_host.h" 5 #include "webkit/tools/test_shell/webwidget_host.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 void WebWidgetHost::Paint() { 214 void WebWidgetHost::Paint() {
215 int width = view_->allocation.width; 215 int width = view_->allocation.width;
216 int height = view_->allocation.height; 216 int height = view_->allocation.height;
217 gfx::Rect client_rect(width, height); 217 gfx::Rect client_rect(width, height);
218 218
219 // Allocate a canvas if necessary 219 // Allocate a canvas if necessary
220 if (!canvas_.get()) { 220 if (!canvas_.get()) {
221 ResetScrollRect(); 221 ResetScrollRect();
222 paint_rect_ = client_rect; 222 paint_rect_ = client_rect;
223 canvas_.reset(new gfx::PlatformCanvas(width, height, true)); 223 canvas_.reset(new skia::PlatformCanvas(width, height, true));
224 if (!canvas_.get()) { 224 if (!canvas_.get()) {
225 // memory allocation failed, we can't paint. 225 // memory allocation failed, we can't paint.
226 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; 226 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height;
227 return; 227 return;
228 } 228 }
229 } 229 }
230 230
231 // This may result in more invalidation 231 // This may result in more invalidation
232 webwidget_->Layout(); 232 webwidget_->Layout();
233 233
(...skipping 21 matching lines...) Expand all
255 // we wish to avoid. So instead we use calls to begin_paint/end_paint. 255 // we wish to avoid. So instead we use calls to begin_paint/end_paint.
256 GdkRectangle grect = { 256 GdkRectangle grect = {
257 total_paint.x(), 257 total_paint.x(),
258 total_paint.y(), 258 total_paint.y(),
259 total_paint.width(), 259 total_paint.width(),
260 total_paint.height(), 260 total_paint.height(),
261 }; 261 };
262 gdk_window_begin_paint_rect(view_->window, &grect); 262 gdk_window_begin_paint_rect(view_->window, &grect);
263 263
264 // BitBlit to the gdk window. 264 // BitBlit to the gdk window.
265 gfx::PlatformDeviceLinux &platdev = canvas_->getTopPlatformDevice(); 265 skia::PlatformDeviceLinux &platdev = canvas_->getTopPlatformDevice();
266 gfx::BitmapPlatformDeviceLinux* const bitdev = 266 skia::BitmapPlatformDeviceLinux* const bitdev =
267 static_cast<gfx::BitmapPlatformDeviceLinux* >(&platdev); 267 static_cast<skia::BitmapPlatformDeviceLinux* >(&platdev);
268 cairo_t* cairo_drawable = gdk_cairo_create(view_->window); 268 cairo_t* cairo_drawable = gdk_cairo_create(view_->window);
269 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); 269 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0);
270 cairo_paint(cairo_drawable); 270 cairo_paint(cairo_drawable);
271 cairo_destroy(cairo_drawable); 271 cairo_destroy(cairo_drawable);
272 272
273 gdk_window_end_paint(view_->window); 273 gdk_window_end_paint(view_->window);
274 } 274 }
275 275
276 void WebWidgetHost::ResetScrollRect() { 276 void WebWidgetHost::ResetScrollRect() {
277 // This method is only needed for optimized scroll painting, which we don't 277 // This method is only needed for optimized scroll painting, which we don't
278 // care about in the test shell, yet. 278 // care about in the test shell, yet.
279 } 279 }
280 280
281 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 281 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
282 set_painting(true); 282 set_painting(true);
283 webwidget_->Paint(canvas_.get(), rect); 283 webwidget_->Paint(canvas_.get(), rect);
284 set_painting(false); 284 set_painting(false);
285 } 285 }
286 286
287 void WebWidgetHost::WindowDestroyed() { 287 void WebWidgetHost::WindowDestroyed() {
288 delete this; 288 delete this;
289 } 289 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/webwidget_host.h ('k') | webkit/tools/test_shell/webwidget_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698