| OLD | NEW |
| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return TRUE; | 162 return TRUE; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey | 165 // Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey |
| 166 // filter. | 166 // filter. |
| 167 void DrawDeemphasized(const SkColor& color, | 167 void DrawDeemphasized(const SkColor& color, |
| 168 const gfx::Rect& paint_rect, | 168 const gfx::Rect& paint_rect, |
| 169 HDC backing_store_dc, | 169 HDC backing_store_dc, |
| 170 HDC paint_dc) { | 170 HDC paint_dc) { |
| 171 gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true); | 171 gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true); |
| 172 HDC dc = canvas.beginPlatformPaint(); | 172 { |
| 173 BitBlt(dc, | 173 skia::ScopedPlatformPaint scoped_platform_paint(&canvas); |
| 174 0, | 174 HDC dc = scoped_platform_paint.GetPlatformSurface(); |
| 175 0, | 175 BitBlt(dc, |
| 176 paint_rect.width(), | 176 0, |
| 177 paint_rect.height(), | 177 0, |
| 178 backing_store_dc, | 178 paint_rect.width(), |
| 179 paint_rect.x(), | 179 paint_rect.height(), |
| 180 paint_rect.y(), | 180 backing_store_dc, |
| 181 SRCCOPY); | 181 paint_rect.x(), |
| 182 canvas.endPlatformPaint(); | 182 paint_rect.y(), |
| 183 SRCCOPY); |
| 184 } |
| 183 canvas.FillRectInt(color, 0, 0, paint_rect.width(), paint_rect.height()); | 185 canvas.FillRectInt(color, 0, 0, paint_rect.width(), paint_rect.height()); |
| 184 canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), | 186 skia::DrawToNativeContext(&canvas, paint_dc, paint_rect.x(), |
| 185 paint_rect.y(), NULL); | 187 paint_rect.y(), NULL); |
| 186 } | 188 } |
| 187 | 189 |
| 188 // The plugin wrapper window which lives in the browser process has this proc | 190 // The plugin wrapper window which lives in the browser process has this proc |
| 189 // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by | 191 // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by |
| 190 // windowed plugins for mouse input. This is forwarded off to the wrappers | 192 // windowed plugins for mouse input. This is forwarded off to the wrappers |
| 191 // parent which is typically the RVH window which turns on user gesture. | 193 // parent which is typically the RVH window which turns on user gesture. |
| 192 LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message, | 194 LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message, |
| 193 WPARAM wparam, LPARAM lparam) { | 195 WPARAM wparam, LPARAM lparam) { |
| 194 if (message == WM_PARENTNOTIFY) { | 196 if (message == WM_PARENTNOTIFY) { |
| 195 switch (LOWORD(wparam)) { | 197 switch (LOWORD(wparam)) { |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 gfx::CanvasSkia canvas(dirty_rect.right - dirty_rect.left, | 956 gfx::CanvasSkia canvas(dirty_rect.right - dirty_rect.left, |
| 955 dirty_rect.bottom - dirty_rect.top, | 957 dirty_rect.bottom - dirty_rect.top, |
| 956 true); // opaque | 958 true); // opaque |
| 957 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); | 959 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); |
| 958 | 960 |
| 959 const RECT& dc_rect = dc->m_ps.rcPaint; | 961 const RECT& dc_rect = dc->m_ps.rcPaint; |
| 960 canvas.TileImageInt(background_, 0, 0, | 962 canvas.TileImageInt(background_, 0, 0, |
| 961 dc_rect.right - dc_rect.left, | 963 dc_rect.right - dc_rect.left, |
| 962 dc_rect.bottom - dc_rect.top); | 964 dc_rect.bottom - dc_rect.top); |
| 963 | 965 |
| 964 canvas.getTopPlatformDevice().drawToHDC(*dc, dirty_rect.left, | 966 skia::DrawToNativeContext(&canvas, *dc, dirty_rect.left, dirty_rect.top, |
| 965 dirty_rect.top, NULL); | 967 NULL); |
| 966 } else { | 968 } else { |
| 967 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); | 969 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
| 968 dc->FillRect(&dirty_rect, white_brush); | 970 dc->FillRect(&dirty_rect, white_brush); |
| 969 } | 971 } |
| 970 } | 972 } |
| 971 | 973 |
| 972 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { | 974 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { |
| 973 // Do nothing. This suppresses the resize corner that Windows would | 975 // Do nothing. This suppresses the resize corner that Windows would |
| 974 // otherwise draw for us. | 976 // otherwise draw for us. |
| 975 } | 977 } |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 } | 1776 } |
| 1775 | 1777 |
| 1776 // static | 1778 // static |
| 1777 RenderWidgetHostView* | 1779 RenderWidgetHostView* |
| 1778 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1780 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 1779 gfx::NativeView native_view) { | 1781 gfx::NativeView native_view) { |
| 1780 return ::IsWindow(native_view) ? | 1782 return ::IsWindow(native_view) ? |
| 1781 reinterpret_cast<RenderWidgetHostView*>( | 1783 reinterpret_cast<RenderWidgetHostView*>( |
| 1782 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1784 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
| 1783 } | 1785 } |
| OLD | NEW |