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

Unified Diff: chrome/renderer/render_widget.cc

Issue 2976008: Bar (Closed)
Patch Set: rebase Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_widget.cc
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 5b5058e7a8167c9caae6aecafd73e7842329c891..7d4df9d91c700211f340c95590310fbdb1ad9f79 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -371,6 +371,10 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
skia::PlatformCanvas* canvas) {
canvas->save();
+ //CGContextRef cg_context = canvas->getTopPlatformDevice().GetBitmapContext();
+ //CGContextSaveGState(cg_context);
+ //CGContextScaleCTM(cg_context, 0.2, 0.2);
+
// Bring the canvas into the coordinate system of the paint rect.
canvas->translate(static_cast<SkScalar>(-canvas_origin.x()),
static_cast<SkScalar>(-canvas_origin.y()));
@@ -393,6 +397,8 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
// Flush to underlying bitmap. TODO(darin): is this needed?
canvas->getTopPlatformDevice().accessBitmap(false);
+ //CGContextRestoreGState(cg_context);
+
canvas->restore();
}
@@ -742,6 +748,7 @@ void RenderWidget::OnImeConfirmComposition() {
// This message causes the renderer to render an image of the
// desired_size, regardless of whether the tab is hidden or not.
void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
+ int sequence_num,
const gfx::Size& page_size,
const gfx::Size& desired_size) {
if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue())
@@ -751,7 +758,7 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
// If one of these is empty, then we just return the dib we were
// given, to avoid leaking it.
Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_,
- dib_handle,
+ sequence_num,
desired_size));
return;
}
@@ -790,9 +797,28 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
bounds.set_width(canvas->getDevice()->width());
bounds.set_height(canvas->getDevice()->height());
- canvas->save();
// Add the scale factor to the canvas, so that we'll get the desired size.
+//#if WEBKIT_USING_SKIA
+ canvas->save();
canvas->scale(SkFloatToScalar(x_scale), SkFloatToScalar(y_scale));
+//#else
+ // Scaling the canvas would draw at normal size and then scale the pixels
+ // down, so that only the upper left image is filled. Scale CG equivalent
+ // instead.
+// ToWebCanvas: canvas->getTopPlatformDevice().GetBitmapContext();
+// typedef struct CGContext WebCanvas;
+
+// WebKit's WebFrameImpl:
+// GraphicsContext gc(canvas);
+
+ //CGContextRef cg_context = canvas->getTopPlatformDevice().GetBitmapContext();
+//fprintf(stderr, "context a %f %f: %p\n", x_scale, y_scale, cg_context);
+ //CGContextSaveGState(cg_context);
+ //CGContextScaleCTM(cg_context, x_scale, y_scale);
+
+ //CGContextTranslateCTM(cg_context, 500, 500);
+
+//#endif
// Have to make sure we're laid out at the right size before
// rendering.
@@ -801,13 +827,20 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
webwidget_->layout();
// Paint the entire thing (using original bounds, not scaled bounds).
+//orig_bounds.set_width(orig_bounds.width() / x_scale);
+//orig_bounds.set_height(orig_bounds.height() / y_scale);
PaintRect(orig_bounds, orig_bounds.origin(), canvas.get());
+//#if WEBKIT_USING_SKIA
canvas->restore();
+//#else
+ //CGContextRestoreGState(cg_context);
+//#endif
// Return the widget to its previous size.
webwidget_->resize(old_size);
- Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, dib_handle, bounds.size()));
+ Send(new ViewHostMsg_PaintAtSize_ACK(
+ routing_id_, sequence_num, bounds.size()));
}
void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698