Index: views/controls/tree/tree_view.cc |
=================================================================== |
--- views/controls/tree/tree_view.cc (revision 82144) |
+++ views/controls/tree/tree_view.cc (working copy) |
@@ -18,7 +18,6 @@ |
#include "ui/base/win/hwnd_util.h" |
#include "ui/base/l10n/l10n_util_win.h" |
#include "ui/gfx/canvas_skia.h" |
-#include "ui/gfx/canvas_skia_paint.h" |
#include "ui/gfx/favicon_size.h" |
#include "ui/gfx/icon_util.h" |
#include "ui/gfx/point.h" |
@@ -700,9 +699,10 @@ |
// IDR_FOLDER_CLOSED if they aren't already. |
if (model_images[i].width() != width || |
model_images[i].height() != height) { |
- gfx::CanvasSkia canvas(width, height, false); |
+ gfx::CanvasSkia canvas; |
+ canvas.Init(width, height, false); |
// Make the background completely transparent. |
- canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); |
+ canvas.skia_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); |
// Draw our icons into this canvas. |
int height_offset = (height - model_images[i].height()) / 2; |
@@ -751,12 +751,22 @@ |
return 1; |
case WM_PAINT: { |
- gfx::CanvasSkiaPaint canvas(window); |
- if (canvas.isEmpty()) |
+ PAINTSTRUCT ps = {0}; |
+ HDC window_dc = BeginPaint(window, &ps); |
+ |
+ int width = ps.rcPaint.right - ps.rcPaint.left; |
+ int height = ps.rcPaint.bottom - ps.rcPaint.top; |
+ if ((width == 0) || (height == 0)) |
return 0; |
- HDC dc = canvas.beginPlatformPaint(); |
+ // Create a bitmap to draw on. |
+ HDC bitmap_dc = CreateCompatibleDC(window_dc); |
+ HBITMAP bitmap = CreateCompatibleBitmap(window_dc, width, height); |
+ HGDIOBJ default_obj = SelectObject(bitmap_dc, bitmap); |
if (base::i18n::IsRTL()) { |
+ // TODO(alokp): May not need this hack anymore since we are creating |
+ // a compatible bitmap device context. |
+ |
// gfx::CanvasSkia ends up configuring the DC with a mode of |
// GM_ADVANCED. For some reason a graphics mode of ADVANCED triggers |
// all the text to be mirrored when RTL. Set the mode back to COMPATIBLE |
@@ -769,27 +779,38 @@ |
// transform still carry over when we set the mode. |
XFORM xform = {0}; |
xform.eM11 = xform.eM22 = 1; |
- SetWorldTransform(dc, &xform); |
+ SetWorldTransform(bitmap_dc, &xform); |
// Set the mode and layout. |
- SetGraphicsMode(dc, GM_COMPATIBLE); |
- SetLayout(dc, LAYOUT_RTL); |
+ SetGraphicsMode(bitmap_dc, GM_COMPATIBLE); |
+ SetLayout(bitmap_dc, LAYOUT_RTL); |
// Transform the viewport such that the origin of the dc is that of |
// the dirty region. This way when we invoke WM_PRINTCLIENT tree-view |
// draws the dirty region at the origin of the DC so that when we |
// copy the bits everything lines up nicely. Without this we end up |
// copying the upper-left corner to the redraw region. |
- SetViewportOrgEx(dc, -canvas.paintStruct().rcPaint.left, |
- -canvas.paintStruct().rcPaint.top, NULL); |
+ SetViewportOrgEx(bitmap_dc, -ps.rcPaint.left, -ps.rcPaint.top, NULL); |
} |
- SendMessage(window, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc), 0); |
+ |
+ SendMessage(window, WM_PRINTCLIENT, |
+ reinterpret_cast<WPARAM>(bitmap_dc), 0); |
+ |
if (base::i18n::IsRTL()) { |
// Reset the origin of the dc back to 0. This way when we copy the bits |
// over we copy the right bits. |
- SetViewportOrgEx(dc, 0, 0, NULL); |
+ SetViewportOrgEx(bitmap_dc, 0, 0, NULL); |
} |
- canvas.endPlatformPaint(); |
+ |
+ // Copy the bitmap to window. |
+ BitBlt(window_dc, ps.rcPaint.left, ps.rcPaint.top, width, height, |
+ bitmap_dc, 0, 0, SRCCOPY); |
+ |
+ // Cleanup. |
+ SelectObject(bitmap_dc, default_obj); |
+ DeleteDC(bitmap_dc); |
+ DeleteObject(bitmap); |
+ EndPaint(window, &ps); |
return 0; |
} |