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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 return TRUE; 158 return TRUE;
159 } 159 }
160 160
161 // Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey 161 // Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey
162 // filter. 162 // filter.
163 void DrawDeemphasized(const SkColor& color, 163 void DrawDeemphasized(const SkColor& color,
164 const gfx::Rect& paint_rect, 164 const gfx::Rect& paint_rect,
165 HDC backing_store_dc, 165 HDC backing_store_dc,
166 HDC paint_dc) { 166 HDC paint_dc) {
167 gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true); 167 gfx::CanvasSkia canvas;
168 HDC dc = canvas.beginPlatformPaint(); 168 canvas.Init(paint_rect.width(), paint_rect.height(), true);
169 HDC dc = canvas.BeginPlatformPaint();
169 BitBlt(dc, 170 BitBlt(dc,
170 0, 171 0,
171 0, 172 0,
172 paint_rect.width(), 173 paint_rect.width(),
173 paint_rect.height(), 174 paint_rect.height(),
174 backing_store_dc, 175 backing_store_dc,
175 paint_rect.x(), 176 paint_rect.x(),
176 paint_rect.y(), 177 paint_rect.y(),
177 SRCCOPY); 178 SRCCOPY);
178 canvas.endPlatformPaint(); 179 canvas.EndPlatformPaint();
179 canvas.FillRectInt(color, 0, 0, paint_rect.width(), paint_rect.height()); 180 canvas.FillRectInt(color, 0, 0, paint_rect.width(), paint_rect.height());
180 canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), 181 canvas.BlitToNativeContext(gfx::Rect(paint_rect.size()),
181 paint_rect.y(), NULL); 182 paint_rect.origin(), paint_dc);
182 } 183 }
183 184
184 // The plugin wrapper window which lives in the browser process has this proc 185 // The plugin wrapper window which lives in the browser process has this proc
185 // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by 186 // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by
186 // windowed plugins for mouse input. This is forwarded off to the wrappers 187 // windowed plugins for mouse input. This is forwarded off to the wrappers
187 // parent which is typically the RVH window which turns on user gesture. 188 // parent which is typically the RVH window which turns on user gesture.
188 LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message, 189 LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message,
189 WPARAM wparam, LPARAM lparam) { 190 WPARAM wparam, LPARAM lparam) {
190 if (message == WM_PARENTNOTIFY) { 191 if (message == WM_PARENTNOTIFY) {
191 switch (LOWORD(wparam)) { 192 switch (LOWORD(wparam)) {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } else { 940 } else {
940 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); 941 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc);
941 if (whiteout_start_time_.is_null()) 942 if (whiteout_start_time_.is_null())
942 whiteout_start_time_ = TimeTicks::Now(); 943 whiteout_start_time_ = TimeTicks::Now();
943 } 944 }
944 } 945 }
945 946
946 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, 947 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect,
947 CPaintDC* dc) { 948 CPaintDC* dc) {
948 if (!background_.empty()) { 949 if (!background_.empty()) {
949 gfx::CanvasSkia canvas(dirty_rect.right - dirty_rect.left, 950 gfx::CanvasSkia canvas;
950 dirty_rect.bottom - dirty_rect.top, 951 int width = dirty_rect.right - dirty_rect.left;
951 true); // opaque 952 int height = dirty_rect.bottom - dirty_rect.top;
953 canvas.Init(width, height, true); // opaque
952 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); 954 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top);
953 955
954 const RECT& dc_rect = dc->m_ps.rcPaint; 956 const RECT& dc_rect = dc->m_ps.rcPaint;
955 canvas.TileImageInt(background_, 0, 0, 957 canvas.TileImageInt(background_, 0, 0,
956 dc_rect.right - dc_rect.left, 958 dc_rect.right - dc_rect.left,
957 dc_rect.bottom - dc_rect.top); 959 dc_rect.bottom - dc_rect.top);
958 960
959 canvas.getTopPlatformDevice().drawToHDC(*dc, dirty_rect.left, 961 canvas.BlitToNativeContext(gfx::Rect(width, height),
960 dirty_rect.top, NULL); 962 gfx::Point(dirty_rect.left, dirty_rect.top), *dc);
961 } else { 963 } else {
962 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); 964 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
963 dc->FillRect(&dirty_rect, white_brush); 965 dc->FillRect(&dirty_rect, white_brush);
964 } 966 }
965 } 967 }
966 968
967 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { 969 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) {
968 // Do nothing. This suppresses the resize corner that Windows would 970 // Do nothing. This suppresses the resize corner that Windows would
969 // otherwise draw for us. 971 // otherwise draw for us.
970 } 972 }
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 } 1806 }
1805 1807
1806 // static 1808 // static
1807 RenderWidgetHostView* 1809 RenderWidgetHostView*
1808 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1810 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1809 gfx::NativeView native_view) { 1811 gfx::NativeView native_view) {
1810 return ::IsWindow(native_view) ? 1812 return ::IsWindow(native_view) ?
1811 reinterpret_cast<RenderWidgetHostView*>( 1813 reinterpret_cast<RenderWidgetHostView*>(
1812 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; 1814 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL;
1813 } 1815 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_manager.cc ('k') | chrome/browser/tab_contents/thumbnail_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698