| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <psapi.h> | 6 #include <psapi.h> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "skia/ext/bitmap_platform_device_win.h" | 10 #include "skia/ext/bitmap_platform_device_win.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 return hbitmap; | 118 return hbitmap; |
| 119 } | 119 } |
| 120 | 120 |
| 121 PlatformBitmapPixelRef::PlatformBitmapPixelRef(const SkImageInfo& info, | 121 PlatformBitmapPixelRef::PlatformBitmapPixelRef(const SkImageInfo& info, |
| 122 HBITMAP bitmap_handle, | 122 HBITMAP bitmap_handle, |
| 123 void* pixels) | 123 void* pixels) |
| 124 : SkPixelRef(info), | 124 : SkPixelRef(info), |
| 125 bitmap_handle_(bitmap_handle), | 125 bitmap_handle_(bitmap_handle), |
| 126 pixels_(pixels) { | 126 pixels_(pixels) { |
| 127 setPreLocked(pixels, NULL); | 127 setPreLocked(pixels, info.minRowBytes(), NULL); |
| 128 } | 128 } |
| 129 | 129 |
| 130 PlatformBitmapPixelRef::~PlatformBitmapPixelRef() { | 130 PlatformBitmapPixelRef::~PlatformBitmapPixelRef() { |
| 131 if (bitmap_handle_) | 131 if (bitmap_handle_) |
| 132 DeleteObject(bitmap_handle_); | 132 DeleteObject(bitmap_handle_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void* PlatformBitmapPixelRef::onLockPixels(SkColorTable** color_table) { | 135 void* PlatformBitmapPixelRef::onLockPixels(SkColorTable** color_table) { |
| 136 *color_table = NULL; | 136 *color_table = NULL; |
| 137 return pixels_; | 137 return pixels_; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(info, | 409 RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(info, |
| 410 hbitmap, | 410 hbitmap, |
| 411 data)); | 411 data)); |
| 412 bitmap_.setPixelRef(pixel_ref.get()); | 412 bitmap_.setPixelRef(pixel_ref.get()); |
| 413 bitmap_.lockPixels(); | 413 bitmap_.lockPixels(); |
| 414 | 414 |
| 415 return true; | 415 return true; |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace skia | 418 } // namespace skia |
| OLD | NEW |