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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index e5503dc9e260af56c15202884fa3f1299af8e6db..3f3777b57f2048b81fe4bb4f51f009f3b82cb558 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -2275,7 +2275,8 @@ void OmniboxViewWin::DrawSlashForInsecureScheme(HDC hdc,
// it to fully transparent so any antialiasing will look nice when painted
// atop the edit.
gfx::CanvasSkia canvas(scheme_rect.Width(), scheme_rect.Height(), false);
- canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0);
+ SkCanvas* sk_canvas = canvas.sk_canvas();
+ sk_canvas->getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0);
// Calculate the start and end of the stroke, which are just the lower left
// and upper right corners of the canvas, inset by the radius of the endcap
@@ -2299,26 +2300,26 @@ void OmniboxViewWin::DrawSlashForInsecureScheme(HDC hdc,
SkIntToScalar(scheme_rect.Height()) };
// Draw the unselected portion of the stroke.
- canvas.save();
+ sk_canvas->save();
if (selection_rect.isEmpty() ||
- canvas.clipRect(selection_rect, SkRegion::kDifference_Op)) {
+ sk_canvas->clipRect(selection_rect, SkRegion::kDifference_Op)) {
paint.setColor(LocationBarView::GetColor(security_level_,
LocationBarView::SECURITY_TEXT));
- canvas.drawLine(start_point.fX, start_point.fY,
- end_point.fX, end_point.fY, paint);
+ sk_canvas->drawLine(start_point.fX, start_point.fY,
+ end_point.fX, end_point.fY, paint);
}
- canvas.restore();
+ sk_canvas->restore();
// Draw the selected portion of the stroke.
- if (!selection_rect.isEmpty() && canvas.clipRect(selection_rect)) {
+ if (!selection_rect.isEmpty() && sk_canvas->clipRect(selection_rect)) {
paint.setColor(LocationBarView::GetColor(security_level_,
LocationBarView::SELECTED_TEXT));
- canvas.drawLine(start_point.fX, start_point.fY,
- end_point.fX, end_point.fY, paint);
+ sk_canvas->drawLine(start_point.fX, start_point.fY,
+ end_point.fX, end_point.fY, paint);
}
// Now copy what we drew to the target HDC.
- skia::DrawToNativeContext(&canvas, hdc,
+ skia::DrawToNativeContext(sk_canvas, hdc,
scheme_rect.left + canvas_paint_clip_rect.left - canvas_clip_rect.left,
std::max(scheme_rect.top, client_rect.top) + canvas_paint_clip_rect.top -
canvas_clip_rect.top, &canvas_paint_clip_rect);

Powered by Google App Engine
This is Rietveld 408576698