Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/native_theme_win.h" | 5 #include "ui/gfx/native_theme_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
| 9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
| 10 #include <vssym32.h> | 10 #include <vssym32.h> |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 State state, | 423 State state, |
| 424 const gfx::Rect& rect, | 424 const gfx::Rect& rect, |
| 425 const ExtraParams& extra) const { | 425 const ExtraParams& extra) const { |
| 426 // TODO(asvitkine): This path is pretty inefficient - for each paint operation | 426 // TODO(asvitkine): This path is pretty inefficient - for each paint operation |
| 427 // it creates a new offscreen bitmap Skia canvas. This can | 427 // it creates a new offscreen bitmap Skia canvas. This can |
| 428 // be sped up by doing it only once per part/state and | 428 // be sped up by doing it only once per part/state and |
| 429 // keeping a cache of the resulting bitmaps. | 429 // keeping a cache of the resulting bitmaps. |
| 430 | 430 |
| 431 // Create an offscreen canvas that is backed by an HDC. | 431 // Create an offscreen canvas that is backed by an HDC. |
| 432 scoped_ptr<SkCanvas> offscreen_canvas( | 432 scoped_ptr<SkCanvas> offscreen_canvas( |
| 433 skia::CreateBitmapCanvas(rect.width(), rect.height(), false)); | 433 skia::CreateBitmapCanvas(rect.width(), rect.height(), |
| 434 skia::PlatformDevice::FLAGS_INITIALIZED)); | |
|
Jeff Timanus
2012/02/23 22:14:10
This file is windows specific, so the initializati
| |
| 434 DCHECK(offscreen_canvas.get()); | 435 DCHECK(offscreen_canvas.get()); |
| 435 DCHECK(skia::SupportsPlatformPaint(offscreen_canvas.get())); | 436 DCHECK(skia::SupportsPlatformPaint(offscreen_canvas.get())); |
| 436 | 437 |
| 437 // Some of the Windows theme drawing operations do not write correct alpha | 438 // Some of the Windows theme drawing operations do not write correct alpha |
| 438 // values for fully-opaque pixels; instead the pixels get alpha 0. This is | 439 // values for fully-opaque pixels; instead the pixels get alpha 0. This is |
| 439 // especially a problem on Windows XP or when using the Classic theme. | 440 // especially a problem on Windows XP or when using the Classic theme. |
| 440 // | 441 // |
| 441 // To work-around this, mark all pixels with a placeholder value, to detect | 442 // To work-around this, mark all pixels with a placeholder value, to detect |
| 442 // which pixels get touched by the paint operation. After paint, set any | 443 // which pixels get touched by the paint operation. After paint, set any |
| 443 // pixels that have alpha 0 to opaque and placeholders to fully-transparent. | 444 // pixels that have alpha 0 to opaque and placeholders to fully-transparent. |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1753 handle = open_theme_(NULL, L"Spin"); | 1754 handle = open_theme_(NULL, L"Spin"); |
| 1754 break; | 1755 break; |
| 1755 default: | 1756 default: |
| 1756 NOTREACHED(); | 1757 NOTREACHED(); |
| 1757 } | 1758 } |
| 1758 theme_handles_[theme_name] = handle; | 1759 theme_handles_[theme_name] = handle; |
| 1759 return handle; | 1760 return handle; |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1762 } // namespace gfx | 1763 } // namespace gfx |
| OLD | NEW |